| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- <Window xmlns="https://github.com/perspex"
- xmlns:vm="clr-namespace:BindingTest.ViewModels;assembly=BindingTest"
- xmlns:local="clr-namespace:BindingTest;assembly=BindingTest">
- <Window.Styles>
- <Style Selector="TextBlock.h1">
- <Setter Property="FontSize" Value="18"/>
- </Style>
- </Window.Styles>
-
- <TabControl>
- <TabItem Header="Basic">
- <StackPanel Orientation="Vertical">
- <StackPanel Orientation="Horizontal">
- <StackPanel Margin="18" Gap="4" Width="200">
- <TextBlock FontSize="16" Text="Simple Bindings"/>
- <TextBox Watermark="Two Way" UseFloatingWatermark="True" Text="{Binding Path=StringValue}" Name="first"/>
- <TextBox Watermark="One Way" UseFloatingWatermark="True" Text="{Binding Path=StringValue, Mode=OneWay}"/>
- <TextBox Watermark="One Time" UseFloatingWatermark="True" Text="{Binding Path=StringValue, Mode=OneTime}"/>
- </StackPanel>
- <StackPanel Margin="18" Gap="4" Width="200">
- <TextBlock FontSize="16" Text="Collection Bindings"/>
- <TextBox Watermark="Items[1].StringValue" UseFloatingWatermark="True" Text="{Binding Path=Items[1].StringValue}"/>
- <Button Command="{Binding ShuffleItems}">Shuffle</Button>
- </StackPanel>
- <StackPanel Margin="18" Gap="4" Width="200">
- <TextBlock FontSize="16" Text="Negated Bindings"/>
- <TextBox Watermark="Boolean String" UseFloatingWatermark="True" Text="{Binding Path=BooleanString}"/>
- <CheckBox IsChecked="{Binding !BooleanString}">!BooleanString</CheckBox>
- <CheckBox IsChecked="{Binding !!BooleanString}">!!BooleanString</CheckBox>
- </StackPanel>
- </StackPanel>
- <StackPanel Orientation="Horizontal">
- <StackPanel Margin="18" Gap="4" Width="200" HorizontalAlignment="Left">
- <TextBlock FontSize="16" Text="Numeric Bindings"/>
- <TextBox Watermark="Double" UseFloatingWatermark="True" Text="{Binding Path=DoubleValue, Mode=TwoWay}"/>
- <TextBlock Text="{Binding Path=DoubleValue}"/>
- <ProgressBar Maximum="10" Value="{Binding DoubleValue}"/>
- </StackPanel>
- <StackPanel Margin="18" Gap="4" Width="200" HorizontalAlignment="Left">
- <TextBlock FontSize="16" Text="Binding Sources"/>
- <TextBox Watermark="Value of first TextBox" UseFloatingWatermark="True"
- Text="{Binding #first.Text, Mode=TwoWay}"/>
- </StackPanel>
- </StackPanel>
- </StackPanel>
- </TabItem>
- <TabItem Header="ListBox">
- <StackPanel Orientation="Horizontal">
- <StackPanel.DataTemplates>
- <DataTemplate DataType="vm:TestItem">
- <TextBlock Text="{Binding StringValue}"/>
- </DataTemplate>
- </StackPanel.DataTemplates>
- <StackPanel Margin="18" Gap="4" Width="200">
- <TextBlock FontSize="16" Text="Multiple"/>
- <ListBox Items="{Binding Items}" SelectionMode="Multiple" SelectedItems="{Binding SelectedItems}"/>
- </StackPanel>
- <StackPanel Margin="18" Gap="4" Width="200">
- <TextBlock FontSize="16" Text="Multiple"/>
- <ListBox Items="{Binding Items}" SelectionMode="Multiple" SelectedItems="{Binding SelectedItems}"/>
- </StackPanel>
- <ContentControl Content="{Binding SelectedItems[0]}">
- <ContentControl.DataTemplates>
- <DataTemplate DataType="vm:TestItem">
- <local:TestItemView></local:TestItemView>
- </DataTemplate>
- </ContentControl.DataTemplates>
- </ContentControl>
- </StackPanel>
- </TabItem>
- </TabControl>
- </Window>
|