mercredi 24 février 2016

bindable property for checkbox ischecked do not reflect when trigger used

My bindable property RevalSurfaceChecked do not get updated when we set IsChecked property in trigger

<CheckBox Grid.Row="1" Grid.Column="2" Grid.ColumnSpan="2" x:Name="chkRevalSurface" Content="Export Reval Surface (if applicable)" 
                  HorizontalAlignment="Left" VerticalAlignment="Center">
            <CheckBox.IsEnabled>
                <MultiBinding Converter="{StaticResource RevalSurfaceCheckboxEnableConverter}">
                    <Binding ElementName="ChkExportToCSV" Path="IsChecked"></Binding>
                    <Binding ElementName="chkExportToExcel" Path="IsChecked"></Binding>
                </MultiBinding>
            </CheckBox.IsEnabled>
            <CheckBox.Style>
                <Style TargetType="{x:Type CheckBox}">
                    <Setter Property="IsChecked" Value="{Binding RevalSurfaceChecked}" />
                    <Style.Triggers>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter Property="IsChecked" Value="False"></Setter>
                        </Trigger>
                    </Style.Triggers>
                </Style>
            </CheckBox.Style>
        </CheckBox>

The logic here is that if I check any of the two checkbox, then the chkRevalSurface should get enabled else stay disabled-written in converter. When chkRevalSurface is disabled it should be set unchecked (written in trigger) and RevalSurfaceChecked property should be set to False. if checked set it to True in viewmodel.

ButRevalSurfaceCheckedis not set to true or false.




Aucun commentaire:

Enregistrer un commentaire