12-14-2017 12:55 PM
Two issues.
1. I have to use the "Fill" property to set the color of the TankDouble bar. Where are the properties defined in the NI user documentation for the WPF Tank or TankDouble? I do not see Fill in the list, but it obviously is the property that controls the fill color.
2. I use the following styling on a TankDouble. I want to remove the shading effect on the tank fill. How can I do that, i.e., what Property controls the shading?
<Style x:Key="TankStyle" TargetType="{x:Type ni:TankDouble}">
<Setter Property="Orientation" Value="Horizontal" />
<Setter Property="Height" Value="Auto" />
<Setter Property="Width" Value="Auto" />
<Setter Property="Margin" Value="1,1,1,1" />
<Setter Property="Range" Value="{Binding Range, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}" />
<Style.Triggers>
<DataTrigger Binding="{Binding InRange, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}" Value="True">
<Setter Property="Fill" Value="#FF32CD32"></Setter>
</DataTrigger>
<DataTrigger Binding="{Binding InRange, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}" Value="False">
<Setter Property="Fill" Value="#FF49A4FF"></Setter>
</DataTrigger>
</Style.Triggers>
</Style>
Thanks!!!
12-14-2017 01:36 PM
Sorry about the trouble with the documentation: it appears the base class properties are not being pulled in. I have created a task to correct this.
The Fill
property is defined on the LinearNumericPointer<TValue,TOffset>
generic base class.
Unfortunately, the shading effect is built into the skin of the tank, and there is no configuration property available to change its visibility. Instead of creating a custom control skin, you could use a derived type to remove the element from the default template:
public class EffectFreeTankDouble : TankDouble { public override void OnApplyTemplate( ) { base.OnApplyTemplate( ); var track = (Panel)Track; var effect = track.Children .OfType<Rectangle>( ) .First( HasHighlightEffect ); track.Children.Remove( effect ); } private static bool HasHighlightEffect( Rectangle rectangle ) { var fill = rectangle.Fill as SolidColorBrush ?? Brushes.Black; return fill.Color == Colors.White && rectangle.OpacityMask != null; } }
07-08-2019 02:01 PM
Just wanted to let you know that Measurement Studio 2019 added additional resource keys to control the appearance and visibility of numeric visuals:
<ni:TankDouble> <ni:TankDouble.Resources> <Visibility x:Key="{x:Static niPrimitives:ControlConfiguration.HighlightPartVisibilityKey}">Collapsed</Visibility> </ni:TankDouble.Resources> </ni:TankDouble>