Skip to content

ElementID for DataGridColumnHeader #9

@Brains

Description

@Brains

Goal
Need to put a popup over Name header in DataGrid
image

Attempts
Tried to set ElementID through style or directly, in turn

<Style x:Key="TourNameHeaderStyle" TargetType="{x:Type DataGridColumnHeader}">
    <Setter Property="tour:TourHelper.ElementID" Value="Name"/>
</Style>

<DataGridTextColumn Binding="{Binding name}" HeaderStyle="{StaticResource TourNameHeaderStyle}">
    <DataGridTextColumn.Header>
        <TextBlock Text="Name" tour:TourHelper.ElementID="Name"/>
    </DataGridTextColumn.Header>
</DataGridTextColumn>

Result
Can not find Name in both cases

Could not find visual element with ElementID 'Name'.
Popup may not occur. Ensure that the visual element is available in the current view.

Reason?
Guess, it's because DataGridTextColumn is not in the same visual tree as rest elements.
VisualTreeHelper is used everywhere in ThinkSharp.FeatureTouring.Helper.WpfUtils.

Workaround
Fake Control over the header is not an option since columns can be resized, reordered, shrunk by main window, etc.

Question
Is it possible to overcome this?

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