-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(DevTools): Pin properties (#13371)
* feat(DevTools): Pin properties * fix: Address review * fix: revert using * feat: Show Pin ToggleButton on pointer over.
- Loading branch information
1 parent
083c7cb
commit 52cbe29
Showing
9 changed files
with
253 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<ResourceDictionary xmlns="https://github.com/avaloniaui" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
x:ClassModifier="internal"> | ||
<ResourceDictionary.ThemeDictionaries> | ||
<ResourceDictionary x:Key="Default"> | ||
<SolidColorBrush Color="Black" x:Key="PinColor"/> | ||
</ResourceDictionary> | ||
<ResourceDictionary x:Key="Dark"> | ||
<SolidColorBrush Color="White" x:Key="PinColor"/> | ||
</ResourceDictionary> | ||
</ResourceDictionary.ThemeDictionaries> | ||
|
||
<!-- Add Resources Here --> | ||
<DrawingGroup x:Key="Pin_xaml"> | ||
<DrawingGroup.ClipGeometry> | ||
<RectangleGeometry Rect="0.0,-960.0,960.0,960.0"/> | ||
</DrawingGroup.ClipGeometry> | ||
<GeometryDrawing Brush="{DynamicResource PinColor}"> | ||
<GeometryDrawing.Geometry> | ||
<PathGeometry Figures="m 640 -480 l 80 80 v 80 H 520 v 240 l -40 40 l -40 -40 v -240 H 240 v -80 l 80 -80 v -280 h -40 v -80 h 400 v 80 h -40 v 280 Z m -286 80 h 252 l -46 -46 v -314 H 400 v 314 l -46 46 Z m 126 0 Z" FillRule="NonZero"/> | ||
</GeometryDrawing.Geometry> | ||
</GeometryDrawing> | ||
</DrawingGroup> | ||
|
||
<DrawingGroup x:Key="unpin_xaml"> | ||
<DrawingGroup.ClipGeometry> | ||
<RectangleGeometry Rect="0.0,-960.0,960.0,960.0"/> | ||
</DrawingGroup.ClipGeometry> | ||
<GeometryDrawing Brush="{DynamicResource PinColor}"> | ||
<GeometryDrawing.Geometry> | ||
<PathGeometry Figures="m 440 -600 l 80 -80 h 80 v 200 h 240 l 40 40 l -40 40 H 600 v 200 h -80 l -80 -80 H 160 v 40 H 80 v -400 h 80 v 40 z m 80 286 v -252 l -46 46 H 160 v 160 h 314 z m 0 -126 z" FillRule="NonZero"/> | ||
</GeometryDrawing.Geometry> | ||
</GeometryDrawing> | ||
</DrawingGroup> | ||
|
||
<DrawingImage Drawing="{StaticResource unpin_xaml}" x:Key="UnpinIcon"/> | ||
<DrawingImage Drawing="{StaticResource Pin_xaml}" x:Key="PinIcon"/> | ||
|
||
</ResourceDictionary> |
25 changes: 25 additions & 0 deletions
25
src/Avalonia.Diagnostics/Diagnostics/Converters/BoolToImageConverter.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
using System; | ||
using System.Globalization; | ||
using Avalonia.Data; | ||
using Avalonia.Data.Converters; | ||
using Avalonia.Media; | ||
|
||
namespace Avalonia.Diagnostics.Converters; | ||
|
||
internal class BoolToImageConverter : IValueConverter | ||
{ | ||
public IImage? TrueImage { get; set; } | ||
|
||
public IImage? FalseImage { get; set; } | ||
|
||
public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture) => | ||
value switch | ||
{ | ||
true => TrueImage, | ||
false => FalseImage, | ||
_ => null | ||
}; | ||
|
||
public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture) => | ||
BindingOperations.DoNothing; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.