GoWPF 3.0.3 - go:Palette nodes order (Toolbox)

Hi Walter, hope you are doing well.

In the following app, i implemented a nodes palette on the left, a diagram centered, and a links palette on the right.

When i select a node from the nodes toolbox, i can create a node with that visual template by using the ClickCreatingTool (DoubleClick=True). - Works pretty well.

I bind the PrototypeDate to the toolbox data.
I also have implemented that with CTRL+1, CTRL+2, … and so on the first node in the toolbox is getting selected of the second, up to the tenth.

I generate ~ 80 node templates for the toolbox, randomly. - Pretty straight forward…
image

When i hit, CTRL+1, i select the first node in my nodesource collection of the palette.
My propblem currently is, that seems not to be ordered the way i wanted it to have.

I add NT1, then NT2, then NT3 to the collection, but in the go:Palette, NT1 is maybe a template where i need to scroll down find it and so on.

Is there a way, to control the order of the nodes within a go:Palette?

Many thanks meanwhile, Hannes

My educational repository, just in case:
HannesHold/GoWPF: Some educational project to explore the GoWPF application (github.com)

From GoXam for WPF v3

By default a palette uses a Northwoods.GoXam.Layout.GridLayout as its Layout. That GridLayout defaults to sorting all of the nodes by the Part.Text (attached) property. It also re-layouts automatically whenever the viewport size changes, because the size of the DiagramPanel changes or because the scale changes.

Basically you want to customize the Palette’s Diagram.Layout, probably by setting GridLayout.Comparer to do what you want.

Hmm. - If i add 15 nodes sequentially to the nodes palette, the shown order is exactly as how i added them.
image

From 16 onwards, the order seems to follow another rule.
image

No resize has been taking place my manual user input until this state. - It is directly after the app started.

            // 15 nodes order within the toolbox is as how i add the nodes sequentially
            // From 16 nodes onwards, order seems to be random is different
            for (int i = 0; i < 17; i++)
            {
                var newNodedata = new MoNodeData()
                {
                    Text = $"NT {i}"
                };

                // Select first node in the nodes tool box
                if (i == 0) newNodedata.IsSelected = true;
                
                newNodedata.GenerateNodeVisual();
                NodeToolBoxModelNodesSource.Add(newNodedata);
            }

I will try out the comparer, still dont understand why it behaves different from 16 onwards. - My nodes texts are “NT1, NT2, NT3,…” so i would expect the order to be correct.

Ok, i will checkout the GridLayout.Comparer.

Nevermind, i digged into it a bit. - Per default an alphanumeric comparer is used, so the ordering results i saw were correct. - The initial randomness was because i did not set go:Part.Text="{Binding Path=Data.Text}" which lead that in always compared “” with “”. - Still unclear do me, why it was displayed in correct order with <= 15 nodes.

I also played arround with my own IComparer implementation. - Pretty good base is provided by nwoods.

Thanks Walter, solved for me.