From b7bd6f6643cda2a31ac98e3d4e9c77aca40cc0ce Mon Sep 17 00:00:00 2001 From: Curtis Wensley Date: Tue, 30 May 2023 16:50:09 -0700 Subject: [PATCH] Wpf: Allow changing ImageText/ViewCell margins via styles. --- src/Eto.Wpf/Forms/Cells/ImageTextCellHandler.cs | 4 +++- src/Eto.Wpf/Forms/Cells/ImageViewCellHandler.cs | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Eto.Wpf/Forms/Cells/ImageTextCellHandler.cs b/src/Eto.Wpf/Forms/Cells/ImageTextCellHandler.cs index aa12b8f237..e17425017a 100755 --- a/src/Eto.Wpf/Forms/Cells/ImageTextCellHandler.cs +++ b/src/Eto.Wpf/Forms/Cells/ImageTextCellHandler.cs @@ -110,9 +110,11 @@ public Column() ScalingMode = swm.BitmapScalingMode.HighQuality; } + public sw.Thickness ImageMargin { get; set; } = new sw.Thickness(0, 2, 2, 2); + swc.Image CreateImage() { - var image = new swc.Image { StretchDirection = swc.StretchDirection.DownOnly, Margin = new sw.Thickness(0, 2, 2, 2) }; + var image = new swc.Image { StretchDirection = swc.StretchDirection.DownOnly, Margin = ImageMargin }; swm.RenderOptions.SetBitmapScalingMode(image, ScalingMode); image.DataContextChanged += (sender, e) => { diff --git a/src/Eto.Wpf/Forms/Cells/ImageViewCellHandler.cs b/src/Eto.Wpf/Forms/Cells/ImageViewCellHandler.cs index 6ff7aeb617..535969afdb 100755 --- a/src/Eto.Wpf/Forms/Cells/ImageViewCellHandler.cs +++ b/src/Eto.Wpf/Forms/Cells/ImageViewCellHandler.cs @@ -44,9 +44,11 @@ public Column() ScalingMode = swm.BitmapScalingMode.HighQuality; } + public sw.Thickness Margin { get; set; } = new sw.Thickness(0, 2, 2, 2); + swc.Image Image (swc.DataGridCell cell) { - var image = new swc.Image { StretchDirection = swc.StretchDirection.DownOnly, Margin = new sw.Thickness (0, 2, 2, 2) }; + var image = new swc.Image { StretchDirection = swc.StretchDirection.DownOnly, Margin = Margin }; swm.RenderOptions.SetBitmapScalingMode(image, ScalingMode); image.DataContextChanged += (sender, e) => {