0

コンボボックスのトリガーを追加しました。

  • コンボ ボックスが「無効」の場合、「テキスト」プロパティを「1」に設定し、変更されたプロパティに updatesourcetrigger を追加する必要があります。

  • コンボ ボックスが「有効」の場合、「テキスト」プロパティを選択し、変更されたプロパティに更新元トリガーを追加する必要があります。

しかし問題は、コンボ ボックスが無効で、'Text' プロパティが '1' に設定されている場合、更新元トリガーを呼び出すことができないことです。

以下は、XAML コード スニペットです。

<ComboBox Name="cmbIntervals"
                        Grid.Row="5"
                        Grid.Column="1"
                        Width="150"
                        HorizontalAlignment="Left"
                        VerticalAlignment="Top"
                        IsEnabled="{Binding ElementName=chkRollingInterval,
                                              Path=IsChecked}"
                        ItemsSource="{Binding Source={x:Static es:MasterParameters.Instance},
                                                Path=NoOfIntervals}" 
                        Tag="{Binding Path=[NoOfIntervals], Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                        >
                  <ComboBox.Style>
                    <Style TargetType="{x:Type ComboBox}">
                      <Style.Triggers>
                        <Trigger Property="IsEnabled" Value="False">
                        <Setter Property="Text" Value="1"/>
                        <Setter Property="Text" Value="{Binding RelativeSource={RelativeSource Self}, Path=Tag, Mode=TwoWay, UpdateSourceTrigger=Default}"/>
                      </Trigger>
                      <Trigger Property="IsEnabled" Value="True">
                        <Setter Property="Text" Value="{Binding RelativeSource={RelativeSource Self}, Path=Tag, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
                      </Trigger>
                      </Style.Triggers>
                   </Style>
                </ComboBox.Style>
              </ComboBox>

上記の XAML コードから、コンボ ボックスの 'Disabeld' モードで 'Text' プロパティを '1' に更新したとき、この '1' 値をソース プロパティ、つまり 'Tag' に更新し、そこから 'NoOfIntervals' に更新する必要がありますが、そうではありません。起こっていません。

ありがとう、ナグ

4

0 に答える 0