Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ElementID for DataGridColumnHeader #9

Open
Brains opened this issue Apr 30, 2022 · 0 comments
Open

ElementID for DataGridColumnHeader #9

Brains opened this issue Apr 30, 2022 · 0 comments

Comments

@Brains
Copy link

Brains commented Apr 30, 2022

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?

@Brains Brains changed the title DataGrid ElementID for DataGridColumnHeader Apr 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant