c# - CollectionViewSource Use Question -


I should have been trying to basically use CollectionViewSource be me missing something because it just does not work here My XML is:

  & lt; window. Resources & gt; & Lt; Collection chapters source = "{binding space: main voltage difference map}" x: key = "mpcv" & gt; & Lt; CollectionViewSource.GroupDescriptions & gt; & Lt; PropertyGroupDescription Property Name = "SourceProject" /> & Lt; /CollectionViewSource.GroupDescriptions> & Lt; / CollectionViewSource & gt; & Lt; /Window.Resources>  

; ListBox ItemsSource = "{StaticResource MapCV}" HorizontalContentAlignment = "muscle" ScrollViewer.HorizontalScrollBarVisibility = "disabled" & gt; & Lt; ListBox.ItemTemplate & gt; & Lt; DataTemplate & gt; & Lt; Grid horizontal alignment = "statch" & gt; & Lt; Grid.ColumnDefinitions & gt; & Lt; Column width = "2 *" /> & Lt; Column width = "2 *" /> & Lt; Column width = "50" /> & Lt; /Grid.ColumnDefinitions> & Lt; TextBlock Grid.Column = "0" text = / & gt; {{SourceType, Converter = {StaticResource WorkItemTypeToStringConverter} Binding} "; & Lt; ComboBox Grid.Column = "1" SelectedItem = "{Binding DestType}" ItemsSource = "{WorkItemTypesForCurrentDestProject binding, Source = {x: Static loc: MainMediator.Instance}, diagnosis: PresentationTraceSources.TraceLevel = High} name" DisplayMemberPath = "" /> & Lt; Button grid Column = "2" content = "{bound per cent}" /> & Lt; / Grid & gt; & Lt; / DataTemplate & gt; & Lt; /ListBox.ItemTemplate> & Lt; / ListBox & gt;  

It compiles properly, but when I run the application I get this error:

 The value for the type of object can not convert the value to 'ItemsSource' .Collections .IEnumerable '. 'System.Windows.Data.CollectionViewSource' property is not a valid value for the 'ItemsSource' error object markup file 'WIAssistant on' System.Windows.Controls.ListBox '; Component / main.xaml 

This collection I'm attached to it:

  / / mapping is used to copy the values ​​of other fields of Vrkitm Is the public observable collection & lt; Work type type mapping & gt; WorkItemTypeMappings {{get back (ObservableCollection & LT; WorkItemTypeMapping & gt;) getValue (WorkItemTypeMappingsProperty); } Set {set value (worktime type mappings property, value); }} Public static Read Only DependencyProperty WorkItemTypeMappingsProperty = DependencyProperty.Register ("WorkItemTypeMappings", typeof (ObservableCollection & LT; WorkItemTypeMapping & gt;), typeof (MainMediator), New UIPropertyMetadata (Zero));  

I want to do simple grouping on the object Project SourceProject I will not have to break the tree view for this.

This should work for you

<> pre & lt; ListBox ItemsSource = "{Binding Source = {StaticResource MapCV}}" ...

Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -