Domanda

Can anyone tell me how I should set the right property in CollectionViewSource in XAML on Windows 8?

<CollectionViewSource x:Name="itemsViewSource"     
        Source="{Binding Items}"
        d:Source="{Binding AllTasks, Source={d:DesignInstance Type=data:TaskItems,  IsDesignTimeCreatable=True}}"/>

x:name is the Name of the object. What's source? What's the difference between d:Source and Source? Can anyone explain it to me?

È stato utile?

Soluzione

MSDN Documentation for this is pretty good.

As the documentation suggests Source is the collection object your pointing to. Example ObservableCollection<T>

The first link also shows a usage example. Basically in plain English CollectionViewSource is used to filter/group/sort data in a list/collection and then use the result in a view

As for your doubt about d: I cannot be sure without seeing your xmlns declaration in your top level element, but assuming defaults d: corresponds to design time data/attributes

Design time attributes

It's used to help design and visualise your UI in design time when live data may not be available.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top