Reputation: 1896
How do I show Rich text Formatted Text in an Ultra Win Grid cell (infragistics). I am storing this data as a varbinary(MAX) in the database.
Upvotes: 0
Views: 3333
Reputation: 1817
With Infragistics you have a lot of options how to implement this feature. Let me show you the easiest way:
UltraGridColumn c = null;
/// initialize c here. Lets suppose that it has a "rtf" key.
c.Style = ColumnStyle.FormattedTextEditor;
((FormattedLinkEditor) c.Editor).UnderlineLinks = UnderlineLink.Always;
((FormattedLinkEditor)c.Editor).LinkClicked += new Infragistics.Win.FormattedLinkLabel.LinkClickedEventHandler(rtfColumnn_LinkClicked);
c.MaskClipMode = MaskMode.Raw;
((FormattedLinkEditor) c.Editor).TreatValueAs = TreatValueAs.FormattedText;
private void rtfColumnn_LinkClicked(object sender, Infragistics.Win.FormattedLinkLabel.LinkClickedEventArgs e)
{
e.OpenLink = true;
}
bindingGrid.BeforeEnterEditMode += this.Grid_BeforeEnterEditMode;
private void Grid_BeforeEnterEditMode(object sender, System.ComponentModel.CancelEventArgs e)
{
if (Grid.ActiveCell.Column.Key=="rtf")
{
Infragistics.Win.SupportDialogs.FormattedTextEditor.FormattedTextUIEditorForm rtf_frm =
new FormattedTextUIEditorForm();
rtf_frm.Value = Grid.ActiveCell.Value;
DialogResult dresult = rtf_frm.ShowDialog();
if (dresult == DialogResult.OK)
{
Grid.ActiveCell.Value = rtf_frm.Value;
}
e.Cancel = true;
return;
}
}
Upvotes: 1