ThinkSharp.FeatureTour icon indicating copy to clipboard operation
ThinkSharp.FeatureTour copied to clipboard

ElementID for DataGridColumnHeader

Open Brains opened this issue 2 years ago • 0 comments

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 avatar Apr 30 '22 20:04 Brains