简体   繁体   中英

Converter/styles selector without binding?

Is it possible to use a converter/style selector without having to use databinding?

I want the style of my object to change if a certain value is reached.

Here is what i have

    <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>

I want to canhe the background of the border when the times goes under 0.

如果您的计时器可以访问主窗口(可以访问watch0_0Border)或直接访问watch0_0Border(通过在创建计时器时将其传递进来),那么您应该能够使用UI调度程序在计时器时设置watch0_0Border.BorderBrush(或任何属性)达到零。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM