My personal work experience
Ritesh,thanks for a working sample. if i have to create a few of these controls, a few times in a stackpanel, do i have to copy and paste them multiple times and change control names or is there a better way.i need to do it in code behind - not in XAML.thanks once again for your help.
Hi Ravichandran,you can bind all these controls in codebehind also. all the controls you are creating in in XAML, you can create using C#.cs or VB.cs code, see below code you can loop throughmultiple time as you want.Image img = new Image();img.Source = new BitmapImage(new Uri("some.png"));StackPanel stackPnl = new StackPanel();stackPnl.Orientation = Orientation.Horizontal;stackPnl.Margin = new Thickness(10);stackPnl.Children.Add(img);Button btn = new Button();btn.Content = stackPnl;
seems like can not used in silverlight5. Besides, I don't know how to read a list and initialize it. would you mind tell me that? Thanks!
Post a Comment