Skip to content

ElementID for DataGridColumnHeader #9

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?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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