wpf - TreeViewItem with Databinding, Childs doesn't update -
I've found a previewview with a historical template. Everything works well, will answer as expected all objets, but adding the element to the collection does not update the tree view.
My base object is added to the previewview. It has a collection of assets and this collection has got a property with its collection.
BaseBeckt - & gt; Sub collection 1 - & gt; Sub-compilation 2 My base object has changed the inautifprotype and my subcolation 2 has modified the iSCLoption.
However, Ihen is asked to add a new item SubCollection 2 to OnCollectionChaged, but if CollectionChanged remains zero, nothing happens.
TreeView Template:
& lt; HierarchicalDataTemplate x: Key = "SheetTreeTemplate" & gt; & Lt; StackPanel Orientation = "Horizontal" & gt; & Lt; Image width = "16" height = "16" margin = "3,0" source = "/ resource / symbol / page_green" /> & lt; TextBlock FontStyle = "Italic" & gt; & Lt; TextBlock.Text & gt; & Lt; Multibide string format = "{} seat {0}" & gt; & Lt; Binding path = "name" /> & Lt; / MultiBinding & gt; & Lt; /TextBlock.Text> & Lt; / TextBlock & gt; & Lt; / StackPanel & gt; & Lt; / HierarchicalDataTemplate & gt; & Lt; Hierarchical data template x: key = "DocumentTreeTemplate" items source = "{binding path = sheets. Value}" item template = "{static resource sheettree template}" & gt; & Lt; StackPanel Orientation = "Horizontal" & gt; & Lt; Image width = "16" height = "16" margin = "3,0" source = "/ resources / icons / folder.png" /> & Lt; TextBlock FontStyle = "Italic" & gt; & Lt; TextBlock.Text & gt; & Lt; Multibide string formatting = "{} {0} {1}" & gt; & Lt; Binding Path = "DocTypName" /> & Lt; Binding path = "id" /> & Lt; / MultiBinding & gt; & Lt; /TextBlock.Text> & Lt; / TextBlock & gt; & Lt; / StackPanel & gt; & Lt; / HierarchicalDataTemplate & gt; & Lt; Hierarchical DataTemplate X: Key = "PilotTemplate" items = source {"binding path = document.value}" item template = "{static resource document cuttimate}" & gt; & Lt; StackPanel Orientation = "Horizontal" & gt; & Lt; Image width = "16" height = "16" margin = "3,0" source = "/ resources / symbol / report page" /> & Lt; TextBlock FontStyle = "Italic" Text = "{Binding Path = Name}" /> & Lt; / StackPanel & gt; & Lt; / HierarchicalDataTemplate & gt; TreeView itself: & lt; TreeView style = "{DynamicResource NavigationTry}" name = "tvw_mainMenu" item source = "{binding value}" item-template = "{DynamicResource PileTreeTemplate}" selected item item = "TVV_man menued item item" /> The class should subscribe to sub-compilation 2 changed:
class sheet: dictionary & lt; String, sheet & gt; , INotifyCollectionChanged {add public hair (string s, sheet new sheet) {base.Add (sKey, newSheet); OnCollectionChanged (New NotifyCollectionChangedEventArgs (NotifyCollectionChangedAction.Add, New KeyValuePair & lt; String, Sheet & gt; (sKey, newSheet)); } Public Event NotifyCollectionChangedEventHandler Collection changed; Protected Virtual Zero OnCollectionChanged (NotifyCollectionChangedEventArgs E) {If Changed! (Changed! = Null) {Changed Collection (This, E); }}}}
I have found that there are too many interfaces to implement. The best approach is a noticeable collection because I do not want to change all of my classes because I've found an example.
Comments
Post a Comment