Hi
I have a page that has 2 buttons i wish to disable unless my app is registered, and have set it up through binding.
the first button on the form (Clock) takes no notice of the fact that IsEnabled = False, however the 2nd (Job) button next to it disables/enables as it should and works fine.
if i manually set IsEnabled To False rather than through binding then it doesnt work either, it totally disregards it just the same as the binding
if i use IsVisible instead, then that works fine (but i dont want to do that in my app)
if i set the containing grid's IsEnabled, then it disables my button but of course doesnt 'grey out' the buttons which i want it to do - i just want IsEnabled to do what it says on the tin.
heres my code snippet
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="5*" />
<ColumnDefinition Width="5*" />
</Grid.ColumnDefinitions>
<sfbuttons:SfButton Text="Clock"
Grid.Column="0"
Style="{StaticResource SfButtonStyle2}"
ImageSource="{PluginLibrary:PlatformImage SourceImage='Clock32W.png'}"
HorizontalOptions="StartAndExpand"
CommandParameter="C"
Command="{Binding SaveClockingCommand}"
IsEnabled="{Binding IsAppRegistered}">
</sfbuttons:SfButton>
<sfbuttons:SfButton Text="Job"
Grid.Column="1"
Style="{StaticResource SfButtonStyle2}"
ImageSource="{PluginLibrary:PlatformImage SourceImage='Hammer32W.png'}"
HorizontalOptions="EndAndExpand"
Clicked="JobLogButton_Clicked"
IsEnabled="{Binding IsAppRegistered}" >
</sfbuttons:SfButton>
</Grid>
ive done some googling and research and through the link here:
https://forums.xamarin.com/discussion/47857/setting-buttons-isenabled-to-false-does-not-disable-button
it seems to indicate that if you remove the Command it works fine (and hey presto it does work) and i think this may have been cured in native xamarin forms, as before i migrated to using Sf buttons didnt have this issue and didnt need to try find some convoluted 'workaround' to cure what should be functional in the first place. maybe i used 'clicked' instead of a command, and thats why it worked then, im not sure it was a while ago, but a command is much neater in my MVVM code behind and i would like to keep it that way
so whats the score with this please - is there a cure & can you fix it
btw heres the command i use in my ViewModel, it's argument specifies the type of clocking transaction i save, i.e C,J,A
public ICommand SaveClockingCommand { get; private set; }
SaveClockingCommand = new Command<string>(async (x) => await SaveClocking(x));
thanks
Bob