wpf - How to specify a ToolTip for a control in a Style from XAML? -
I am using WPF datagrid from Microsoft CodePlex project. I have a custom control that I want to database in a field from the row of the datagrid. I can not understand how to specify tooltip on the DataGrid line for my life.
I have come to the closest to set tooltips, to use a roshell with a setter, but it works only for text. When I try to put a ControlTempalte as the value for ToolTip, it displays the results of calling ToString on the ControlTemplate type.
I think I need to set the tooltip's "template" property, but I do not seem to understand how to do it ...
& Lt; DG: Data Grid Name = "DGSRSL" Autocontent Columns = "True" & gt; & Lt; Dg: DataGrid.RowStyle & gt; & Lt; Style TargetType = "{x: Type DG: DataGridRO}" & gt; & Lt; Setter Property = "Tooltip" & gt; & Lt; Setter.Value & gt; & Lt; ControlTemplate TargetType = "{x: type tooltip}" & gt; & Lt; StackPanel & gt; & Lt; TextBlock & gt; Txt1 & lt; / TextBlock & gt; & Lt; TextBlock & gt; Txt2 & lt; / TextBlock & gt; & Lt; / StackPanel & gt; & Lt; / ControlTemplate & gt; & Lt; /Setter.Value> & Lt; / Setter & gt; & Lt; / Style & gt; & Lt; / DG: DataGrid.RowStyle & gt; & Lt; / DG: Data grid & gt;
understood it ... I was about 6 hours ...
For some reason, I can set the value directly. Value.Setter If I define content for tooltips as a static resource, and then sets it in the Style property of DataGrid.RowStyle.
Then, the DataGrade Line style looks like this:
is more resource
& lt; window. Resources & gt; & Lt; StackPanel X: Key = "resKWIC" & gt; & Lt; TextBlock & gt; F1 & lt; / TextBlock & gt; & Lt; TextBlock & gt; F2 & gt; & Lt; / TextBlock & gt; & Lt; / StackPanel & gt; & Lt; /Window.Resources> Thanks!
Comments
Post a Comment