Skip to main content
Home Forums Silverlight Programming Programming with .NET - General How can I bind listbox.itemtemplate by behind code?
1 replies. Latest Post by jay nanavati on June 27, 2009.
(0)
jv9
Member
96 points
97 Posts
06-26-2009 5:35 PM |
I try to bind listbox.itemtemplate without xmal code. How can I do that? Thanks.
jay nana...
Contributor
3388 points
624 Posts
06-27-2009 9:44 AM |
This is the thing that you want to develop?
DataTemplate d1 = new DataTemplate(); string xamlCode = "<DataTemplate x:Name='dt' xmlns='http://schemas.microsoft.com/client/2007' xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml' xmlns:basics='clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls' >" + "'150' Height='32' Margin='5' Text='it works...' HorizontalAlignment='Left' />" + ""; d1 = (DataTemplate)XamlReader.Load(xamlCode); myList.ItemTemplate = d1; //for test purpose myList.ItemsSource = "j a y".Split();