绑定选定的TreeNode MVVM

时间:2014-12-27 19:40:09

标签: c# wpf mvvm

整晚都在绞尽脑汁 - 我无法弄清楚如何绑定一个选定的段TreeView变量Mvvm

<TreeView ItemsSource="{Binding Subunits}">
                <!-- Шаблон подразделения -->
                <TreeView.ItemTemplate>
                    <HierarchicalDataTemplate ItemsSource="{Binding Positions}">
                        <TextBlock Text="{Binding SubunitName}"/>
                        <!-- Шаблон должности -->
                        <HierarchicalDataTemplate.ItemTemplate>
                            <HierarchicalDataTemplate ItemsSource="{Binding Employees}" DataType="{x:Type local:Employee}">
                                <TextBlock Text="{Binding PositionName}"/>
                                <!-- Шаблон сотрудника -->
                                <HierarchicalDataTemplate.ItemTemplate>
                                    <DataTemplate>
                                        <StackPanel Orientation="Horizontal">                                                
                                            <TextBlock Text="{Binding FirstName}" Margin="0,0,5,0" MouseDown="qwe"/>
                                            <TextBlock Text="{Binding FirstName}" Margin="0,0,5,0"/>
                                            <TextBlock Text="{Binding Patronymic}" Margin="0,0,5,0"/>
                                        </StackPanel>
                                    </DataTemplate>
                                </HierarchicalDataTemplate.ItemTemplate>

                            </HierarchicalDataTemplate>
                        </HierarchicalDataTemplate.ItemTemplate>
                    </HierarchicalDataTemplate>
                </TreeView.ItemTemplate>
            </TreeView>

我该怎么办? 对不起我的英文:(

0 个答案:

没有答案