MVVM: manage many, many relationships with the tree in (Silverlight)

Sorry to ask a broad question, but I am having problems with how to approach this problem.

I have a lot of relationships:

Product 1 --- * ProductCategory * --- Category

The category also has:

Category 0..1 --- * Category (As SubCategories)

What I want to see is a tree view with all categories and be able to check the box to create a ProductCategory object. I do not understand how to do this with MVVM.

enter image description here

In ASP.NET, when rendering a tree view, I would look to see if there was a CategoryId object from the node that I was rendering in my “ProductCategory” list, if that were the case, I would check the box and thus the initial state.

( ), , / , / .

, MVVM, , , - , , ! , , (Root) , HierarchicalDataTemplate:

                <sdk:TreeView Margin="0,3,30,3" ItemsSource="{Binding Categories}" Height="300">
                    <sdk:TreeView.ItemTemplate>
                        <sdk:HierarchicalDataTemplate ItemsSource="{Binding SubCategories}">
                            <StackPanel Orientation="Horizontal">
                                <CheckBox></CheckBox>
                                <TextBlock Text="{Binding Name}" HorizontalAlignment="Left"></TextBlock>
                            </StackPanel>
                        </sdk:HierarchicalDataTemplate>
                        <!---->
                    </sdk:TreeView.ItemTemplate>

, -, , ...

, MVVM ""?

.

+3
1

, IsChecked viewmodel, . true, viewmodel , . , , .

mvvm , , , entit

0

All Articles