一段时间后,UI不会根据触发器进行更新

loading...


0

我创建了一个自定义控件如下:
CollapseView

如果用户单击右侧图标,即Checkbox(自定义复选框),ListBox项将展开,checkBox图标将更改,如下所示
ExpandView

以下是Xaml代码

<CheckBox  x:Name="ExpandCheckBox" IsChecked="{Binding HasExpanded,UpdateSourceTrigger=PropertyChanged}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
                                <CheckBox.Resources>
                                    <SolidColorBrush x:Key="CircleStrokeHighlightBrush" Color="#FF3C7FB1"/>
                                    <SolidColorBrush x:Key="CircleFillHighlightBrush" Color="Transparent"/>
                                    <SolidColorBrush x:Key="ArrowStrokeHighlightBrush" Color="#222"/>
                                    <SolidColorBrush x:Key="CircleFillBrush" Color="Transparent"/>
                                    <SolidColorBrush x:Key="StrokeBrush" Color="DarkGray"/>
                                    <SolidColorBrush x:Key="ArrowStrokeBrush" Color="#666"/>
                                </CheckBox.Resources>
                                <CheckBox.Template>
                                    <ControlTemplate TargetType="{x:Type CheckBox}">
                                        <Border HorizontalAlignment="Stretch" VerticalAlignment="Stretch" BorderThickness="1,0,1,0"  BorderBrush="{StaticResource PA_DarkGray}">
                                            <Grid x:Name="CheckBoxButtonGrid"  HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
                                                <Ellipse x:Name="circle"  Fill="{StaticResource CircleFillBrush}" HorizontalAlignment="Center" Height="19" Width="19" 
                                                                 Stroke="{StaticResource StrokeBrush}" VerticalAlignment="Center" />
                                                <Path x:Name="arrow"  HorizontalAlignment="Center" SnapsToDevicePixels="false" 
                                                              Stroke="{StaticResource ArrowStrokeBrush}" StrokeThickness="2" VerticalAlignment="Center"/>
                                            </Grid>
                                        </Border>
                                        <ControlTemplate.Triggers>
                                            <Trigger Property="IsChecked" Value="true">
                                                <Setter Property="Data" TargetName="arrow" Value="M 1,4.5  L 4.5,1  L 8,4.5"/>
                                            </Trigger>
                                            <Trigger Property="IsChecked" Value="false">
                                                <Setter Property="Data" TargetName="arrow" Value="M 1,1.5 L 4.5,5 L 8,1.5"/>
                                            </Trigger>
                                            <Trigger Property="IsMouseOver" Value="true">
                                                <Setter Property="Stroke" TargetName="circle" Value="{StaticResource CircleStrokeHighlightBrush}"/>
                                                <Setter Property="Fill" TargetName="circle" Value="{StaticResource CircleFillHighlightBrush}"/>
                                                <Setter Property="Stroke" TargetName="arrow" Value="{StaticResource ArrowStrokeHighlightBrush}"/>
                                            </Trigger>
                                        </ControlTemplate.Triggers>
                                    </ControlTemplate>
                                </CheckBox.Template>
                                <CheckBox.FocusVisualStyle>
                                    <Style>
                                        <Setter Property="Control.Template">
                                            <Setter.Value>
                                                <ControlTemplate>
                                                    <Border>
                                                        <Rectangle Margin="0" SnapsToDevicePixels="true" Stroke="Black" StrokeThickness="1" StrokeDashArray="1 2"/>
                                                    </Border>
                                                </ControlTemplate>
                                            </Setter.Value>
                                        </Setter>
                                    </Style>
                                </CheckBox.FocusVisualStyle>
                            </CheckBox>

这个视图,我在我们的应用程序的弹出窗口中显示 . 一切正常,但如果我将弹出窗口打开15到20分钟(在CollpasedView模式下),CheckBox不会检查和取消选中,并且在UI中不会更新为更新复选框箭头数据而写入的触发器 . (在Snoop IsChecked属性中正在更新但在UI CheckBox模板中没有更新)请帮助解决问题 .

loading...

0回答

No Data

评论

暂时没有评论!