Skip to content

Commit d70af24

Browse files
committed
Adding cornerradius to image
1 parent 2c967b4 commit d70af24

File tree

6 files changed

+269
-223
lines changed

6 files changed

+269
-223
lines changed

components/MarkdownTextBlock/samples/MarkdownTextBlockCustomThemeSample.xaml.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ namespace MarkdownTextBlockExperiment.Samples;
99
/// <summary>
1010
/// A sample demonstrating custom theming options for the MarkdownTextBlock control with live editing.
1111
/// </summary>
12+
///
1213
[ToolkitSample(id: nameof(MarkdownTextBlockCustomThemeSample), "Custom Theme", description: "A sample showcasing custom theming options with live editing for headings, code blocks, quotes, tables, and more.")]
1314
public sealed partial class MarkdownTextBlockCustomThemeSample : MarkdownTextBlockCustomThemeSampleBase
1415
{
@@ -34,12 +35,16 @@ This sample demonstrates the **custom theming** capabilities of the `MarkdownTex
3435
3536
## Images
3637
37-
Images can be styled with max width, max height, and stretch options. Notice how the text flows naturally without any gaps above or below the image:
38+
Images can be styled with max width, max height, corner radius, and stretch options. Notice how the text flows naturally without any gaps above or below the image:
3839
3940
![Windows Terminal](https://devblogs.microsoft.com/commandline/wp-content/uploads/sites/33/2025/11/0.96-Social-media-image-V2-1024x536.webp)
4041
4142
The image above automatically scales to respect the max width setting while maintaining its aspect ratio. Text continues to flow seamlessly below it.
4243
44+
![Shortcut Conflict](https://devblogs.microsoft.com/commandline/wp-content/uploads/sites/33/2025/09/ShortcutConflict.png)
45+
46+
Here's another image showing how corner radius can be applied to give images rounded corners.
47+
4348
## Code Blocks
4449
4550
```csharp

components/MarkdownTextBlock/samples/MarkdownTextBlockCustomThemeSampleBase.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,9 @@ public abstract partial class MarkdownTextBlockCustomThemeSampleBase : Page
101101
public static readonly DependencyProperty ImageStretchIndexProperty =
102102
DependencyProperty.Register(nameof(ImageStretchIndex), typeof(int), typeof(MarkdownTextBlockCustomThemeSampleBase), new PropertyMetadata(0));
103103

104+
public static readonly DependencyProperty ImageCornerRadiusProperty =
105+
DependencyProperty.Register(nameof(ImageCornerRadius), typeof(double), typeof(MarkdownTextBlockCustomThemeSampleBase), new PropertyMetadata(0d));
106+
104107
public static readonly DependencyProperty BoldFontWeightIndexProperty =
105108
DependencyProperty.Register(nameof(BoldFontWeightIndex), typeof(int), typeof(MarkdownTextBlockCustomThemeSampleBase), new PropertyMetadata(0));
106109

@@ -283,6 +286,12 @@ public int ImageStretchIndex
283286
set => SetValue(ImageStretchIndexProperty, value);
284287
}
285288

289+
public double ImageCornerRadius
290+
{
291+
get => (double)GetValue(ImageCornerRadiusProperty);
292+
set => SetValue(ImageCornerRadiusProperty, value);
293+
}
294+
286295
public int BoldFontWeightIndex
287296
{
288297
get => (int)GetValue(BoldFontWeightIndexProperty);
@@ -426,6 +435,7 @@ public MarkdownThemes CreateThemes()
426435
ImageMaxWidth = ImageMaxWidth,
427436
ImageMaxHeight = ImageMaxHeight,
428437
ImageStretch = ImageStretchOptions[ImageStretchIndex],
438+
ImageCornerRadius = new CornerRadius(ImageCornerRadius),
429439

430440
BoldFontWeight = BoldFontWeights[BoldFontWeightIndex],
431441

@@ -470,6 +480,7 @@ public void ResetToDefaults()
470480
ImageMaxWidth = 0;
471481
ImageMaxHeight = 0;
472482
ImageStretchIndex = 0;
483+
ImageCornerRadius = 0;
473484

474485
BoldFontWeightIndex = 0;
475486

0 commit comments

Comments
 (0)