When i resize the column, then it seems to get recalculated and everything is shown as expected.
Question, what to i need to do, in order to get it shown correctly without manual resize intervention from the operator? - What i tested is, i added a NodeSource with one node, and removed it, then it is shown correctly or least forced to do so. - But this is currently just a workarround which i want to remove.
Ok, this might work then. - I would need to implement a method in my viewmodel, which triggers this on the diagram. - Usually a relation i try to avoid in MVVM.
Funny thing is, when i set a NodeSource and at one Node, then immediately remove it again, all gets arranged correctly.
Question is, why is’nt this the case for palettes, who only have a LinksSource set also?
Thank you walter, i call now LayoutDiagram() within InitialLayoutCompleted, which totally does the job.
Additionally, i made a custom palette, and added a new dependency property:
#region Dependency properties
public bool TriggerLayoutDiagram
{
get { return (bool)GetValue(TriggerLayoutDiagramProperty); }
set { SetValue(TriggerLayoutDiagramProperty, value); }
}
public static readonly DependencyProperty TriggerLayoutDiagramProperty =
DependencyProperty.Register("TriggerLayoutDiagramProperty",
typeof(bool),
typeof(CustomPalette),
new FrameworkPropertyMetadata(false,
FrameworkPropertyMetadataOptions.AffectsRender,
new PropertyChangedCallback(OnTriggerLayoutDiagramChanged)));
private static void OnTriggerLayoutDiagramChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var palette = d as CustomPalette;
if (palette is not null)
{
if (e.NewValue is bool newValue)
{
if (newValue)
{
palette.LayoutDiagram();
}
}
}
}
#endregion
Then i bind this to my viewmodel property, and am able to trigger a “re-layouting” of the diagram, whenever i have the urge to do so.