Click here to Skip to main content
15,879,535 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
So I've a WPF project which is an IDE with one "label"* per document, I parse the code (input) written on each "label" to detect vars, arrays, functions, etc. and this is done by the View.

Now here's my problem, I got a collection (Of ViewModel) that store every single label and it's data (to be accessed or modify other views of the app), should I bind the View's DataContext (that parse the code) to the correct Item in the Collection, or should I set it's DataContext to a new ViewModel?

*The label is actually a custom view model placed in an AvalonDock control:
HTML
<D:DockingManager x:Name="DockManager" Grid.Row="2">
    <D:DockingManager.LayoutItemContainerStyle>
        <Style TargetType="{x:Type D:LayoutItem}">
            <Setter Property="Title" Value="{Binding Model.Name}"/>
        </Style>
    </D:DockingManager.LayoutItemContainerStyle>

    <D:DockingManager.LayoutItemTemplateSelector>
        <SM:PaneTemplateSelector>
            <SM:PaneTemplateSelector.DocumentTemplate>
                <DataTemplate>
                    <ContentControl>
                        <SM:DocumentView/>
                    </ContentControl>
                </DataTemplate>
            </SM:PaneTemplateSelector.DocumentTemplate>
        </SM:PaneTemplateSelector>
    </D:DockingManager.LayoutItemTemplateSelector>
</D:DockingManager>
Posted
Comments
Andreas Gieriet 10-Mar-13 10:14am    
Search for WPF and MVVM instead of VMMV.
Cheers
Andi

1 solution

 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900