tags:

views:

19

answers:

1

Hi,

I have WPF usercontrol that is binded to some data, when I run the usercontrol it shows the data, but when I place the usercontrol on WPF window it shows blank with no data!

What is the correct way to add binded usercontrol to WPF window?

+3  A: 

You need to define an xlmns which refers to your application and namespace, something like

xmlns:vw="clr-namespace:MyApp.View"

then you can reference your UserControl with

<vw:MyControl DataContext="{Binding MyData}" />

It sounds as if you might be doing it all apart from the binding - run your app and look in the Ouput window to see if there are binding errors.

amaca
+1 amaca - Also remember to use ObservableCollection<MyData> if required.
ChrisBD