in Education by
I want to add a single model object that has been instantiated once in XAML, and add it to two different collections (in xaml). The following code renders fine in Blend's Design Time, but I get the following errors at run time: For "Post1" Object of type 'WpfBlog.Models.Tag' cannot be converted to type 'System.Collections.ObjectModel.ObservableCollection`1[WpfBlog.Models.Tag]'. Error at object 'WpfBlog.Admin' in markup file 'WpfBlog;component/Admin.xaml' Line XX Position YY. If I comment out "Post1", I'll get this error on "Post2" Cannot add element to property 'Tags', because the property can have only one child element if it uses an explicit collection tag. Error at object 'System.Windows.StaticResourceExtension' in markup file 'WpfBlog;component/Admin.xaml' Line AA Position BB. The following code compiles and runs fine, but two tags named "TDD" get created, so if I try to rename the tag, I have to do it for all of the posts, instead of just the one Tag object. Any ideas? I'd be able to ignore it and work around it if Blend didn't render it correctly, but it does! JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
I was able to avoid the problem by explicitly initializing a new collection within the Tags property. Something like this: Obviously, this is only possible if you allow your Tags property to be writable.

Related questions

0 votes
    I have a Theme attribute that I can load like this: AeroTheme is a class. How can I achieve the ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jul 20, 2022 in Education by JackTerrance
0 votes
    I'm totally new to Xamarin, so please be patient! Somehow Xamarin adds a mysterious Margin to all my ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jul 8, 2022 in Education by JackTerrance
0 votes
    Is there a way, for the FlipView control, to ONLY have it load the selected item?? The default ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 10, 2022 in Education by JackTerrance
0 votes
    Is there a way, for the FlipView control, to ONLY have it load the selected item?? The default ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 5, 2022 in Education by JackTerrance
0 votes
    I have a Theme attribute that I can load like this: AeroTheme is a class. How can I achieve the ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 5, 2022 in Education by JackTerrance
0 votes
    I have a ListBox that scrolls images horizontally. I have the following XAML I used blend to create it. ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 11, 2022 in Education by JackTerrance
0 votes
    If I have a UserControl: Foo.Bar.MyClass, I know I can reference it in XAML by declaring: xmlns: ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 2, 2022 in Education by JackTerrance
0 votes
    I am working on WPF application.I have bound my textblock to my button. I want to set foreground ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 19, 2022 in Education by JackTerrance
0 votes
    I am working on WPF application.I have bound my textblock to my button. I want to set foreground ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 18, 2022 in Education by JackTerrance
0 votes
    When defining the contents of a Grid, I first define all row and column definitions, then afterwards when ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 12, 2022 in Education by JackTerrance
0 votes
    I've got the following code in my MainPage.xaml.cs public partial class MainPage : UserControl { private ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jan 16, 2022 in Education by JackTerrance
0 votes
    ________ is a collection of data that is huge in volume, yet growing exponentially with time. A. Big Dataabase B. Big Data C. Big Datafile D. Big DBMS...
asked Dec 2, 2022 in Education by JackTerrance
0 votes
    Cassandra version 3.11.3 I have a record with some set and list collections. Using the sets with ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 21, 2022 in Education by JackTerrance
0 votes
    Right now my firebase cloud firestore looks like this: const db = fire.firestore(); db.collection(" ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 7, 2022 in Education by JackTerrance
...