Skip to content

CollapseButton in NodeView's ControlTemplate is not customizable #134

@czh098tom

Description

@czh098tom

If you try to set NodeView's ControlTemplate, you may want to customize appearance for the collapse button, because the background underneath that button varies.

Traditionally in this case there should be two ways to assign an appearance to it:

  1. Provide a template for it, by using style or directly by Template dependency property.
  2. Write a custom control to replace it.

However the ControlTemplate requires a button with type NodeNetwork.Views.Controls.ArrowToggleButton which is defined as a xaml UserControl derives from ToggleButton with only Template set inside the control.
Since the template is defined inside the control, there is no way to set its Template, and making a custom control derives from it to overwrite is quite difficult.
Since NodeView's control template requires an ArrowToggleButton, there is no way to make another control derived from ToggleButton replacing it.

I think something should be done with this issue, e.g. change NodeView's code from

private ArrowToggleButton CollapseButton { get; set; }
...

public override void OnApplyTemplate()
{
    CollapseButton = GetTemplateChild(nameof(CollapseButton)) as ArrowToggleButton;
...
}

To

private ToggleButton CollapseButton { get; set; }
...

public override void OnApplyTemplate()
{
    CollapseButton = GetTemplateChild(nameof(CollapseButton)) as ToggleButton;
...
}

Or strip control template from definition of ArrowToggleButton itself, or rewrite ArrowToggleButton class to support control template.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions