Hi,
I am having a different kind of requirement.
I have two lines of text in a single cell in Ultrawingrid.
I have to apply font size of 14 and color black to first line text.
And font size of 12 and color blue to second line text.
Could you please let me know how to do it?
Thanks,
Venkat.
You could use the UltraControlContainerEditor to place a control in a cell. So, you could, for example, create a control that has two textboxes or a textbox and a label or something like so that you display two pieces of information in the cell with different fonts or formatting. But there are a few caveats to be aware of with this approach: - First, the cell itself only contains a single value. So you would need to either parse that value or get the additional data from somewhere else. - Second, it can be a bit tricky to set up the UltraControlContainerEditor if you've never done it before, so you'd have to check the documentation and samples on how to do it correctly.
Hi Mike,
Is there any way to add different format text value(eg. having different font than existing cell text) in some control and that would be further added into cell. After that, it would be displayed along with existing text value of the cell and that cell also having existing image and existing button within.
Mosam
I'm not sure what kind of images you are referring to. But at a guess, you might be applying an image to the Cell via an Appearance, and I don't think the FormattedTextEditor provides the ability to show image and text separately like that. You could embed the image into the Xml, of course, as I mentioned earlier. There's an Image tag and a whole bunch of options for that. If you don't want to use the Xml approach at all, then the other alternative would be to use a DrawFilter or a essentially draw the cell (or the cell text) yourself. If you are familiar with GDI Plus drawing and text rendering, then that might be a better alternative, since it would mean you could keep using UltraTextEditor. The down side is that since you would be affecting the cell contents at the Drawing level, things like sorting and AutoSizing the column wouldn't be able to account for that. And the text would not display when the cell is in edit mode - if you are even allowing the user to edit this cell, which seems unlikely.
Thanks for providing suggestions on it. I have set the EditorComponent to UltraFormattedTextEditor from UltraTextEditor. It shows button named H in upper right side. but issue is with images when e.Row.Cells[i].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.FormattedText. Its not showing images in same cell.
Also, i don't want to use xml option to show formatted two different texts in same cell along with image and button within same cell.
Is there any other approach where i can display two different formats of text values having different font sizes along with image and button in same cell.
We don't want to use xml approach as we may have certain data value which may be conflicting while converting them to xml.
below is simple code where its displaying text plus button plus image in same cell. Where i need to add another formatted text value within.
Can you pls provide your inputs here.
private void uGrid_InitializeRow(object sender, InitializeRowEventArgs e)
{
UltraGridBand m_band = e.Row.Band;
try
for (int i = 1; i < m_band.Columns.Count - (CintColumnsToHide - 1); i++)
string myValue = (string)e.Row.Cells[i].Value;
//e.Row.Cells[i].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.FormattedText;
//e.Row.Cells[i].Value = e.Row.Cells[i].Value + "<font size=\"5.25pt\">\n My Test</font>"; \\My Test should be shown with smaller font in new line
string abCode = (string)e.Row.Cells[i + 2].Value;
string strHasRHistory = (string)e.Row.Cells[i + 4].Value.ToString().ToUpper();
bool isFullEditorDisplay = true;
switch abCode ())
case "M":
e.Row.Cells[i].Appearance.Image = ImageServer.GetImage("RH");
e.Row.Cells[i].Appearance.ImageHAlign = HAlign.Right;
e.Row.Cells[i].Appearance.ImageVAlign = VAlign.Top;
e.Row.Cells[i].CellDisplayStyle = CellDisplayStyle.FullEditorDisplay;
break;
case "N":
e.Row.Cells[i].Appearance.Image = ImageServer.GetImage("RL");
default:
//e.Row.Cells[i].CellDisplayStyle = CellDisplayStyle.FormattedText;
isFullEditorDisplay = false;
}
if strHasRHistory == "TRUE" )
UltraTextEditor uViewHistoryTextEditor = new UltraTextEditor();
if (strHasResultCorrectionHistory == "TRUE")
} EditorButton btnViewHisEditor = new EditorButton();
btnViewHisEditor.AccessibleName = "btnhasRHistory";
btnViewHisEditor.Tag = "btnhasRHistory";
btnViewHisEditor.Appearance.Image = ImageServer.GetImage("History");
btnViewHisEditor.Appearance.ImageHAlign = HAlign.Right;
btnViewHisEditor.Appearance.ImageVAlign = VAlign.Top;
btnViewHisEditor.ButtonStyle = UIElementButtonStyle.Borderless;
btnViewHisEditor.Appearance.BackColor = Color.Transparent;
uViewHistoryTextEditor.ButtonsRight.AddbtnViewHisEditor
e.Row.Cells[i].EditorComponent = uViewHistoryTextEditor;
_uResultGrid.DisplayLayout.Bands[0].Columns[i].ButtonDisplayStyle = Infragistics.Win.UltraWinGrid.ButtonDisplayStyle.Always;
else
if (isFullEditorDisplay == false)
e.Row.Cells[i].CellDisplayStyle = CellDisplayStyle.FormattedText;
// Column Width should be increased if Comments Text Length is more than 8 characters..
if (e.Row.Cells[i].Text.Length > 8)
m_band.Columns[i].CellMultiLine = DefaultableBoolean.True;
m_band.Columns[i].Width = 200;
e.Row.PerformAutoSize(); // Auto resize row once value assigned to row...
i += (CintColumnsToHide - 1);
catch (Exception ex)
Oh... you are setting the EditorComponent to an UltraTextEditor. Instead of that, use an UltraFormattedTextEditor. Setting the Style on the column changes the default editor. But if you then set the EditorComponent, you are essentially ignoring the Style and overriding the editor. So you can forego setting the Style in this case and just use an UltraFormattedTextEditor as an EditorComponent and achieve the same thing. UltraFormattedTextEditor also supports Editor buttons, so you can add the same button to it that you are adding to your UltraTextEditor.