Hi, I have a Person class. A Person can have an associated control. Can I display the control through data binding?
e.g: Name: Bill , Control: TextBox Name: Bob, Control: ComboBox Name: Dan, Control: CheckBox
I have the following xaml in my resource dictionary
<DataTemplate x:Key="PersonTemplate">
<DockPanel >
<TextBlock FontWeight="Bold" Text="Name: " DockPanel.Dock="Left" Margin="5,0,10,0"/>
<TextBlock Text="{Binding FirstName}" Foreground="Green" FontWeight="Bold" />
</DockPanel>
</DataTemplate>
I would like to add the associated user control to the dockpanel, Can this be done
Something like??
<DataTemplate x:Key="PersonTemplate">
<DockPanel >
<TextBlock FontWeight="Bold" Text="Name: " DockPanel.Dock="Left" Margin="5,0,10,0"/>
<TextBlock Text="{Binding FirstName}" Foreground="Green" FontWeight="Bold" />
<Control Type = "{Binding Control}"/>
</DockPanel>
</DataTemplate>
Thanks Dan