Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

cannot set name attribute value when using a container control

$
0
0
Hi,

I created a usercontrol with a Grid.
<UserControl x:Class="TestUserControl"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Width="300" Height="300"><Grid Name="MainGrid" Background="Red" ></Grid></UserControl>
Next I created another Project and referenced the dll where this usercontrol is in.
<UserControl x:Class="TestContainer"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:nds="http://schemas.test.eu/BaseElements" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Width="300" Height="300"><Grid><nds:TestUserControl><Button Name="Btn1"></Button></nds:TestUserControl></Grid></UserControl>


With the schema i can load a instance of this usercontrol onto the new usercontrol
Next I load a button onto this

When I now set the name property, the error
"Warning 1 Cannot set Name attribute value 'Btn1' on element 'Button'. 'Button' is under the scope of element 'TestUserControl', which already had a name registered when it was defined in another scope. Line 7 Position 21. .......\NdsPropSections\TestContainer.xaml 7 21 NdsPropSections"

I read something about namescopes but that were old items from jan 2008, I would like to know if there is a simple solution so that i can use the xaml designer to create by base controls and my container controls.....

Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>