blackmagic01021 -2 Light Poster

I have a problem with shared sized view on a tree. I have three levels on the tree.
My shared sized mode works on the last lavel where the lowest level of the tree corospond to the end of second level. my problem is I can not make the same thing happen for the second level which should corrospond to the first level. I have three grids and each grid contain children corrospond to the parent on the previous grid.

And here is my code

    <Grid Name="mainGrid">
            <TreeView Name="driverTree" Grid.IsSharedSizeScope="True">
                <TreeView.Resources>
                    <HierarchicalDataTemplate DataType="{x:Type dw:DeviceDriverViewModel}" ItemsSource="{Binding Children}">
                        <Border BorderBrush="White" BorderThickness="1" Loaded="TreeViewItem_Loaded">
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto" SharedSizeGroup="columnGroup1" />
                                </Grid.ColumnDefinitions>

                                <StackPanel Orientation="Horizontal"  >
                                    <TextBlock Text="{Binding Name}" Grid.Column="0"/>
                                    <TextBlock FontWeight="Bold" Grid.Column="0">  driverversion.version</TextBlock>
                                    <TextBlock   Text="{Binding Version}" Grid.Column="0"/>
                                </StackPanel>
                            </Grid>
                        </Border>
                    </HierarchicalDataTemplate>

                    <HierarchicalDataTemplate DataType="{x:Type dw:FirmwareGroupViewModel}" ItemsSource="{Binding Children}">
                        <Border BorderBrush="White" BorderThickness="1" Loaded="TreeViewItem_Loaded">
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto" SharedSizeGroup="columnGroup2" />
                                    <ColumnDefinition Width="Auto" SharedSizeGroup="columnGroup1"/>
                                    <ColumnDefinition Width="Auto" SharedSizeGroup="columnGroup2" />
                                </Grid.ColumnDefinitions>

                                <StackPanel Orientation="Horizontal"  Grid.Row="1" Grid.Column="1" >
                                    <TextBlock FontWeight="Bold"  >  driverversion.firmwaredescription</TextBlock>
                                    <TextBlock Text="{Binding DetailedDescription}"  />
                                    <TextBlock FontWeight="Bold" > driverversion.firmwarebustype</TextBlock>
                                    <TextBlock Text="{Binding MyBusTypes}"    />
                            </StackPanel>
                            </Grid>
                        </Border>
                    </HierarchicalDataTemplate>

                    <HierarchicalDataTemplate DataType="{x:Type dw:FirmwareVersionViewModel}" ItemsSource="{Binding Children}">

                        <Border BorderBrush="White" BorderThickness="1" Loaded="TreeViewItem_Loaded">
                            <Grid>

                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto" SharedSizeGroup="columnGroup" />
                                    <ColumnDefinition />
                                    <ColumnDefinition Width="Auto" SharedSizeGroup="columnGroup" />
                                </Grid.ColumnDefinitions>

                                 <StackPanel Orientation="Vertical" Grid.Row="2" Grid.Column="2">
                                    <StackPanel Orientation="Horizontal" Grid.Row="2" Grid.Column="2">
                                        <TextBlock  FontWeight="Bold"> driverversion.identificationnumber</TextBlock>
                                        <TextBlock Text="{Binding VersionDescription}" />
                                    </StackPanel>
                                    <StackPanel Orientation="Horizontal" Grid.Row="2" Grid.Column="2">
                                        <TextBlock FontWeight="Bold"> driverversion.maximumversion</TextBlock>
                                        <TextBlock Text="{Binding MaximumVersion}"/>
                                    </StackPanel>
                                    <StackPanel Orientation="Horizontal" Grid.Row="2" Grid.Column="2">
                                        <TextBlock FontWeight="Bold"> driverversion.minimumversion</TextBlock>
                                        <TextBlock Text="{Binding MinimumVersion}"/>
                                    </StackPanel>
                                </StackPanel>
                            </Grid>
                        </Border>
                    </HierarchicalDataTemplate>
                </TreeView.Resources>
            </TreeView>
        </Grid>


