正如您可以在标题中看到的那样,虽然您可以设置不透明度,但我无法在SciChart中设置AxisMarker的可见性属性。
这将是Class
<s:AxisMarkerAnnotation x:Class="PT.Modules.Infrastructure.CustomAxisMarker" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="http://schemas.abtsoftware.co.uk/scichart"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:PT.Modules.Infrastructure" xmlns:progSettingServ="clr-namespace:PT.ProgramSettingsService;assembly=PT.ProgramSettingsService"
mc:Ignorable="d" Background="{Binding BackgroundColor}" LabelTemplate="{DynamicResource AxisMarkerTemplate}"
VerticalAnchorPoint="{Binding VerticalAnchor}" HorizontalAnchorPoint="{Binding HorizontalAnchor}" RenderTransformOrigin="{Binding RenderOrigin}"
AnnotationCanvas="AboveChart" X1="{Binding X1}" Y1="{Binding Y1}" X2="{Binding X2}" Y2="{Binding Y2}" IsHitTestVisible="False" d:DesignHeight="300"
d:DesignWidth="300" Focusable="False" HorizontalAlignment="Right">
<s:AxisMarkerAnnotation.Resources>
AxisMarker风格
<s:AxisMarkerAnnotation.Style>
<Style TargetType="{x:Type s:AxisMarkerAnnotation}">
<!--works-->
<Setter Property="Opacity" Value="0"/>
<!--won't work-->
<Setter Property="Visibility" Value="Hidden"/>
<Style.Triggers>
<DataTrigger Binding="{Binding CanChange, UpdateSourceTrigger=PropertyChanged}" Value="True">
<DataTrigger.EnterActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetProperty="(Border.Opacity)" From="1" To="0" Duration="0:0:0.75" AutoReverse="True"
RepeatBehavior="5x" />
</Storyboard>
</BeginStoryboard>
</DataTrigger.EnterActions>
<DataTrigger.ExitActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetProperty="Opacity" To="1.0" Duration="0:0:0" />
</Storyboard>
</BeginStoryboard>
</DataTrigger.ExitActions>
</DataTrigger>
<DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType={x:Type s:AxisMarkerAnnotation}},Path=DataContext.ProgramSettings.ChartSettings.Orientation, UpdateSourceTrigger=PropertyChanged}"
Value="{x:Static progSettingServ:TouchMode.Wide}">
<Setter Property="Opacity" Value="1" />
</DataTrigger>
</Style.Triggers>
</Style>
</s:AxisMarkerAnnotation.Style>
答案 0 :(得分:1)
设置IsHidden属性而不是Visibility属性将起作用!