|
9 | 9 | <Design.DataContext>
|
10 | 10 | <vm:MainWindowViewModel />
|
11 | 11 | </Design.DataContext>
|
12 |
| - <Grid RowDefinitions="Auto,*"> |
13 |
| - <TextBox Grid.Row="0" Text="{Binding MyString}" /> |
14 |
| - <Border Grid.Row="1" Background="Black" CornerRadius="5"> |
| 12 | + <Grid RowDefinitions="*,Auto"> |
| 13 | + <Rectangle Name="DataTriggerRectangle" |
| 14 | + Grid.Row="0" Margin="5" |
| 15 | + Fill="{DynamicResource BlueBrush}" |
| 16 | + Stroke="{DynamicResource GrayBrush}" |
| 17 | + StrokeThickness="5"> |
15 | 18 | <Interaction.Behaviors>
|
16 |
| - <DataTriggerBehavior Binding="{Binding MyString}" ComparisonCondition="Equal" Value=""> |
17 |
| - <ChangePropertyAction PropertyName="IsVisible" Value="False" /> |
| 19 | + <DataTriggerBehavior Binding="{Binding #Slider.Value}" |
| 20 | + ComparisonCondition="GreaterThan" |
| 21 | + Value="50"> |
| 22 | + <ChangePropertyAction TargetObject="DataTriggerRectangle" |
| 23 | + PropertyName="Fill" |
| 24 | + Value="{DynamicResource YellowBrush}" /> |
18 | 25 | </DataTriggerBehavior>
|
19 |
| - <DataTriggerBehavior Binding="{Binding MyString}" ComparisonCondition="NotEqual" Value=""> |
20 |
| - <ChangePropertyAction PropertyName="IsVisible" Value="True" /> |
| 26 | + <DataTriggerBehavior Binding="{Binding #Slider.Value}" |
| 27 | + ComparisonCondition="LessThanOrEqual" |
| 28 | + Value="50"> |
| 29 | + <ChangePropertyAction TargetObject="DataTriggerRectangle" |
| 30 | + PropertyName="Fill" |
| 31 | + Value="{DynamicResource BlueBrush}" /> |
21 | 32 | </DataTriggerBehavior>
|
22 | 33 | </Interaction.Behaviors>
|
23 |
| - <StackPanel> |
24 |
| - <TextBlock FontSize="25" Foreground="White"> |
25 |
| - <Interaction.Behaviors> |
26 |
| - <DataTriggerBehavior Binding="{Binding MyString}" ComparisonCondition="NotEqual" Value=""> |
27 |
| - <ChangePropertyAction PropertyName="Text" Value="{Binding MyString}" /> |
28 |
| - </DataTriggerBehavior> |
29 |
| - </Interaction.Behaviors> |
30 |
| - </TextBlock> |
31 |
| - </StackPanel> |
32 |
| - </Border> |
| 34 | + </Rectangle> |
| 35 | + <StackPanel Grid.Row="1" |
| 36 | + Margin="5,0,5,5" |
| 37 | + Orientation="Horizontal" |
| 38 | + HorizontalAlignment="Center" |
| 39 | + VerticalAlignment="Center"> |
| 40 | + <TextBlock Text="{Binding #Slider.Value}" |
| 41 | + VerticalAlignment="Center" |
| 42 | + Width="50" |
| 43 | + Foreground="{DynamicResource GrayBrush}" /> |
| 44 | + <Slider Name="Slider" Width="400" IsSnapToTickEnabled="True" TickFrequency="1" /> |
| 45 | + </StackPanel> |
33 | 46 | </Grid>
|
34 | 47 | </UserControl>
|
0 commit comments