我正在开发 WPF 应用程序。
我只想在我从组合框中选择项目时显示我的树视图。
这是我的组合框选择属性
public string SelectedTransactionName
{
set
{
if (_selectedTransactionWsName == value) return;
this._selectedTransactionWsName = value;
// InitializaMessageElement(value.WsMethodName, transactionTypes);
InitializaMessageElement();
this.NotifyPropertyChanged(()=>IsTransactionNameSelected.ToString());
}
get
{
return this._selectedTransactionWsName;
}
}
检查是否选择了跨名称。
public bool IsTransactionNameSelected
{
get
{
return !string.IsNullOrEmpty(_selectedTransactionWsName);
}
}
XAML
<TreeView Margin="464,137,10,413" Grid.RowSpan="2" ItemsSource="{Binding MessageElements, Mode=TwoWay}"
SelectedItemChanged="TreeView_OnSelectedItemChanged" Visibility=" {Binding IsTransactionNameSelected,Converter={StaticResource BooleanToVisibilityConverter}}"
SelectedValuePath="Id"
在 this.NotifyPropertyChanged(()=>IsTransactionNameSelected.ToString()); 我收到错误(无法将 lambda 表达式转换为类型“字符串”,因为它不是委托类型),我的 NotifyPropertyChanged 需要一个字符串