Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
851
Setting ItemTemplate in ViewModel throws an exception
posted

Hi,

I want to set the Itemtemplate of a xamtreeitem in the viewmodel, unfortunatly this throws following exception:

"System.Windows.Markup.XamlParseException occurred
  Message=Nicht deklariertes Präfix. [Line: 3 Position: 156]"

Normal 0 21 false false false DE X-NONE X-NONE MicrosoftInternetExplorer4

Below is an excerpt from the code. The logic for the method I've attached.

                    if (Application.Current.Resources["AttributingReadyToImageSourceConverter"] == null) { throw new Exception("XamlParseException - AttributingReadyToImageSourceConverter"); }

 

                    string dataTemplate = @"<DataTemplate xmlns=""http://schemas.microsoft.com/client/2007"">

                                             <StackPanel Orientation=""Horizontal"">

                                            <ig:XamTreeItem IsEnabled=""{Binding ArticleCodeModel.CodeModel.AttributingReady}"" Loaded=""XamTreeItem_Loaded"" />

                                            <Image Width=""15"" Height=""15"" Margin=""5,0,0,0"" HorizontalAlignment=""Right"" Loaded=""Image_Loaded"" Source=""{Binding ArticleCodeModel.CodeModel.AttributingReady, Converter={StaticResource AttributingReadyToImageSourceConverter}}"" />

                                            </StackPanel>    

                                            </DataTemplate>";

                    newItem.ItemTemplate = (DataTemplate)XamlReader.Load(dataTemplate);

 

Thank you very much!

Best regards, Djumana

 

Parents Reply Children
No Data