this.lsitboxdemo.ItemsSource = demolsit;
this.lsitboxdemo.DisplayMemberPath = "Name";
Binding binding = new Binding("SelectedItem.Flag") { Source=this.lsitboxdemo};
this.txtbox.SetBinding(TextBox.TextProperty,binding);
<local:InflateConverter x:Key="ic"></local:InflateConverter>
</Window.Resources>nment="Left" Margin="10,189,0,37" VerticalAlignment="Stretch" Width="290"/>
<ContentControl Content="{Binding ElementName=lsitboxdemo, Path=SelectedItem.Flag,Converter={StaticResource ic }}" Name="Change_Page1" HorizontalAlig <Window.Resources>
public class InflateConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value != null)
{
Type t = Type.GetType(value.ToString());
return Activator.CreateInstance(t);
}
return null;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}