是否可以使用转换器/样式选择器而无需使用数据绑定?
如果达到某个值,我希望我的对象的样式能够改变。
这就是我所拥有的
<Border Name="watch0_0Border" Grid.Row="0" Grid.Column="0" Style="{StaticResource clockBorderStyle}">
<StackPanel Style="{StaticResource clockStackPanelStyle}">
<TextBlock Name="watch0_0Time" Style="{StaticResource clockTimerStyle}">07:45:23</TextBlock>
<TextBlock Name="watch0_0Description" Style="{StaticResource clockTextStyle}" Text="{Binding ElementName=watch0_0WorkDescription, Path=Text}"></TextBlock>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
<Button Name="watch0_0Pause" Margin="5" Click="watch0_0Pause_Click">Pause</Button>
<Button Name="watch0_0SetNewTime" Margin="5" Click="watch0_0SetNewTime_Click">Set new time</Button>
</StackPanel>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
<TextBox Name="watch0_0Hours" Margin="5">0</TextBox>
<TextBox Name="watch0_0Minutes" Margin="5">0</TextBox>
<TextBox Name="watch0_0Seconds" Margin="5">0</TextBox>
</StackPanel>
<TextBox Name="watch0_0WorkDescription" TextAlignment="Center" Margin="5">Work description</TextBox>
</StackPanel>
</Border>
当时间低于0时,我想得到边框的背景。
答案 0 :(得分:1)
如果您的计时器可以访问主窗口(可以访问watch0_0Border)或直接watch0_0Border(通过在创建计时器时传入这些),那么您应该只能使用UI调度程序来设置watch0_0Border.BorderBrush(或任何属性) )当计时器达到零时。