hi,
i am having a problem with the cell style.
i have attached a sample. the scenario is:
while if you do the opposite
Italic then bold it works fine.
what i want is to be able to control the cells just like MS Excel. when i check bold make the selected cell bold. when i check italic make cell italic (if the cell already was bold keep it bold and italic) and so on.
Hi,
You should use the BasedOn property of the style instead, of trying to copy them. As Styles are tricky objects, which don't always return the actual property state once they're used:
So, in your code instead of: Style s = new System.Windows.Style(typeof(CellControl));
if (c.Style != null)
{
s = M_CopyStyle(c.Style, new DependencyProperty[] { FontWeightProperty });
}
use:
Style s = new System.Windows.Style(typeof(CellControl));
s.BasedOn = c.Style;
//s = M_CopyStyle(c.Style, new DependencyProperty[] { FontWeightProperty });
-Hope this helps,
-SteveZ