From a816dcee8d9f954962a9036ddb98ff4ee313f7f4 Mon Sep 17 00:00:00 2001 From: Ghislain1 Date: Fri, 11 Aug 2023 23:48:48 +0200 Subject: [PATCH] Add Magnifier --- Ghis.Controls.Test/Magnifier/MagnifierTest.cs | 10 ++-- Ghis.Controls/Assets/Magnifier.xaml | 51 +++++++++++++++++++ Ghis.Controls/Ghis.Controls.csproj | 12 +++++ Ghis.Controls/Magnifier/Magnifier.cs | 5 +- Ghis.Controls/Themes/Generic.xaml | 1 + 5 files changed, 73 insertions(+), 6 deletions(-) create mode 100644 Ghis.Controls/Assets/Magnifier.xaml diff --git a/Ghis.Controls.Test/Magnifier/MagnifierTest.cs b/Ghis.Controls.Test/Magnifier/MagnifierTest.cs index 39b3239..e642bdd 100644 --- a/Ghis.Controls.Test/Magnifier/MagnifierTest.cs +++ b/Ghis.Controls.Test/Magnifier/MagnifierTest.cs @@ -10,6 +10,7 @@ namespace Ghis.Controls.Test.Magnifier; using Ghis.Controls.Test.Shared; using Microsoft.VisualStudio.TestTools.UnitTesting; +using Ghis.Controls.Magnifier; using System; using System.Collections.Generic; using System.Linq; @@ -18,6 +19,7 @@ namespace Ghis.Controls.Test.Magnifier; using System.Windows.Controls; using System.Windows.Media; using System.Windows.Media.Imaging; +using System.Windows.Media.Media3D; [TestClass] public class MagnifierTest @@ -26,14 +28,12 @@ public class MagnifierTest public void Show_Magnifier_InAction_Test() { var content = new UserControl(); - var urlString = @"pack://application:,,,/ Ghis.Controls;component/Assets/images/background.love.jpg"; - //content.Height = 400; - //content.Width = 400; - // Image Source = "pack://application:,,,/WPFDevelopers.Samples;component/Resources/Images/Craouse/0.jpg" + var urlString = @"pack://application:,,,/ Ghis.Controls;component/Assets/images/background.love.jpg"; var image = new Image() { Source = new BitmapImage(new Uri(urlString, UriKind.Absolute))}; - + image.Margin = new System.Windows.Thickness(10); content.Background = Brushes.AliceBlue; content.Content= image; + image.SetValue(Magnifier.AddProperty, Magnifier.Default); WpfInteraction.ShowDialog(content); } } diff --git a/Ghis.Controls/Assets/Magnifier.xaml b/Ghis.Controls/Assets/Magnifier.xaml new file mode 100644 index 0000000..b4ffc7b --- /dev/null +++ b/Ghis.Controls/Assets/Magnifier.xaml @@ -0,0 +1,51 @@ + + + + + + +