BoldSignEasily embed eSignatures in your .NET applications. Free sandbox with native SDK available.
private void datagrid_QueryRowHeight(object sender, QueryRowHeightEventArgs e) { if (this.datagrid.GridColumnSizer.GetAutoRowHeight(e.RowIndex, gridRowResizingOptions, out Height)) {
e.Height = Height;
e.Handled = true;
}
|
public class dColumnSizerExt : GridColumnSizer { public dColumnSizerExt(SfDataGrid grid) : base(grid) {
} protected override Size MeasureTemplate(object record, GridColumn column) { var data = record.GetType().GetProperty(column.MappingName).GetValue(record); var datatext=Convert.ToString(data); FormattedText formattedtext = GetFormattedText(column, record, datatext); formattedtext.Trimming = TextTrimming.None; formattedtext.MaxTextWidth = this.DataGrid.GetVisualContainer().ColumnWidths.DefaultLineSize; formattedtext.MaxTextHeight = double.MaxValue; if (formattedtext.MaxTextWidth > (Margin.Left + Margin.Right)) formattedtext.MaxTextWidth -= (Margin.Left + Margin.Right); return new Size(formattedtext.Width, formattedtext.Height); }
private FormattedText GetFormattedText(GridColumn column, object record, string datatext) { FormattedText formattedtext; formattedtext = new FormattedText(datatext, System.Globalization.CultureInfo.CurrentCulture, DataGrid.FlowDirection, new Typeface(FontFamily, new FontStyle(), new FontWeight(), new FontStretch()), 14, Brushes.Black); return formattedtext;
|