Problems with the sizing in NodeTemplate

Hello,

I wanted to add Form in a Node and it’s successfull but I have a problem with the initial size of my nodes. I prefer that my node have the best size as in decisiontree sample but I have this :
OR

I tested the argument “Auto” in Heigth ou Width but there are no effect

help me please

this my template :

        <go:NodePanel>
                <Path x:Name="Icon"
                    go:NodePanel.Figure="{Binding Path=Data.Figure}"
                    Stroke="{Binding Path=Data.Highlight, Converter={StaticResource theStrokeChooser}}"
                    StrokeThickness="2"
                    Fill="White"
                      Height="Auto"
                      Width="Auto"
                    go:NodePanel.Spot1="0 0" go:NodePanel.Spot2="1 1"
                    go:Node.PortId=""
                    go:Node.LinkableFrom="True" go:Node.LinkableTo="True" Cursor="Hand"/>
                <Border BorderThickness="1" BorderBrush="Black" >
                <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="*" />
                </Grid.RowDefinitions>
                <Grid Grid.Row="0">
                    <TextBlock VerticalAlignment="Center" HorizontalAlignment="Center"
                        Text="{Binding Path=Data.Title}" FontWeight="Bold"  go:Part.TextEditable="True"
                        Foreground="{Binding Path=Data.Color, Converter={StaticResource theStringBrushConverter}}"/>
                </Grid>
                <grid:DataGrid Grid.Row="1" AutoGenerateColumns="False" CanUserResizeColumns="False"
                     Background="White" HorizontalAlignment="Center" VerticalAlignment="Center"
                     ItemsSource="{Binding Path=Data.Items}" HeadersVisibility="None" BorderBrush="White">

                    <grid:DataGrid.Columns>
                        <grid:DataGridTemplateColumn>
                            <grid:DataGridTemplateColumn.CellTemplate>
                                <DataTemplate>
                                    <go:NodePanel>
                                        <Path go:NodePanel.Figure="{Binding Path=Figure}"
                                            Width="10" Height="10"
                                            Fill="{Binding Path=Color}"
                                            Stroke="Black" StrokeThickness="1"/>
                                    </go:NodePanel>
                                </DataTemplate>
                            </grid:DataGridTemplateColumn.CellTemplate>
                        </grid:DataGridTemplateColumn>
                        <grid:DataGridTextColumn Binding="{Binding Path=Name}"/>
                    </grid:DataGrid.Columns>
                </grid:DataGrid>
                </Grid>

                <ToolTipService.ToolTip>
                    <TextBlock Text="{Binding Path=Data.Key}"
                 Visibility="{Binding Path=Data.Key.Length,
                              Converter={StaticResource theCountVisibilityConverter}}" />
                </ToolTipService.ToolTip>
            </Border>
       </go:NodePanel>

By default the value of NodePanel.Sizing is “Fixed”, which means that the main element’s size is not changed, but everything else is fit inside the main element (a Path in this case). But because you didn’t specify a Width and a Height for the Path, it defaulted to 100x100.

But you want to set NodePanel.Sizing=“Auto”. This will cause the main element to be automatically resized to fit around the other element(s). And of course you should not be setting the Width or Height on that Path.