Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

Style Trigger Based on Bound Control Values

$
0
0

This seems like it should be easy, but I'm missing something.  I have several controls, each bound to different DataTable columns.  Here is an example:

<TextBlock Name="EntryAirlockPressure" Style="{StaticResource PressureLabelStyle}" 
Text="{Binding Mode=OneWay, Path=[0][con_data_entry_EACHP], StringFormat=F2}" 
  ToolTip="con_data_entry_EACHP" Height="20" Width="60" Margin="5,0,0,0"/>


And here is the style they are based on:

<Style x:Key="PressureLabelStyle" TargetType="TextBlock"><Setter Property="HorizontalAlignment" Value="Left"/><Setter Property="VerticalAlignment" Value="Top"/><Setter Property="FontFamily" Value="Consolas"/><Setter Property="FontSize" Value="14"/><Setter Property="ToolTipService.ShowOnDisabled" Value="True"/></Style>

Now I want to put a trigger in the style so if the value of any of the controls goes over a set value, I will get some visual queues.  Best would be a larger font, perhaps flashing red-black-red-black, etc., or some other visual queue.  I can work on the flashing part later, but for now, just bumping the font size and/or color would be great.

I've done data triggers based on dependency properties before, but not based on a DataColumn data context.  Can anybody suggest how to do this?

Thanks...


Ron Mittelman


Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>