1
Vote

CslaContrib 4.5.30 CollectionViewSource XAML binding to Model/ViewModel .Net4.0

description

Still getting up to speed with CSLA. Running Visual Studio 2010 targetting Net4.0

Have copied ProjectTracker code as an example of best practice. Using Encapsulated Invoke (Dto).

Now have run into an issue with databinding between XAML and Model/ViewModel.

Have BO DepartmentList and BO DepartmentInfo along the lines of ProjectList and ProjectInfo (from ProjectTracker) and ViewModels along the lines of Project Tracker as well.

I understand that ProjectTracker no longer works but it has pointed me in the right direction so far.

The database retrieves the list of Departments okay and populates the ItemList in
DepartmentListViewModel with the correct data.

Have tried:
    <CollectionViewSource x:Key="departmentListViewSource" d:DesignSource="{d:DesignInstance my:DepartmentListViewModel, CreateList=True}" />
    <CollectionViewSource x:Key="departmentListModelViewSource" Source="{Binding Path=Model, Source={StaticResource departmentListViewSource}}" />
    <CollectionViewSource x:Key="departmentListItemListViewSource" Source="{Binding Path=ItemList, Source={StaticResource departmentListViewSource}}"/>


    <ListBox Grid.Row="1" Grid.RowSpan="7" ItemsSource="{Binding Source={StaticResource departmentListItemListViewSource}}" Name="modelListBox">
        <ListBox.ItemTemplate>
            <DataTemplate>
                <StackPanel Orientation="Horizontal">
                    <TextBlock Text="{Binding Path=Model.DepartmentName}" Width="75"/>
                </StackPanel>
            </DataTemplate>
        </ListBox.ItemTemplate>
     </ListBox>

Any pointers?

I've found ActionExtenderSample.WebGUI to be unhelpful probably because I'm running VS2010 and also it is aimed at the Web.

thanks
Colin Strong, London.

comments