WPF Error:cannot set name attribute value '{control}'
Source:Open Clip Art Using Under Public Domain Attribution
I found the wpf user control cannot have any child has a name attribute, such as:
<advgenControls:CollapsibleControl> <TreeView x:Name="treeView" Style="{StaticResource MainLeftPanel}" /></advgenControls:CollapsibleControl>
It will have the error like this:
Cannot set Name attribute value 'treeView' on element 'TreeView'. 'TreeView' is under the scope of element 'CollapsibleControl', which already had a name registered when it was defined in another scope. Line 93 Position 5. (MC3093) - D:\Projects\AdvGenContact\AdvGenContact\AdvGenContact.WPF\MainWindow.xaml:93,5
I did a research on internet, I even tried some suggestions in internet, it doesn't work at all. I found that is no way to do that. I believe that is because User Control is not for that purpose. The user control is to hold some repeatable content across the applications. For example, I got a status bar which it need to place all every window in my application. Then I should create a user control for my own status bar and place into every window. In my case mentioned above, I wish to build a collapsible panel which has a different content in each window, even I will reuse that in other project. User Control is not my best. I should find an existing control to override. In this case, I should use HeaderItemsControl.
Note that: when I finish this control, I will put on my open source probject, AdvGen Contact Manager.
Trackback address for this post
Trackback URL (right click and copy shortcut/link location)
Feedback awaiting moderation
This post has 4240 feedbacks awaiting moderation...
Form is loading...