Mar 29, 2013 at 8:33 PM
Edited Mar 29, 2013 at 9:13 PM
Is there a control-specific way to change the selected fore color and back color? Something I'm overlooking perhaps?
For example, all of my custom controls I've written for my app have SelectedForeColor and SelectedBackColor properties so that the app will use these colors for selected text instead of the system-defined colors. If these properties are set to Color.Empty,
then my controls use the system defined colors. Otherwise they use the colors defined by the control.
If there isn't a way to do this today in HtmlRenderer controls, then I can will gladly add the SelectedForeColor and SelectedBackColor properties to the controls for the future and alter the rendering code to use them. I just wanted to make sure you were OK
with adding this to the controls going forward so that I won't have to keep merging the changes.
Or if you already have this capability, please point it out to me. Perhaps I can control it with CSS for example?
EDIT: there is a way to do this in CSS but it isn't supported in IE, and apparently not HtmlRenderer either. It uses either the ::selection style or ::-moz-selection style depending on browser:
However, since there is no single standard, I recommend just using the SelectedForeColor and SeletedBackColor styles. Firefox uses one syntax (::-moz-selection), Safari/Chrome/Opera use yet another syntax (::selection), and IE doesn't support it at all. Instead,
since it's a globally applied style anyway, I think it's best to just use properties.
If you wanted to do it through CSS, then I recommend using ::selection, as it is supported by more browsers. However, I'm not sure I'd e comfortable making that level of change to the source. At least not until I had a chance to look at it and how styles are
parsed. Adding the properties should be cake.
Please let me know what you think...