Search Results

Search found 1 results on 1 pages for 'user333397'.

Page 1/1 | 1 

  • Unhandled exception when DataTemplate created dynamically using Silverlight 3.0

    - by user333397
    Requirement is to create a reusable multi-select combobox custom control. To accomplish this, I am creating the DataTemplate dynamically through code and set the combobox ItemTemplate. I am able to load the datatemplate dynamically and set the ItemTemplate, but getting unhandled exception (code: 7054) when we select the combobox. Here is the code Class MultiSelCombBox: ComboBox { public override void OnApplyTemplate() { base.OnApplyTemplate(); CreateTemplate(); } void CreateTemplate() { DataTemplate dt = null; if (CreateItemTemplate) { if (string.IsNullOrEmpty(CheckBoxBind)) { dt = XamlReader.Load(@"<DataTemplate xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation' xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml' x:Name=""DropDownTemplate""><Grid xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation' xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml' x:Name=""CheckboxGrid""><TextBox xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation' xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml' x:Name=""test"" xml:space=""preserve"" Text='{Binding " + TextContent + "}'/></Grid></DataTemplate>") as DataTemplate; this.ItemTemplate = dt; } } } //Other code goes here }} what am i doing wrong? suggestion?

    Read the article

1