How to set WP7 ItemsPanel in code behind?
I have a ListBox created in code behind and 开发者_开发百科I need to set the ItemsPanelTemplate to WrapPanel programmatically. Which is the best way to do this?
There's no way to do this in pure code. THe VisualTree property isn't accessible.
(The way you would do this in WPF is to use the FrameworkElementFactory
but this is not available in Silverlight.)
The only way to do this appears to be through creating the XAML as a string and then using XamlReader.Load.
精彩评论