Otto Denstad

Otto Denstad

  • NA
  • 11
  • 973

Custom Control, Disabled Path color error

Oct 12 2014 7:29 AM

Hi!

I've created a Custom Control in WPF named IconButton. It has an Text DP,  Icon DP and an IconColor DP plus an private DP RowSpan.
The Control is derived from Button, and I have utilized most of the Button original Style.

The Control displays an Icon with an optional text under the Icon. RowSpan is used to give the Icon the unused space when text is not set. The Icon resides in a Resource Dictionary and is a monocrome item in a ViewBox created using Path figures.

I have bound the Path Fill property in the ViewBox to the IconColor DP. In the Style I change the IconColor property with a trigger to show change when the IsEnabled property is set to false.

Everything works as expected until I set the IconColor property outside of the Control. If the IsEnabled property is set to false after the colorchange, it will not change the IconColor from the trigger. (If Text is displayed, it is grayed as normal).

Can anyone tell me what I am doing wrong?

Regards