I have one column in my datagrid which contains Icons. for this I have one celltemplate added to column programatically.
var imageFactory = new FrameworkElementFactory(typeof(System.Windows.Controls.Image));
imageFactory.SetBinding(System.Windows.Controls.Image.SourceProperty, imageBinding);
imageFactory.SetValue(System.Windows.Controls.Image.StretchProperty, Stretch.None);
if (config.Font != null)
{
double height = config.Font.Size;
imageFactory.SetValue(FrameworkElement.HeightProperty, height);
}
var dataTemplate = new DataTemplate { VisualTree = imageFactory };
statusColumn.CellTemplate = dataTemplate;
view.DataGrid.Columns.Add(statusColumn);
when I set Height property externally it crops the image instead of resizing image to 'height' value.
how to set image height to specific value. please suggest.