From b5dfc484fd206910fcf2cabeffcac5a20e8b81a2 Mon Sep 17 00:00:00 2001
From: NaBian <836904362@qq.com>
Date: Fri, 20 Jan 2023 14:48:37 +0800
Subject: [PATCH] chore: update ImageBrowser style.
---
.../Themes/Styles/Window.xaml | 2 +-
.../HandyControl_Net_40/Themes/Theme.xaml | 2 +-
.../Controls/Image/ImageViewer.cs | 25 +------------------
.../Themes/Styles/Window.xaml | 2 +-
.../HandyControl_Shared/Themes/Theme.xaml | 2 +-
5 files changed, 5 insertions(+), 28 deletions(-)
diff --git a/src/Net_40/HandyControl_Net_40/Themes/Styles/Window.xaml b/src/Net_40/HandyControl_Net_40/Themes/Styles/Window.xaml
index 3c0452319..e7119911f 100644
--- a/src/Net_40/HandyControl_Net_40/Themes/Styles/Window.xaml
+++ b/src/Net_40/HandyControl_Net_40/Themes/Styles/Window.xaml
@@ -315,7 +315,7 @@
-
+
diff --git a/src/Net_40/HandyControl_Net_40/Themes/Theme.xaml b/src/Net_40/HandyControl_Net_40/Themes/Theme.xaml
index f9114d092..f9cd79867 100644
--- a/src/Net_40/HandyControl_Net_40/Themes/Theme.xaml
+++ b/src/Net_40/HandyControl_Net_40/Themes/Theme.xaml
@@ -5037,7 +5037,7 @@
-
+
diff --git a/src/Shared/HandyControl_Shared/Controls/Image/ImageViewer.cs b/src/Shared/HandyControl_Shared/Controls/Image/ImageViewer.cs
index 7257403f9..a75951a6c 100644
--- a/src/Shared/HandyControl_Shared/Controls/Image/ImageViewer.cs
+++ b/src/Shared/HandyControl_Shared/Controls/Image/ImageViewer.cs
@@ -1,6 +1,5 @@
using System;
using System.ComponentModel;
-using System.Diagnostics;
using System.IO;
using System.Windows;
using System.Windows.Controls;
@@ -952,29 +951,7 @@ private void OnImageSourceChanged()
private static void OnUriChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
- var self = (ImageViewer) d;
-
- if (e.NewValue is Uri uri)
- {
- self.ImageSource = GetBitmapFrame(uri);
- self.Init();
- }
- else
- {
- self.ImageSource = null;
- }
-
- static BitmapFrame GetBitmapFrame(Uri source)
- {
- try
- {
- return BitmapFrame.Create(source);
- }
- catch
- {
- return null;
- }
- }
+ ((ImageViewer) d).OnUriChanged((Uri) e.NewValue);
}
private void OnUriChanged(Uri newValue)
diff --git a/src/Shared/HandyControl_Shared/Themes/Styles/Window.xaml b/src/Shared/HandyControl_Shared/Themes/Styles/Window.xaml
index 0deb0b91b..ef4082c95 100644
--- a/src/Shared/HandyControl_Shared/Themes/Styles/Window.xaml
+++ b/src/Shared/HandyControl_Shared/Themes/Styles/Window.xaml
@@ -313,7 +313,7 @@
-
+
diff --git a/src/Shared/HandyControl_Shared/Themes/Theme.xaml b/src/Shared/HandyControl_Shared/Themes/Theme.xaml
index aa03a18a2..04b36b5db 100644
--- a/src/Shared/HandyControl_Shared/Themes/Theme.xaml
+++ b/src/Shared/HandyControl_Shared/Themes/Theme.xaml
@@ -5036,7 +5036,7 @@
-
+