I have override checkbox next to my numeric steppers which shall indicate could numeric stepper value be overridden by user. I can change ReadOnly to false and Background to transparent when checkbox is unckecked. However when it is checked I set ReadOnly to true and Background color to … what?
Colors.White is not answer since its not valid for Mac dark UI. Is there some default style that I should reference to, which would work on Windows and Mac?
Try using Eto.Drawing.SystemColors.ControlBackground. Or, you could usually just get the original value of BackgroundColor before you set it to transparent.
However I have found other problem related to this topic. On Windows it works fine, NumericStepper is defined with transparent color from the beginning, until user checks for override. However on Mac it not follows initial transparent background color. It changes background only after checkbox action:
How I could force it to set background transparent from the beginning?
UPDATE:
I have workaround for now. I just run below method in PanelShown:
public void PanelShown(uint documentSerialNumber, ShowPanelReason reason)
{
CheckOverridableControls();
}
void CheckOverridableControls()
{
if (OverrideCheckBox.Checked == true)
{
MyNumericStepper.BackgroundColor = SystemColors.ControlBackground;
}
else
{
//I need to set first something because it reacts only to second change of background color
MyNumericStepper.BackgroundColor = SystemColors.ControlBackground;
MyNumericStepper.BackgroundColor = Colors.Transparent;
}
}
Not perfect but works.
Or even better… above method could run at end of content definition instead.