Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/336.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# WPF属性已更改,但未使用绑定集合_C#_Wpf_Binding_Reference - Fatal编程技术网

C# WPF属性已更改,但未使用绑定集合

C# WPF属性已更改,但未使用绑定集合,c#,wpf,binding,reference,C#,Wpf,Binding,Reference,我在WPF中有一棵树和一个分层数据结构,如下所示: <TreeView x:Name="MainTreeview" HorizontalAlignment="Left" Height="400" VerticalAlignment="Top" MinWidth="100" MaxWidth="500" Width="auto" ItemsSource="{Binding NodeVmList}"> <TreeView.ItemTemplate&g

我在WPF中有一棵树和一个分层数据结构,如下所示:

  <TreeView x:Name="MainTreeview"  HorizontalAlignment="Left" Height="400"  VerticalAlignment="Top" MinWidth="100" MaxWidth="500" Width="auto" ItemsSource="{Binding NodeVmList}">
            <TreeView.ItemTemplate>
                <HierarchicalDataTemplate DataType="{x:Type local:NodeViewModel}" ItemsSource="{Binding Children, Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" >
.....

.....

因此,如果我从树的第一级更新
nodevewmodel
,更改将反映在UI中,例如
isexpanded
属性。但是,如果我更新一个节点,但不使用Children属性并使用对
nodevewmodel
对象的直接引用,那么这些更改不会反映在UI上。

[问题是,我在对象中有相同的信息,但对象不同。

如何更改它/我有另一个集合存储对此对象的引用。setter中的每个nodevewmodel属性调用NotifyPropertyChanged@florinflo你试过了吗。。{Binding Path=Children,…?有时绑定可能会对其中的Path关键字很挑剔。