c# - ControlTemplate Binding TextBox inside ErrorTemplate -
My problem is that I do not get the tooltip text thrown by the setter option of my binding object.
I have a controlTemplate like this:
& amp; ControlTemplate x: Key = "textbox diagram template" & gt; & Lt; Grid margin = "- 15,5,0,0" tooltip = "{binding relative sours = {reslevsaurus templated pent}, path = (validation.rrows) [0] .ErrorContent}" & gt; & Lt; Fill Ellipse StrokeThickness = "0" = "Red" width = "{TemplateBinding FontSize}" height = "{TemplateBinding FontSize}" /> & Lt; Text block text = "!" FontSize = "{TemplateBinding FontSize}" fontweit = "bold" foreground = "white" horizontal alignment = "center" /> & Lt; / Grid & gt; & Lt; / ControlTemplate & gt;
I also tried
tooltip = "{binding relative Soros = {relative escests}, path = (validation.art) [0]. ErrorContent} "ToolTip =" {Compulsive Relative Soros = {Relative Soros Extent, Esterhear Type = {x: Type Text Box}}, path = (Validation. Ethers) [0] .ErrorContent} "
My text box looks like this:
& lt; Text box grid Line = "1" grid. Column = "1" name = "TBMin" source update = "tb_SourceUpdated" validation. Error Template = "{StaticResource textBoxErrorTemplate}" />
I am compiling data sources in code like this:
Binding bind mining = new binding ("minstrawing"); BindMinString.Source = curStep; BindMinString.NotifyOnSourceUpdated = true; BindMinString.ValidatesOnExceptions = True; BindMinString.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged; TbMin.SetBinding (text box; textpropy, bindminestring);
The template seems to work (I see the oval with "!"), But I do not see my exception message.
Datacentext can not be accessed from view tree in relativeSource
or ElementName
to target some visual element out here, it will not work here. I have only one link here Adult Element Placeholder
, Even when you do not need to add it, you can set visibility
to collapsed
. At least this is the best way to target this element, in which the error code has been implemented. It has a property which has been named Inserted Element
and it is the access point for you. Here is the working code:
& lt; Grid Margin = "- 15,5,0,0" Tooltip = "{Compulsive Arnold Element. (Validation. Arrays) [0] .ErrorContent, ElementName = 1}" & gt; & Lt; Adolled Element Placeer Name = "One" Visibility = "Collapsed" /> & Lt; Fill Ellipse StrokeThickness = "0" = "Red" width = "{TemplateBinding FontSize}" height = "{TemplateBinding FontSize}" /> & Lt; Text block text = "!" FontSize = "{TemplateBinding FontSize}" fontweit = "bold" foreground = "white" horizontal alignment = "center" /> & Lt; / Grid & gt;
UPDATE :
I have found yet another direct solution. Actually the built in
Datacontext
insideerror filter
areadonlyobserve resolution & lt; Validation error & gt;
is the value ofValidation.Errors
, so the code can be very simple like this:& lt; Grid margin = "- 15,5,0,0" tooltip = "{binding [0] .ErrorContent}" & gt; & Lt; Fill Ellipse StrokeThickness = "0" = "Red" width = "{TemplateBinding FontSize}" height = "{TemplateBinding FontSize}" /> & Lt; Text block text = "!" FontSize = "{TemplateBinding FontSize}" fontweit = "bold" foreground = "white" horizontal alignment = "center" /> & Lt; / Grid & gt;
Comments
Post a Comment