views:

1048

answers:

1

Hi,

I am designing a listbox and I want to have design time data in it.

If have a class in my namespace, how do I instantiate and object of that class in the Resources of the user control XAML please?

Malcolm

+2  A: 
<UserControl.Resources>
    <my:CustomObject xmlns:my="clr-namespace:MyNamespace" 
                     x:Key="MyCustomObj"
                     Property="Value"
    />
</UserControl.Resources>
jachymko
What is the point of xmlns:my="clr-namespace:MyNamespace" ? Do you need this if the "my" namespace is defined in the top-level <UserControl> element?
Patrick Szalapski
So why, when I do this, do I get an error that the designer cannot find the MyCustomObj class? It should be able to. (I am debugging the designer as described at http://msdn.microsoft.com/en-us/library/bb514636.aspx )
Patrick Szalapski