wpf - ItemsControl of UserControls with ViewModels -
I would like to make a very simple thing (I think) with XAML. Show a list of
I want a "UserControl B user controllers' UserControl A 'to host a ItemControl in (' ViewModels' with ViewModel A ').
There is a property in 'ViewModel B' which is a 'UserControls A'.
'in Ctor the UserControls A', I set:
Me.DataContext = New ViewModelA ()
'Ugent>, I set it up, but with 'View MODEL B'.
Two points (integer) 'Row' and 'Colonel' in 'View Model A'.
What I want to do is to force the values of 'userControl A' and 'kernel' and 'line' in the hosted grid in 'UserControl B'.
> Here's what I did: UserControl B:
& lt; Items Controlled Items Source = "{Binding ListOffice Control_A}" margin = "1.5" & gt; & Lt; ItemsPanelTemplate & gt; & Lt; Grid & gt; & Lt; Grid.RowDefinitions & gt; & Lt; Roadfinition /> & Lt; Roadfinition /> & Lt; /Grid.RowDefinitions> & Lt; Grid.ColumnDefinitions & gt; & Lt; Columns Definition / & gt; & Lt; Columns Definition / & gt; & Lt; Columns Definition / & gt; & Lt; Columns Definition / & gt; & Lt; Columns Definition / & gt; & Lt; Columns Definition / & gt; & Lt; Columns Definition / & gt; & Lt; Columns Definition / & gt; & Lt; Columns Definition / & gt; & Lt; Columns Definition / & gt; & Lt; /Grid.ColumnDefinitions> & Lt; / Grid & gt; & Lt; / ItemsPanelTemplate & gt; & Lt; ItemsControl.ItemContainerStyle & gt; & Lt; Style & gt; & Lt; Setter property = "grid.column" value = "{binding kernel}" /> & Lt; Setter Property = "Grid. Roll" Value = "{Binding Row}" /> & Lt; / Style & gt; & Lt; /ItemsControl.ItemContainerStyle> & Lt; ItemsControl.ItemTemplate & gt; & Lt; DataTemplate & gt; & Lt; Local: UserControl_A / & gt; & Lt; / DataTemplate & gt; & Lt; /ItemsControl.ItemTemplate> & Lt; / ItemsControl>
The collection is filled properly with this process.
But I error at runtime (translated in French): "collection" should be free to use the item processing ''.
Another error which I first The item theme and item template selector for 'UserControl_B are not valid ... ...
What am I doing wrong?
"post-text" itemprop = "text"> < p> you
ItemsPanelTemplate
ItemsControl.ItemsPanel forgot to wrap code> tag before control as an item without the item treats
itemsPanelTemplate
and since you already haveItemsSource
is set to receive the error& lt; Aitmonkantrol items source = "{binding Suchiofusr Kantrol_a}" margin = "1.5" & gt; & LT; ItemsControl.ItemsPanel & gt; & LT; ItemsPanelTemplate & gt; & Lt; / ItemsPanelTemplate & gt; & LT; /ItemsControl.ItemsPanel> ; & Lt; / ItemsControl & gt;
Comments
Post a Comment