コンボボックスで値を選択したとき、別のコントロールを非表示にする必要があります。私は以下のようにコードを書いています。私が間違っていた箇所を修正してください。MVVMを使用してWPFでコントロールを非表示にできない
コードの表示:
<ComboBox x:Name="cboShowRuleWhere" Height="20" Width="200" ItemsSource="{Binding Source={StaticResource listedView}, Path=FilterRules}" DisplayMemberPath="RuleName" SelectedValuePath="RuleId" SelectedValue="{Binding Source={StaticResource listedView}, Path=SelectedRuleName, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}" ></ComboBox>
<ComboBox Height="21" HorizontalAlignment="Left" Margin="6,4,0,0" x:Name="cboRuleCondtion" Visibility="{Binding Path=IsButtonVisible,Converter={StaticResource BoolToVisible}}" VerticalAlignment="Top" Width="212" />
のViewModelコード:私は修正する必要が
private DataTable m_selectedRuleName;
public DataTable SelectedRuleName
{
get
{
return m_selectedRuleName;
}
set
{
m_selectedRuleName = value;
base.RaisePropertyChangedEvent("SelectedRuleName");
}
}
private bool _IsButtonVisible;
public bool IsButtonVisible
{
get { return _IsButtonVisible; }
set
{
_IsButtonVisible = value;
base.RaisePropertyChangedEvent("IsButtonVisible");
}
}
?できるだけ早く私を助けてください。ありがとうございます。
私はそれがしばらくしていることを知っており、質問者はおそらくあなたの応答を見たことはありませんでしたが、それは私にとても感謝しました! – JoeB
誰かを助けてくれてうれしいですね:-) –