Skip to content

Follow-up: CaretBrush in editable ComboBoxes #2959

@mkrauter

Description

@mkrauter

Bug explanation

Based on #2951, see also PR #2954

I dig myself a bit into the code and came up with two suggestions:

In a normal (non-DataGrid), editable ComboBox's ControlTemplate there is a definition of CaretBrush to be equal to BorderBrush (?). Makes no sense to me, but probably harms nothing. Wouldn't that be better like

CaretBrush="{TemplateBinding Foreground}"

Along this analogy, for the DataGrid version MaterialDesignDataGridComboBoxEditableTextBox instead of asking the style to do an obscure crawl up into the visual tree for a property (as was in the original PR):

<Setter Property="CaretBrush" Value="{Binding RelativeSource={RelativeSource AncestorType={x:Type FrameworkElement}}, Path=(TextElement.Foreground)}" />

we could just add MaterialDesignDataGridComboBoxEditableTemplate ControlTemplate's TextBox x:Name="PART_EditableTextBox" the same:

CaretBrush="{TemplateBinding Foreground}"

The latter seems more neat to me.

Version

Latest master

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions