#Point measure command not working code#
NET is accurate or not but it seems that the CanExecute got broken since 4.5 and I have no idea whether it has been fixed or not but since it is not being triggered with the above code for me, for now, I can only assume that the problem lies with the latter.Īs a work-around, MVVMLight provides the RaiseCanExecuteChanged method so it can be called as: I don't know if the statement from: about. I will try one of the other suggestions but can't believe it is not fixed after having been reported so long ago! I'm using MVVMLight and I tried setting up the flag for the CanExecute but unfortunately this doesn't work! public Rela圜ommand StartCommand => this._startCommand Pretty poor from Xamarin/Microsoft that this issue is still present and we're practically in 2019 and was originally reported back in 2015.
![point measure command not working point measure command not working](https://i.ytimg.com/vi/sps7D1xwX0A/maxresdefault.jpg)
Let me know if you want a working demo, ill make a github post then. Then use the button as you would use any button:
![point measure command not working point measure command not working](https://wcl.blue-mare.pl/templates/57f9e8d318a8c822f6d28974872853fd/img/c24dfe32dd12ac11d1c296758e910964.png)
Protected override void OnElementChanged(ElementChangedEventArgs e) Public class CustomButtonRenderer: ButtonRenderer Make a custom renderer (same as the first snippet in this post for android):
![point measure command not working point measure command not working](https://www.itechguides.com/wp-content/uploads/2020/03/image-1055-1024x582.png)
Public static readonly BindableProperty SubmitCommandProperty = I used: public const string SubmitCommandPropertyName = "SubmitCommand" SubmitButton.SetBinding (Button.CommandProperty, "SubmitCommand") Instead of: submitButton.SetBinding (Button.IsEnabledProperty, "SubmitButtonEnabled") I hit this same problem today and the solution that worked for me was to create a bindable Command property on the view and triggering that via the buttons Clicked event handler, rather than binding directly to the buttons command property. įor more information on Triggers, check out this blog entry: You can of course use any logic in your Behavior for validation as long as the boolean that is returned as the Path is bound to your trigger(s). Then in the XAML page, I use a Data Trigger (or MultiTriggers in this case) and bind them to a Behavior which returns a boolean to check that the entry has a value. (_m圜ommand = new Command(async () => await ExecuteM圜ommand(), () => false)) What DID work for me was this approach:ĭisable the button by default by calling false for the Func expression of the Command constructor: public ICommand M圜ommand The order of Command and IsEnabled attributes on the Button element did NOT solve it for me. Will alwasy be disabled please change to your logic eg IsBusy view model property*/
![point measure command not working point measure command not working](http://sugartownpublishing.com/yahoo_site_admin/assets/images/C-Coleman-final-cover_sm.114120810_std.jpg)
*the false returned in second constructor parameter will mean that button bound to this command Public const string SaveCommandPropertyName = "SaveCommand" public Command SaveCommand If that func returns a false then the button is disabled. If using Xamarin's Command class you will noticed it has a second constructor argument that takes a func returning a bool that lets the Command know if it can execute. However if the Command is set then it appears that the IsEnabled property uses the return value of the ICommand.CanExecute() method. If the Command property is not set then all appears to work correctly. It seems to be related to the Button's Command property. I do not observe this behavior in other views though. This button is located at the bottom of the grid. I have observed that when setting a button's IsEnabled property to false, the button continues to be enabled.