wpf - accessing a visual element in code -
I want to match the following xaml in the code, but I do not know how to capture that text block element: < / P>
& lt; Local: Deaf TheWeekColumn ... & lt; Local: TheWeekColumn.Header & gt; & Lt; TextBlock Text = "{binding ...}, tooltip =" {binding ...} /> & Lt; / Local: DayOfTheWeekColumn.Header & gt; & Lt; / Local: DayOfTheWeekColumn & gt;
The DayOfTheWeekColumn is a subclass of a DataGridTextColumn. I can easily get it on the header and set it to my content, and now I want to set the tooltip in the code, to find out how to do it in xaml above.
Cheers, Berryl
Edit =========
Even Code for DayOfTheWeekColumn is. XML is part of the text book headers' visual tree, and nothing else I want to put in XML. I want to put it in the tooltip, however, is in the code, so I can set it there.
I am thinking that the column headers should have the property of a child, which I can use to find the text box, but the haven has not been found yet.
Public Segment Day Off TheWeekColumn: DataGridTextColumn {Public Dependency Property Dovatetry = Dependency Property for Public Stability Reading. Registrar ("DowDate", Type Time (DateTime), Typef (Deaf the Vaccum), New Property Matadata (Ondate Chengal)); Public Datetime Downdet {Return Date (Datetime) GetValue (Dovetail Proprietary); } Set {set value (dowload property, value); }} Private Static Zero Current Change (Target Object Target, DependencyPropertyChangedEventArgs e) {var col = (DataGridTextColumn) target; Var date = (date time) e.NewValue; Col.Header = date.ToString (Strings. ShortDayOfWeekFormat); //col.Header.ToolTip = "If only it was very easy !!" & Lt; ==============} Public DayOfTheWeekColumn () {width = 60; CanUserReorder = false; CanUserResize = false; CanUserSort = false; Chris Anderson's Compulsory Windows Presentation Foundation's P161 pretty much answers this question. If you have this, then I recommend it as a reference. However, you are very close, I do not know how you have lost it):
Private static zero onet change (Dependent Object target, Dependency Property Entrepreneur E ) {Var col = (DataGridTextColumn) goal; Var date = (date time) e.NewValue; Var text block = new text block (); Col.Header = Text Block; Text block Text = date Toaster (strings. Short diyfwick format); Textblock.ToolTip = "It's Easy. :)"; }
Comments
Post a Comment