UI not updating based on the trigger after some time

119 Views Asked by At

I have created a custom control as following: CollapseView

If the user clicks on the right icon i.e Checkbox (Custom CheckBox), the ListBox item will expand and checkBox icon will change, look like following ExpandView

Below is the Xaml Code

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

This View, I am showing in the popup window in our application. Everything is working fine, but if I keep the popup window open for 15 to 20 minutes (in CollpasedView mode), the CheckBox is not checking and unchecking and the trigger written to update the check box arrow data is not updating in the UI. (In Snoop IsChecked property is updating but in UI CheckBox template is not updating) Please help to figuring out the issue.

0

There are 0 best solutions below