Group button extand/collapse position

I am currently working on my node template, I would like to create my extand/collapse button outside my group shape.

I first use this template but my button was inside my shape and nodes were over it…

In order to create my button outside my groupe, I used this :

But, as you can see here, my nodes are now overlaping my group…

I don’t understand why my nodes are now overlaping my group… How could I solve this? :$

Either template should work, because the Button was outside of the GroupPanel. Are you sure that the red Gamma triangle node and the Delta subgraph are in fact members of that Group?

Yes I am sure, when I try to place them outside, my group is expending to keep them inside :$

The problem is that you don’t have all of those Part/Node/Group attached properties on the root visual element of the DataTemplate. Putting them on any nested element has no effect. The main exceptions are the Node attached properties that involve ports.

I created this template :

            <StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
                <TextBlock Text="{Binding Path=Data.Key}" FontWeight="Bold" />
                <Button x:Name="myCollapseExpandButton" Click="CollapseExpandButton_Click"
                                    Content="-" Width="20" Height="20" Margin="10 0 0 0"/>
            </StackPanel>

            <StackPanel>
                <go:NodePanel Sizing="Auto">
                    
                    <Path go:NodePanel.Figure="RoundedRectangle" Fill="WhiteSmoke"
                          Stroke="{Binding Path=Node.IsDropOntoAccepted, Converter={StaticResource theStrokeChooser}}"/>
                    
                        <go:GroupPanel x:Name="myGroupPanel"
                                        go:Group.IsSubGraphExpanded="True"
                                       AllowDrop="True"
                                       SurroundsMembersAfterDrop="True"/>
                    
                    <go:Group.Layout>
                        <golayout:LayeredDigraphLayout Direction="90" ConditionFlags="Standard GroupSizeChanged" />
                    </go:Group.Layout>
                </go:NodePanel>
            </StackPanel>
        </StackPanel>

My shape surround my node and I can Add/remove nodes from my group but the behaviour is strange. First, my group can be very large when I drop a new node, and when It resize itself, it can go over other nodes in my diagram… :S
Can I correct this behaviour? :$

I’m surprised you’re not getting a warning message about trying to set Group.Layout on an element way down deep, rather than on the root visual element. Are you sure you’re not getting any warning messages in the Visual Studio Output window?

As a general suggestion, it’s always wise to look for such output. For example, you’ll see messages about problems with data-bindings.

It disapear very fast, I can’t find how to persist my Visual Studio Output window, but I don’t have warning… :$