This project has moved. For the latest updates, please go here.

Problem with ListBox inside a dataform using view model

Feb 3, 2011 at 4:43 AM

Hi Jeremy,

First of all, i would like to comment on the framework you created "Simply great!".

I am using the Jounce framework and trying few samples.

I have a problem with populating a listbox inside a dataform (EditTemplate/DataTemmplate) when binding the dataform itemssource to the viewmodel instance in xaml.

<UserControl.Resources><my:VM x:Key="LocalVM"</UserContro.Resources>

...

<dataform.DataField>

        <ListBox ItemsSource="{Binding MyList, Mode=TwoWay}" ...../>

<dataform:DataField>

It didn't work. I tried to place the listbox outside the dataform and worked :-)

Other work around i figured out when the list box was inside the dataform was to add "Source={StaticResource LocalVM}" in the ListBox binding and it worked.

I am planning to use MEF to bind view model to the view. So, i can't add above piece of code "Source={StaticResource LocalVM}" since i will be using MEF to wire up some where else (i meant ViewModelRoute) but not in the xaml.

Also, tried to create a sample application with MEF wire up and the listbox didn't populate but i was able to get the data in other input controls like textbox, datepicker etc..

Please help to me understand whether it is a bug or incorrect implementation.

Please help me to resolve the issue.

Thanks,

Raj