Hi, I am trying to provide rich formating to the XamWebGrid. I am trying to add mutiple formating to a single cell like bold, italic, font size and etc. As
((
Setter)myGrid.ActiveCell.Style.Setters[0]).Property gives the proper results as per assigned propertyBut ((Setter)myGrid.ActiveCell.Style.Setters[0]).Value always return null after applying the style to cell.
Is there any way to get value of applied style.Setter?
And can you also help me to apply TextAlignment and underling the text in editable mode?
I tried a lot but failed to find detailed documentation about Cell.Style.Setters, Please also provide me some url to get in depth details about Style and Setter documentation with applicable properties and related values like following
myGrid.ActiveCell.Style.
new Setter(CellControl.FontStyleProperty, FontStyles
.Italic));
Thanks.
Hi, Sorry for late reply,
we have applied the text decoration in folling way but it is not working:
s.Setters.Add(
.Underline ));
cell.Style = s;
Can you help in this regards?
Thanks
Hi Imran,
No, i don't have a good suggestion for this. If you need to build your styles dynamically, there isn't a good way other than storing off information on what styles you set.
If you have a bunch of predefined styles, you can simply use a ResourceDictionary and load them, but i'm not sure what you're exact situation is.
As for underlining, if you're using a TextColumn, you can set the TextBlockStyle property to a custom style that modifies the TextDecorations property and sets it to Underline.
-SteveZ
Hi SteveZ, Yes you are absolutely right that setters don't show their values after applied to control style. It means there is no way to get value of applied property. Can you suggest me some work around for this? I am not eager to maintain a separate collection of styles Applied on each and every cell.
One more thing is there some way to make text underlign and text alignment of indvidual cell (not column level).
ThanksImran Javed Zia
Hi,
So, the issue you're seeing where the value of the setter disappears is just some weird thing that Styles do.
We've noticed it as well, however there isn't anything that can be done to avoid it.
You can even see the same thing happen with a TextBox:
TextBox tb = new TextBox();
Style s = new Style(typeof(TextBox));
s.Setters.Add(new Setter(TextBox.BackgroundProperty, new SolidColorBrush(Colors.Red)));
tb.Style = s;
To see what properties can be set in a style, simply look at the properties associated with the CellControl. Any DependencyProperty is settable via the setter. You can look at the Static members to see which Dependency properties are available.
Hope this helps clear some things up.