This is the declaration of my button, written in a .xaml file:
<dxlc:LayoutGroup Orientation="Horizontal" Margin="5,15,0,5">
<Grid MinWidth="100">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Button
IsEnabled="{Binding IsSearchCriteriaHasValue}"
Content="Search"
MaxHeight="25"
MaxWidth="70"
ClipToBounds="True"
VerticalAlignment="Center"
HorizontalAlignment="Center"
HorizontalContentAlignment="Center"
VerticalContentAlignment="Center"
Command="{Binding SearchCommand}"/>
</Grid>
</dxlc:LayoutGroup>
This is a function that returns true / false whether the user enters any search text in the search field next to the search button. The function is in another .cs file:
public bool isButtonEnabled
{
return (SearchBox.Selection.Count > 0);
}
The problem is that the value of isEnabled never changes, it remains true, i.e. the button remains on all the time, or if I change the> sign, the button remains off all the time. Any suggestions?
source
share