1
0

MainWindow.paml 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <Window xmlns="https://github.com/perspex"
  2. xmlns:vm="clr-namespace:BindingTest.ViewModels;assembly=BindingTest">
  3. <TabControl>
  4. <TabItem Header="Basic">
  5. <StackPanel Orientation="Horizontal">
  6. <StackPanel Margin="18" Gap="4" Width="200">
  7. <TextBlock FontSize="16" Text="Simple Bindings"/>
  8. <TextBox Watermark="Two Way" UseFloatingWatermark="True" Text="{Binding StringValue}"/>
  9. <TextBox Watermark="One Way" UseFloatingWatermark="True" Text="{Binding Path=StringValue, Mode=OneWay}"/>
  10. <TextBox Watermark="One Time" UseFloatingWatermark="True" Text="{Binding Path=StringValue, Mode=OneTime}"/>
  11. <TextBox Watermark="One Way To Source" UseFloatingWatermark="True" Text="{Binding Path=StringValue, Mode=OneWayToSource}"/>
  12. </StackPanel>
  13. <StackPanel Margin="18" Gap="4" Width="200">
  14. <TextBlock FontSize="16" Text="Collection Bindings"/>
  15. <TextBox Watermark="Items[1].StringValue" UseFloatingWatermark="True" Text="{Binding Items[1].StringValue}"/>
  16. <Button Command="{Binding ShuffleItems}">Shuffle</Button>
  17. </StackPanel>
  18. <StackPanel Margin="18" Gap="4" Width="200">
  19. <TextBlock FontSize="16" Text="Negated Bindings"/>
  20. <TextBox Watermark="Boolean String" UseFloatingWatermark="True" Text="{Binding BooleanString}"/>
  21. <CheckBox IsChecked="{Binding !BooleanString}">!BooleanString</CheckBox>
  22. <CheckBox IsChecked="{Binding !!BooleanString}">!!BooleanString</CheckBox>
  23. </StackPanel>
  24. </StackPanel>
  25. </TabItem>
  26. <TabItem Header="ListBox">
  27. <StackPanel Orientation="Horizontal">
  28. <StackPanel.DataTemplates>
  29. <DataTemplate DataType="vm:TestItem">
  30. <TextBlock Text="{Binding StringValue}"/>
  31. </DataTemplate>
  32. </StackPanel.DataTemplates>
  33. <StackPanel Margin="18" Gap="4" Width="200">
  34. <TextBlock FontSize="16" Text="Multiple"/>
  35. <ListBox Items="{Binding Items}" SelectionMode="Multiple" SelectedItems="{Binding SelectedItems}"/>
  36. </StackPanel>
  37. <StackPanel Margin="18" Gap="4" Width="200">
  38. <TextBlock FontSize="16" Text="Multiple"/>
  39. <ListBox Items="{Binding Items}" SelectionMode="Multiple" SelectedItems="{Binding SelectedItems}"/>
  40. </StackPanel>
  41. </StackPanel>
  42. </TabItem>
  43. </TabControl>
  44. </Window>