Skip to content

Commit

Permalink
fix: add GeometryConverter to PathIcon Data property
Browse files Browse the repository at this point in the history
  • Loading branch information
punker76 committed Oct 13, 2024
1 parent ee1a7cd commit a6bc8de
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 2 additions & 0 deletions src/MahApps.Metro/Controls/Icons/PathIcon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using System.ComponentModel;
using System.Windows;
using System.Windows.Media;
using System.Windows.Shapes;
Expand All @@ -23,6 +24,7 @@ public static readonly DependencyProperty DataProperty
/// <summary>
/// Gets or sets a Geometry that specifies the shape to be drawn. In XAML this can also be set using the Path Markup Syntax.
/// </summary>
[TypeConverter(typeof(GeometryConverter))]
public Geometry? Data
{
get => (Geometry?)this.GetValue(DataProperty);
Expand Down
9 changes: 6 additions & 3 deletions src/Mahapps.Metro.Tests/Tests/TextBoxHelperTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,16 @@ public async Task TestAttachedPropertyButtonContent()
await this.fixture.PrepareForTestAsync(new[] { TextBoxHelper.ButtonContentProperty.Name });
await TestHost.SwitchToAppThread();

var content = "42";
var content = "M237.5 75A12.5 12.5 0 0 0 237.5 100A12.5 12.5 0 0 1 250 112.5V212.5A12.5 12.5 0 0 1 237.5 225H142.6875L136.8 241.675A12.5125 12.5125 0 0 1 125 250H62.5A12.5 12.5 0 0 1 50 237.5V112.5A12.5 12.5 0 0 1 62.5 100A12.5 12.5 0 0 0 62.5 75A37.5 37.5 0 0 0 25 112.5V237.5A37.5 37.5 0 0 0 62.5 275H125C141.325 275 155.2125 264.5625 160.375 250H237.5A37.5 37.5 0 0 0 275 212.5V112.5A37.5 37.5 0 0 0 237.5 75zM174.875 76.2A62.525 62.525 0 0 0 96.2125 172.5375A62.5 62.5 0 0 0 192.55 93.875L228.8 57.625A12.5 12.5 0 0 0 211.1125 39.9625L174.8625 76.2000000000001zM166.925 101.825A37.5 37.5 0 1 1 113.875 154.875A37.5 37.5 0 0 1 166.9125 101.8375z";

this.fixture.Window?.TestTextBox.SetValue(TextBoxHelper.ButtonContentProperty, content);
Assert.Equal(content, this.fixture.Window?.TestTextBox.FindChild<Button>("PART_ClearText")?.Content);
this.fixture.Window?.TestButtonTextBox.SetValue(TextBoxHelper.ButtonContentProperty, content);
Assert.Equal(content, this.fixture.Window?.TestButtonTextBox.FindChild<Button>("PART_ClearText")?.Content);

content = "42";

this.fixture.Window?.TestTextBox.SetValue(TextBoxHelper.ButtonContentProperty, content);
Assert.Equal(content, this.fixture.Window?.TestTextBox.FindChild<Button>("PART_ClearText")?.Content);

this.fixture.Window?.TestPasswordBox.SetValue(TextBoxHelper.ButtonContentProperty, content);
Assert.Equal(content, this.fixture.Window?.TestPasswordBox.FindChild<Button>("PART_ClearText")?.Content);
this.fixture.Window?.TestButtonRevealedPasswordBox.SetValue(TextBoxHelper.ButtonContentProperty, content);
Expand Down

0 comments on commit a6bc8de

Please sign in to comment.