Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
230
Set Button.IsEnabled to true if a data record in grid is selected.
posted

I have a button on my window. I would like it to be enabled only if a data record in the grid has been selected. I would like to bind this up in a xaml line of code like this:

    IsEnabled="{Binding ElementName=EmailGrid, Path=HasSelectedRecord}"

Which property of the grid would I used for 'HasSelectedRecord' ?

Thx
Tom

 

Parents
No Data
Reply
  • 2125
    posted

    Hi TLangFromInfragistics,

    I would suggest the following solution:

    <Button  Grid.Row="1" 
                  Height="23" 
                  Margin="151,0,175,38"
                  Name="button1"
                  VerticalAlignment="Bottom" 
                  IsEnabled="{Binding ElementName=xamDataGrid1, Path=SelectedItems.Records.Count, 
                  Converter ={StaticResource dataConverter}}">
                  Button
    </Button>

    The attached ButtonEnabling sample application contains the full solution implementation.

    Best Regards,
    Yanko

    ButtonEnabling.zip
Children
No Data