Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WPF: Cannot see my custom control in the toolbox

Tags:

c#

.net

vb.net

wpf

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

like image 800
Bob Avatar asked Dec 10 '25 08:12

Bob


1 Answers

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.

like image 97
Abe Heidebrecht Avatar answered Dec 11 '25 22:12

Abe Heidebrecht



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!