wpf - Binding a CollectionViewSource within a DataTemplate -
'Content' template 'is a datatappletlet that displays the object in which a member is a' follicelli clip '.
& lt; Datamapplet X: Key = "ContentTemplate" & gt; & Lt; ListBox ItemsSource = "{Bound Path = FOO}" & gt; ... & lt; / ListBox & gt; & Lt; / DataTemplate & gt;
I should be able to filter the FooList using the ViewSource. This is usually straight forward but I do not feel compelled to work within the datatyple. Tried:
& gt; Datamapplet X: Key = "ContentTemplate" & gt; & Lt; DataTemplate.Resources & gt; & Lt; CollectionViewSource x: key = "CVS" source = "{binding path = FooList}" filter = "FooFilter" /> & Lt; DataTemplate.Resources & gt; & Lt; List box itemsource = "{binding source = {static resource CVS}}" & gt;
I have a reason for the errors associated with this:
System.Windows.Data Error: 2: Framework Element or Framework Content Element for the Target Element Can not operate BindingExpression: Path = FooList; DataItem = Null; Target element 'collections resources' (hashcode = 52991666); Target property 'source' (type 'object')
Which I think is looking for 'FooList' on the collection ViewSource instead of the bound object for the DataTemplate.
So ... how can I get this to see the right thing?
As I understand it, what datatymeet acts as a directive to view trees , But a part of the visible tree itself is not formed. I came only in the concept that you did after running in the same problem described above. I will be part of the visual tree by enclosing this collection in an element's resources with viewSource, in my case a grid is a working sample here:
& gt; DataTimeplate DataType = "{x: Type Type: AssetModelListViewModel}" & gt; & Lt; Grid & gt; & Lt; Grid.Resources & gt; & Lt; Collection chronology x: key = "item" source = "{binding}" & gt; & Lt; CollectionViewSource.SortDescriptions & gt; & Lt; Scm: SortDescription Property Name = "AssetType.assetcenet.netname" /> & Lt; Scm: SortDescription Property Name = "AssetType .name" /> & Lt; Scm: SortDescription PropertiesName = "Manufacturer .Names" / & gt; & Lt; /CollectionViewSource.SortDescriptions> & Lt; / CollectionViewSource & gt; & Lt; /Grid.Resources> & Lt; ListView ItemsSource = "{Binding Source = {Static Resources Item}}" & gt; & Lt; / ListView & gt; & Lt; / Grid & gt; & Lt; / DataTemplate & gt;
Comments
Post a Comment