I find that there are some element templates, data templates, and a binding in the .xaml file for the list. Is there any way to create it in code?
Is there a way to create data templates programmatically?
this is a XAML CODE, BUT I need code using C #, but not in XAML, because I work in creating a dynamic list with the addition of itemtemplatem, datatemplate
<ListBox Height="520" HorizontalAlignment="Left" Margin="0,6,0,0" Name="lstimge" VerticalAlignment="Top" Width="450" > <ListBox.ItemTemplate> <DataTemplate> <StackPanel Orientation="Horizontal"> <Image Source="{Binding Image}" Width="150" Stretch="Uniform" HorizontalAlignment="Center" /> <TextBlock Text="{Binding FileName}" TextWrapping="Wrap" /> </StackPanel> </DataTemplate> </ListBox.ItemTemplate> </ListBox>
Please give a decision
Thanks Ashok
source share