<Grid Name="mainGrid">
        <TreeView Name="driverTree" Grid.IsSharedSizeScope="True">
            <TreeView.Resources>
                <HierarchicalDataTemplate DataType="{x:Type dw:DeviceDriverViewModel}" ItemsSource="{Binding Children}">
                    <Border BorderBrush="White" BorderThickness="1" Loaded="TreeViewItem_Loaded">
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto" SharedSizeGroup="columnGroup1" />
                            </Grid.ColumnDefinitions>

                            <StackPanel Orientation="Horizontal"  >
                                <TextBlock Text="{Binding Name}" Grid.Column="0"/>
                                <TextBlock FontWeight="Bold" Grid.Column="0">  driverversion.version</TextBlock>
                                <TextBlock   Text="{Binding Version}" Grid.Column="0"/>
                            </StackPanel>
                        </Grid>
                    </Border>
                </HierarchicalDataTemplate>

                <HierarchicalDataTemplate DataType="{x:Type dw:FirmwareGroupViewModel}" ItemsSource="{Binding Children}">
                    <Border BorderBrush="White" BorderThickness="1" Loaded="TreeViewItem_Loaded">
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto" SharedSizeGroup="columnGroup2" />
                                <ColumnDefinition Width="Auto" SharedSizeGroup="columnGroup1"/>
                                <ColumnDefinition Width="Auto" SharedSizeGroup="columnGroup2" />
                            </Grid.ColumnDefinitions>

                            <StackPanel Orientation="Horizontal"  Grid.Row="1" Grid.Column="1" >
                                <TextBlock FontWeight="Bold"  >  driverversion.firmwaredescription</TextBlock>
                                <TextBlock Text="{Binding DetailedDescription}"  />
                                <TextBlock FontWeight="Bold" > driverversion.firmwarebustype</TextBlock>
                                <TextBlock Text="{Binding MyBusTypes}"    />
                        </StackPanel>
                        </Grid>
                    </Border>
                </HierarchicalDataTemplate>

                <HierarchicalDataTemplate DataType="{x:Type dw:FirmwareVersionViewModel}" ItemsSource="{Binding Children}">

                    <Border BorderBrush="White" BorderThickness="1" Loaded="TreeViewItem_Loaded">
                        <Grid>

                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto" SharedSizeGroup="columnGroup" />
                                <ColumnDefinition />
                                <ColumnDefinition Width="Auto" SharedSizeGroup="columnGroup" />
                            </Grid.ColumnDefinitions>

                             <StackPanel Orientation="Vertical" Grid.Row="2" Grid.Column="2">
                                <StackPanel Orientation="Horizontal" Grid.Row="2" Grid.Column="2">
                                    <TextBlock  FontWeight="Bold"> driverversion.identificationnumber</TextBlock>
                                    <TextBlock Text="{Binding VersionDescription}" />
                                </StackPanel>
                                <StackPanel Orientation="Horizontal" Grid.Row="2" Grid.Column="2">
                                    <TextBlock FontWeight="Bold"> driverversion.maximumversion</TextBlock>
                                    <TextBlock Text="{Binding MaximumVersion}"/>
                                </StackPanel>
                                <StackPanel Orientation="Horizontal" Grid.Row="2" Grid.Column="2">
                                    <TextBlock FontWeight="Bold"> driverversion.minimumversion</TextBlock>
                                    <TextBlock Text="{Binding MinimumVersion}"/>
                                </StackPanel>
                            </StackPanel>
                        </Grid>
                    </Border>
                </HierarchicalDataTemplate>
            </TreeView.Resources>
        </TreeView>
    </Grid>

Now I want to add a picture

d2b7eb3ef4fd25b70fb5574374fea08b

The children of the second level should start at the end of its parents.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.