Hi,
args.Row.Cells["ParameterValue"].Appearance.TextHAlignAsString = "Center"
but it does not seem to work.
regards
Stefan
HI Stefan,
TextAlign doesn't work because a checkbox is not text. :)
Anyway, though...CheckBoxes in the grid are centered by default. So how are you creating your checkbox column so that it's NOT centered?
thanks for your quick reply.
Actually what I am doing is following. I have a Column of the type of String but in the database it is stored in different types:
The DB Table has fields boolvalue as bool, intvalue as int, .... When filling the dataset I convert them to String so I can show it in the grid and I have a second field which holds the display type e.g. "BOOL". The boolvalue becomes "TRUE" or "FALSE". On the initializeRow Event I change the EditorControl of the Cell to CheckboxControl if the datatype field has the value of "BOOL" so it can show as a checkbox. The cool thing is I actually get a checkbox if the Value is the string "TRUE" or "FALSE". BUT the checkbox is not centered.
This may seem strange but maybe you know a better way of having different fields of a dataset in the same column.
For your understanding :
DB Table Fields: ParaValueInt as int, ParaValueBool as BOOL, ParaValueString as VARCHAR, DataType AS VARCHAR.....
Dataset Fields: ParaValue AS String, Datatype AS String --> Depending on the value of DataType in the DB Table I fill the field ParaValue in the Dataset.
What I actually would need is the possibility to display different fields in one colomn, so this is my workaround,
Hi Stefan,
That all makes perfect sense. What you need to do is set the CheckAlign property on the UltraCheckedEditor control.
I found a similar question you had answered and used that method.
I was only using one option so changing the checkbox to look like an option button worked.
//Make the Checkbox look like an option button
UltraCheckEditor b = new UltraCheckEditor();
b.GlyphInfo = UIElementDrawParams.Office2007RadioButtonGlyphInfo;
e.Layout.Bands[0].Columns["Last"].EditorControl = b;
b.CheckAlign = ContentAlignment.MiddleCenter;
Mike,
I have a similar issue but am using a UltraOptionSet instead of a Checkbox. I used one of the examples on the website to do this. On the grid InitLayout event
I added
UltraOptionSet
u = new Infragistics.Win.UltraWinEditors.UltraOptionSet();
u.Items.Add(
new ValueListItem(true, ""));
u.Items.ValueList.DisplayStyle =
ValueListDisplayStyle.DisplayText;
e.Layout.Bands[0].Columns[
"Last"].EditorControl = u;
The option button shows up in the upper left hand corner of the cell. I would like to center it.
I have tried
"Last"].CellAppearance.TextHAlign = HAlign.Center;
"Last"].CellAppearance.TextVAlign = VAlign.Middle;
and
u.Appearance.TextHAlign =
HAlign.Center;
u.Appearance.TextVAlign =
VAlign.Middle;
Any ideas on how to do this?
Thanks
Walter
Hm, I'm not sure. My guess is that the text always aligns left when editing. But I'm not really sure why that would be. Perhaps you should Submit an incident to Infragistics Developer Support.
By the way, why are you using TextHAlignAsString instead of TextHAlign? The "AsString" properties are just there for serialization and they don't even show up in the Intellisense.
Thanx!!!! It really works!
I am sorry I have to bug you again...
This does not work with a numeric editor.
oNum = NEW Infragistics.Win.UltraWinEditors.UltraNumericEditor(); oNum.Appearance.TextHAlign = Infragistics.Win.HAlign:Right ; args.Row.Cells["ParameterValue"].EditorControl = oNum; args.Row.Cells["ParameterValue"].Appearance.TextHAlignAsString = "Right";
If the cell is not selected and ative then it is aligned correct, but as soon as I click into the cell the alignment goes to the left again. What am I doing wrong?