I have created 2 WPF control which reside in the same folder and i want to add one control to the other.
The controls are 开发者_开发问答added in a Win Forms project.
the thing is that in a custom Win Forms control I can see my two WPF controls in the toolbox but in the WPF designer I cannot see any WPF controls. Any ideas why?
And how can I add my control is XAML without dragging from the toolbox
I tried with
<UserControl x:
xmlns:my2="my.name.space"
Height="300" Width="300">
<Grid>
<my2:MyControlName>
</my2:MyControlName>
</Grid>
But that doesn't work with the type "my2:MyControlName" doesn not exist
I'm not sure why the controls don't show up in the toolbox, as I generally don't use the designer, but in order to access your controls in XAML, the xmlns should be:
<UserControl xmlns:my2="clr-namespace:my.name.space;assembly=my.assembly"
If the controls are in the assembly that is creating the UserControl
, you should drop the ";assembly=my.assembly" part.
Thanks Abe.. I also needed to go to "Choose Item" in the toolbox, go to browse in the WPF components section, browse to the dll add the controls and drop them onto the designer, not onto the XAML view
精彩评论