﻿<?xml version="1.0" encoding="utf-8"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:media="http://search.yahoo.com/mrss/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0"><channel><title>Intersoft Community - Crosslight - How to Use Crosslight to Bind CanExecute on ActionBar Items?</title><link>http://www.intersoftsolutions.com/Community/Crosslight/How-to-Use-Crosslight-to-Bind-CanExecute-on-ActionBar-Items/</link><description /><generator>http://www.intersoftsolutions.com</generator><language>en</language><copyright>Copyright 2002 - 2015 Intersoft Solutions Corp. All rights reserved.</copyright><ttl>60</ttl><item><title>How to Use Crosslight to Bind CanExecute on ActionBar Items?</title><link>http://www.intersoftsolutions.com/Community/Crosslight/How-to-Use-Crosslight-to-Bind-CanExecute-on-ActionBar-Items/</link><pubDate>Thu, 30 Apr 2015 02:52:29 GMT</pubDate><dc:creator>Arief</dc:creator><description>&lt;p style="font-size: 13.3333330154419px;"&gt;Hi Jimmy,&lt;br&gt;&lt;br&gt;Sorry looks like i send you the wrong code, (I assume the problem is from the lack of ID in axml) so it is actually already right to use&amp;nbsp;ContextualActionBarSettings &amp;amp;&amp;nbsp;EditingOptions,&amp;nbsp;&lt;br&gt;&lt;br&gt;In your solution in MyInventory Master Detail what actually i change to allow the CanExecute to work is to change the CanExecuteMarkSold method in ItemListViewModel into:&lt;br&gt;&lt;/p&gt;&lt;pre&gt;		private bool CanExecuteMarkSold(object parameter)		{
			if (parameter is Item)
				return true;
			else if (parameter is IEnumerable&amp;lt;Item&amp;gt;)
                return ((IEnumerable&amp;lt;Item&amp;gt;)parameter)&lt;b&gt;.Where(o =&amp;gt; o.IsSold == false)&lt;/b&gt;.Count() &amp;gt; 0;
			
			return false;
		}&lt;/pre&gt;&lt;p style="font-size: 13.3333330154419px;"&gt;Here is the sample i make yesterday that similar with the solutions that you give me (using MyInventoryWebAPI)&lt;br&gt;&lt;br&gt;&lt;span style="color: rgb(51, 51, 51); font-family: 'Lucida Grande', 'Lucida Sans Unicode', Helvetica, Arial, Verdana, sans-serif; font-size: 13px; line-height: 19.5px; background-color: rgb(255, 255, 255);"&gt;Please download the samples by&amp;nbsp;&lt;/span&gt;&lt;a href="http://www.mediafire.com/download/zi16y99lqc1y3w2/MyInventory_WebApi%282%29.zip" target="_blank"&gt;clicking here.&lt;/a&gt;&lt;br&gt;&lt;br&gt;Hope that'll helps&lt;br&gt;&lt;br&gt;Best Regards&lt;br&gt;Arief&lt;/p&gt;</description></item><item><title>How to Use Crosslight to Bind CanExecute on ActionBar Items?</title><link>http://www.intersoftsolutions.com/Community/Crosslight/How-to-Use-Crosslight-to-Bind-CanExecute-on-ActionBar-Items/</link><pubDate>Wed, 29 Apr 2015 19:11:54 GMT</pubDate><dc:creator>jtungol@silentpartnersoft.com</dc:creator><description>&lt;p&gt;Clearly... there is something wrong here. Either that... or we're breaking some rules from Android's guidelines. Please take a look at &lt;span style="font-weight: bold;"&gt;MyInventory_MasterDetail&lt;/span&gt; that we modified. Specifically, adding a menu layout named "&lt;strong&gt;sold_actions.axml&lt;/strong&gt;" and modified &lt;strong&gt;ItemListFragment.cs&lt;/strong&gt; to specify &lt;strong&gt;MenuLayoutId&lt;/strong&gt;. Please run the sample on &lt;span style="font-weight: bold;"&gt;Anroid Tablet&lt;/span&gt; for better viewing.&lt;/p&gt;&lt;p&gt;
&lt;/p&gt;&lt;pre&gt;&amp;lt;?xml version="1.0" encoding="utf-8"?&amp;gt;
&amp;lt;menu xmlns:android="http://schemas.android.com/apk/res/android"&amp;gt;
    &amp;lt;item
        android:id="@+id/MarkSoldButton"
        android:title="@string/MarkAsSold"
        android:showAsAction="ifRoom|withText" /&amp;gt;
&amp;lt;/menu&amp;gt;
&lt;/pre&gt;


&lt;p&gt;
&lt;/p&gt;&lt;pre&gt;protected override int MenuLayoutId 
{
    get { return Resource.Menu.sold_actions; }
}
&lt;/pre&gt;


&lt;p&gt;Please download the solution by &lt;span style="font-weight: bold;"&gt;&lt;a href="https://mercury.silentpartnersoft.com/ClientService/MyInventory_MasterDetail.zip" target="_blank"&gt;clicking here&lt;/a&gt;&lt;/span&gt;.&lt;/p&gt;</description></item><item><title>How to Use Crosslight to Bind CanExecute on ActionBar Items?</title><link>http://www.intersoftsolutions.com/Community/Crosslight/How-to-Use-Crosslight-to-Bind-CanExecute-on-ActionBar-Items/</link><pubDate>Wed, 29 Apr 2015 04:44:32 GMT</pubDate><dc:creator>Arief</dc:creator><description>&lt;p style="font-size: 13.3333330154419px;"&gt;Hi Jimmy,&lt;br&gt;&lt;br&gt;About the buttonID actually even already included in view identifier, you still must manually added it to Android Layout, using this code in activity:&lt;/p&gt;&lt;pre&gt;        protected override int MenuLayoutId        {
            get { return Resource.Layout.actionbarlistlayout; }
        }&lt;/pre&gt;&lt;p style="font-size: 13.3333330154419px;"&gt;&amp;nbsp;actionbarlistlayout is the layout name, and inside of the axml:&lt;br&gt;&lt;/p&gt;&lt;pre&gt;&amp;lt;?xml version="1.0" encoding="utf-8"?&amp;gt;
