How to link StackPanel with my ViewModel?
In my opinion, I have the following:
<TextBlock Text="{Binding Title}"/>
which is attached to the TitleModel Title property and , it simply and well works :
private string _title;
public string Title
{
get
{
return _title;
}
set
{
_title = value;
OnPropertyChanged("Title");
}
}
However, my ViewModel also has a “FormFields” property , which is a StackPanel that contains a number of other UserControls:
private StackPanel _formFields;
public StackPanel FormFields
{
get
{
return _formFields;
}
set
{
_formFields = value;
OnPropertyChanged("FormFields");
}
}
How to connect it with my idea?
ASP.NET had a PlaceHolder element , I'm looking for something with the same functionality, for example.
PSEUDO CODE:
<PlaceHolder Content="{Binding FormFields}"/>
-, . , , (). , ObservableCollection<FormField>. :
<ItemsControl ItemsSource="{Binding FormFields}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel/>
<ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
</ItemsControl>
, ContentPresenter StackPanel :
<ContentPresenter Content="{Binding FormFields}"/>