code_junkie

Enabling a button in WPF depending on ListBox.SelectedIndex

Nov 10th, 2011
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. <Button Name="btn1" >click me
  2. <Button.Style>
  3. <Style>
  4. <Style.Triggers>
  5. <DataTrigger
  6. Binding ="{Binding ElementName=list1, Path=SelectedIndex}"
  7. Value="-1">
  8. <Setter Property="Button.IsEnabled" Value="false"/>
  9. </DataTrigger>
  10. </Style.Triggers>
  11. </Style>
  12. </Button.Style>
  13. </Button>
Add Comment
Please, Sign In to add comment