&amp;lt;menu xmlns:android="http://schemas.android.com/apk/res/android"&amp;gt;
    &amp;lt;item
        android:id="@+id/SearchButton"
        android:icon="@drawable/ic_search"
        android:title="Search"
        android:showAsAction="ifRoom|withText|collapseActionView"
        android:actionViewClass="android.widget.SearchView" /&amp;gt;
    &amp;lt;item
        android:id="@+id/AddButton"
        android:icon="@drawable/ic_menu_add"
        android:title="Add"
        android:showAsAction="ifRoom|withText" /&amp;gt;
&amp;lt;/menu&amp;gt;&lt;/pre&gt;&lt;p style="font-size: 13.3333330154419px;"&gt;Can confirm i already tested it in MyInventoryWebApi which using DataListViewModelBase and Changing the Activity into Fragment and i encounter no problem the CanExecute function was working as intended (if i try to markSold marked Sold item, the button will be disabled)&lt;br&gt;&lt;br&gt;Best Regard&lt;br&gt;Arief&lt;/p&gt;</description></item><item><title>How to Use Crosslight to Bind CanExecute on ActionBar Items?</title><link>http://www.intersoftsolutions.com/Community/Crosslight/How-to-Use-Crosslight-to-Bind-CanExecute-on-ActionBar-Items/</link><pubDate>Mon, 27 Apr 2015 14:41:01 GMT</pubDate><dc:creator>jtungol@silentpartnersoft.com</dc:creator><description>&lt;p&gt;Hi Arief,&lt;/p&gt;&lt;p&gt;Can you confirm the same for DataListViewModelBase? The usual bindings are set, and working on iOS... except for Android. BindingProvider contains pairing of both ButtonId and Commands. The buttons are defined for Android using a menu axml, with the same IDs used with that of the iOS' view controllers. Both are sharing the same viewmodel, as intended for cross platform configurations. The only difference between the two platforms is that... on iOS we have to use RegisterViewIdentifier for the button IDs, and we don;t see how that is being used with Android except for the "this.RegisterViewIdentifier("TableView", this.ListView);" statement. I'm guessing the button IDs are registered with view identifier automatically for Android.&amp;nbsp;&lt;/p&gt;&lt;p&gt;Kindly test this scenario on ListFragment and DataListViewModelBase. As already mentioned, setting the return value of all CanExecute funtions to a static value of true will enable the buttons at runtime, but doesn't change states using dynamic calls. Breakpoints to CanExecute functions suggest that the functions are being called; however, regardless of the values... the buttons don't change to Enabled/Disabled states. That being said, RaiseCanExecuteChanged method are also being called for each delegate commands, but it's not helping.&lt;/p&gt;&lt;p&gt;The current configuration (BindingProvider, ViewModel) works on iOS, but not on Android... so it may be due to the VIEW being used.&lt;/p&gt;</description></item><item><title>How to Use Crosslight to Bind CanExecute on ActionBar Items?</title><link>http://www.intersoftsolutions.com/Community/Crosslight/How-to-Use-Crosslight-to-Bind-CanExecute-on-ActionBar-Items/</link><pubDate>Mon, 27 Apr 2015 09:21:06 GMT</pubDate><dc:creator>Arief</dc:creator><description>&lt;p&gt;Hi Jimmy,&lt;br&gt;&lt;br&gt;To bind CanExecute on ActionBar Items is actually just as you expected to be, we only need to bind ButtonId to BindingProvider then to the Command in ViewModel, then inside the new delegate command we include both Execute and CanExecute method.&lt;br&gt;&lt;br&gt;Also please check this sample because based from our testing, we sucessfully use CanExecute in dynamically changing condition, we also put breakpoints inside the ItemListViewModel.cs. If succeed the Mark Sold button (when you long press an item, the button will appear) will be disabled when it used for sold items. &lt;br&gt;&lt;br&gt;If the problem still persist please inform us, we will be glad to help!&lt;br&gt;&lt;br&gt;Best Regards,&lt;br&gt;Arief&lt;br&gt;&lt;/p&gt;</description></item><item><title>How to Use Crosslight to Bind CanExecute on ActionBar Items?</title><link>http://www.intersoftsolutions.com/Community/Crosslight/How-to-Use-Crosslight-to-Bind-CanExecute-on-ActionBar-Items/</link><pubDate>Fri, 24 Apr 2015 21:55:13 GMT</pubDate><dc:creator>jtungol@silentpartnersoft.com</dc:creator><description>&lt;p&gt;Okay, so how do we properly bind commands to menu items from the action bar where CanExecute is dynamically changing or raised from a viewmodel? I mean, BindingProvider is the area for all this feature to pair a button id to a command, but CanExecute functions are not working on Android even if DelegateCommand.RaiseCanExecuteChanged() is being called. Regardless if the return value is true or false, it's not doing anything to the menu items... their Enabled states don't change. This doesn't seem to be an issue on iOS. Do we have to call RegisterViewIdentifier or what?&lt;/p&gt;

&lt;p&gt;Please advise. Thanks!&lt;/p&gt;</description></item></channel></rss>