WPF: Setting named color to resource? -


I am modifying the control template of the WPF calendar control to change the text color and previous And arrow on the Next control I want to set a local SolidColorBrush resource in Color called MyTextBrush

Previous and next buttons are separate control templates, And pulls the path object for each of its buttons' arrows. Here is the relevant markup for the previous button:

  & lt; Path margin = "14, -6,0,0" height = "10" width = "6" vertical alignment = "center" horizontal alignment = "left" stretch = "fill" data = "m288.75,232.25 l 288.75,240.625 L 283,236.625 Jade "& gt; & Lt; Path.Fill & gt; & Lt; Solid Coiler Brush x: Name = "Textcloud" Color = "# FF 333333" /> & Lt; /Path.Fill> & Lt; / Path & gt;  

Note that the name of the color TextColor , x: Name is using the property.

Here's my problem: x: name requires the property - if it is unavailable, WPF throws an exception, that means that I only MyTextBrush Can not change the entire brush in the context of the resource, because I will lose the x: name value. So, while maintaining the property x: name for the brush in this particular control template, how do I reference MyTextBrush ?

Thank you for your help.

So, how do I reference the mtexbrush, while still maintaining x: Name property in this special control template?

About this problem it seems that you are using a scrappy / delicate template. What is the control template?

  • If you have complete source control of the template, remove the references to the named element (most likely in the storyboard). They are animating the brush for some reasons.
  • To make the template happy, you can create another unused brush bus in your template (perhaps in a hidden element).
  • Finally, you can try adding, but it is very complex and it is not sure its price!

Two more potential solutions:

  • Try to force the property of the SCB ... it should work as a DP
  • Change the template animation so that they do not use the named brushes, but instead use named parents, through the Brush TargetProperty example, Storyboard TargetSprint = "(fill the size). (Solid Collarbrush color)" Storyboard. Target Name = "My Enrolled Parents"

Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -