diff --git a/WpfExtended.Test/App.xaml b/WpfExtended.Test/App.xaml
new file mode 100644
index 0000000..7034af2
--- /dev/null
+++ b/WpfExtended.Test/App.xaml
@@ -0,0 +1,9 @@
+
+
+
+
+
diff --git a/WpfExtended.Test/App.xaml.cs b/WpfExtended.Test/App.xaml.cs
new file mode 100644
index 0000000..c762bf3
--- /dev/null
+++ b/WpfExtended.Test/App.xaml.cs
@@ -0,0 +1,11 @@
+using System.Windows;
+
+namespace WpfExtended.Test
+{
+ ///
+ /// Interaction logic for App.xaml
+ ///
+ public partial class App : Application
+ {
+ }
+}
diff --git a/WpfExtended.Test/Images/Test.jpg b/WpfExtended.Test/Images/Test.jpg
new file mode 100644
index 0000000..8f3aae6
Binary files /dev/null and b/WpfExtended.Test/Images/Test.jpg differ
diff --git a/WpfExtended.Test/MainWindow.xaml b/WpfExtended.Test/MainWindow.xaml
new file mode 100644
index 0000000..3074aa3
--- /dev/null
+++ b/WpfExtended.Test/MainWindow.xaml
@@ -0,0 +1,12 @@
+
+
+
+
+
diff --git a/WpfExtended.Test/MainWindow.xaml.cs b/WpfExtended.Test/MainWindow.xaml.cs
new file mode 100644
index 0000000..896c245
--- /dev/null
+++ b/WpfExtended.Test/MainWindow.xaml.cs
@@ -0,0 +1,18 @@
+using System.Windows;
+using System.Windows.Media;
+
+namespace WpfExtended.Test
+{
+ ///
+ /// Interaction logic for MainWindow.xaml
+ ///
+ public partial class MainWindow : Window
+ {
+ public static DependencyProperty ImageSourceProperty =
+ DependencyProperty.Register(nameof(ImageSource), typeof(ImageSource), typeof(MainWindow));
+ public MainWindow()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/WpfExtended.Test/Utilities/TypeCrawler.cs b/WpfExtended.Test/Utilities/TypeCrawler.cs
new file mode 100644
index 0000000..7d71a7d
--- /dev/null
+++ b/WpfExtended.Test/Utilities/TypeCrawler.cs
@@ -0,0 +1,17 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Windows.Media.Effects;
+
+namespace WpfExtended.Tests.Utilities
+{
+ internal static class TypeCrawler
+ {
+ public static IEnumerable GetEffectTypes()
+ {
+ return AppDomain.CurrentDomain.GetAssemblies()
+ .SelectMany(a => a.GetTypes()
+ .Where(t => t.IsAssignableTo(typeof(T))));
+ }
+ }
+}
diff --git a/WpfExtended.Test/WpfExtended.Tests.csproj b/WpfExtended.Test/WpfExtended.Tests.csproj
new file mode 100644
index 0000000..6d01ce0
--- /dev/null
+++ b/WpfExtended.Test/WpfExtended.Tests.csproj
@@ -0,0 +1,15 @@
+
+
+
+ WinExe
+ net5.0-windows
+ true
+
+
+
+
+ PreserveNewest
+
+
+
+
diff --git a/WpfExtended.sln b/WpfExtended.sln
index cd79c8f..e66ed47 100644
--- a/WpfExtended.sln
+++ b/WpfExtended.sln
@@ -5,6 +5,8 @@ VisualStudioVersion = 16.0.30804.86
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WpfExtended", "WpfExtended\WpfExtended.csproj", "{E822AE0D-5EA1-4C61-A1DC-76CF73C8A524}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WpfExtended.Tests", "WpfExtended.Test\WpfExtended.Tests.csproj", "{48D2B8E6-F906-40D8-952E-B7B567D76A9B}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -15,6 +17,10 @@ Global
{E822AE0D-5EA1-4C61-A1DC-76CF73C8A524}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E822AE0D-5EA1-4C61-A1DC-76CF73C8A524}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E822AE0D-5EA1-4C61-A1DC-76CF73C8A524}.Release|Any CPU.Build.0 = Release|Any CPU
+ {48D2B8E6-F906-40D8-952E-B7B567D76A9B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {48D2B8E6-F906-40D8-952E-B7B567D76A9B}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {48D2B8E6-F906-40D8-952E-B7B567D76A9B}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {48D2B8E6-F906-40D8-952E-B7B567D76A9B}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/WpfExtended/Effects/BandedSwirl/BandedSwirlEffect.cs b/WpfExtended/Effects/BandedSwirl/BandedSwirlEffect.cs
index ddf97fa..4b5a471 100644
--- a/WpfExtended/Effects/BandedSwirl/BandedSwirlEffect.cs
+++ b/WpfExtended/Effects/BandedSwirl/BandedSwirlEffect.cs
@@ -3,12 +3,9 @@
// See http://www.microsoft.com/resources/sharedsource/licensingbasics/sharedsourcelicenses.mspx.
// All other rights reserved.
-using System.Windows;
-using System.Windows.Media;
using System.Windows.Media.Effects;
-using LiteWare.Wpf.ShaderEffects;
-namespace WpfExtended.Effects
+namespace System.Windows.Media.Extensions.Effects
{
#if SILVERLIGHT
using UIPropertyMetadata = System.Windows.PropertyMetadata;
diff --git a/WpfExtended/Effects/Bloom/BloomEffect.cs b/WpfExtended/Effects/Bloom/BloomEffect.cs
index db657fb..0132622 100644
--- a/WpfExtended/Effects/Bloom/BloomEffect.cs
+++ b/WpfExtended/Effects/Bloom/BloomEffect.cs
@@ -3,12 +3,9 @@
// See http://www.microsoft.com/resources/sharedsource/licensingbasics/sharedsourcelicenses.mspx.
// All other rights reserved.
-using LiteWare.Wpf.ShaderEffects;
-using System.Windows;
-using System.Windows.Media;
using System.Windows.Media.Effects;
-namespace WpfExtended.Effects
+namespace System.Windows.Media.Extensions.Effects
{
#if SILVERLIGHT
using UIPropertyMetadata = System.Windows.PropertyMetadata ;
diff --git a/WpfExtended/Effects/BrightExtract/BrightExtractEffect.cs b/WpfExtended/Effects/BrightExtract/BrightExtractEffect.cs
index 065b538..1ea248e 100644
--- a/WpfExtended/Effects/BrightExtract/BrightExtractEffect.cs
+++ b/WpfExtended/Effects/BrightExtract/BrightExtractEffect.cs
@@ -3,12 +3,9 @@
// See http://www.microsoft.com/resources/sharedsource/licensingbasics/sharedsourcelicenses.mspx.
// All other rights reserved.
-using LiteWare.Wpf.ShaderEffects;
-using System.Windows;
-using System.Windows.Media;
using System.Windows.Media.Effects;
-namespace WpfExtended.Effects
+namespace System.Windows.Media.Extensions.Effects
{
#if SILVERLIGHT
using UIPropertyMetadata = System.Windows.PropertyMetadata ;
diff --git a/WpfExtended/Effects/ColorKeyAlpha/ColorKeyAlphaEffect.cs b/WpfExtended/Effects/ColorKeyAlpha/ColorKeyAlphaEffect.cs
index 71762b6..a0c6a58 100644
--- a/WpfExtended/Effects/ColorKeyAlpha/ColorKeyAlphaEffect.cs
+++ b/WpfExtended/Effects/ColorKeyAlpha/ColorKeyAlphaEffect.cs
@@ -3,12 +3,9 @@
// See http://www.microsoft.com/resources/sharedsource/licensingbasics/sharedsourcelicenses.mspx.
// All other rights reserved.
-using System.Windows;
-using System.Windows.Media;
using System.Windows.Media.Effects;
-using LiteWare.Wpf.ShaderEffects;
-namespace WpfExtended.Effects
+namespace System.Windows.Media.Extensions.Effects
{
public class ColorKeyAlphaEffect : ShaderEffect
{
diff --git a/WpfExtended/Effects/ColorTone/ColorToneEffect.cs b/WpfExtended/Effects/ColorTone/ColorToneEffect.cs
index 5be22a1..fb1640f 100644
--- a/WpfExtended/Effects/ColorTone/ColorToneEffect.cs
+++ b/WpfExtended/Effects/ColorTone/ColorToneEffect.cs
@@ -3,12 +3,9 @@
// See http://www.microsoft.com/resources/sharedsource/licensingbasics/sharedsourcelicenses.mspx.
// All other rights reserved.
-using LiteWare.Wpf.ShaderEffects;
-using System.Windows;
-using System.Windows.Media;
using System.Windows.Media.Effects;
-namespace WpfExtended.Effects
+namespace System.Windows.Media.Extensions.Effects
{
#if SILVERLIGHT
using UIPropertyMetadata = System.Windows.PropertyMetadata ;
diff --git a/WpfExtended/Effects/ContrastAdjust/ContrastAdjustEffect.cs b/WpfExtended/Effects/ContrastAdjust/ContrastAdjustEffect.cs
index 0e11091..3802b55 100644
--- a/WpfExtended/Effects/ContrastAdjust/ContrastAdjustEffect.cs
+++ b/WpfExtended/Effects/ContrastAdjust/ContrastAdjustEffect.cs
@@ -3,12 +3,9 @@
// See http://www.microsoft.com/resources/sharedsource/licensingbasics/sharedsourcelicenses.mspx.
// All other rights reserved.
-using LiteWare.Wpf.ShaderEffects;
-using System.Windows;
-using System.Windows.Media;
using System.Windows.Media.Effects;
-namespace WpfExtended.Effects
+namespace System.Windows.Media.Extensions.Effects
{
#if SILVERLIGHT
using UIPropertyMetadata = System.Windows.PropertyMetadata ;
diff --git a/WpfExtended/Effects/DirectionalBlur/DirectionalBlurEffect.cs b/WpfExtended/Effects/DirectionalBlur/DirectionalBlurEffect.cs
index dec56a3..a9535a7 100644
--- a/WpfExtended/Effects/DirectionalBlur/DirectionalBlurEffect.cs
+++ b/WpfExtended/Effects/DirectionalBlur/DirectionalBlurEffect.cs
@@ -3,12 +3,9 @@
// See http://www.microsoft.com/resources/sharedsource/licensingbasics/sharedsourcelicenses.mspx.
// All other rights reserved.
-using LiteWare.Wpf.ShaderEffects;
-using System.Windows;
-using System.Windows.Media;
using System.Windows.Media.Effects;
-namespace WpfExtended.Effects
+namespace System.Windows.Media.Extensions.Effects
{
#if SILVERLIGHT
using UIPropertyMetadata = System.Windows.PropertyMetadata ;
diff --git a/WpfExtended/Effects/Embossed/EmbossedEffect.cs b/WpfExtended/Effects/Embossed/EmbossedEffect.cs
index 54cdf43..cdc2639 100644
--- a/WpfExtended/Effects/Embossed/EmbossedEffect.cs
+++ b/WpfExtended/Effects/Embossed/EmbossedEffect.cs
@@ -3,12 +3,9 @@
// See http://www.microsoft.com/resources/sharedsource/licensingbasics/sharedsourcelicenses.mspx.
// All other rights reserved.
-using LiteWare.Wpf.ShaderEffects;
-using System.Windows;
-using System.Windows.Media;
using System.Windows.Media.Effects;
-namespace WpfExtended.Effects
+namespace System.Windows.Media.Extensions.Effects
{
#if SILVERLIGHT
using UIPropertyMetadata = System.Windows.PropertyMetadata ;
diff --git a/WpfExtended/Effects/Gloom/GloomEffect.cs b/WpfExtended/Effects/Gloom/GloomEffect.cs
index a977ef5..4daa9f6 100644
--- a/WpfExtended/Effects/Gloom/GloomEffect.cs
+++ b/WpfExtended/Effects/Gloom/GloomEffect.cs
@@ -3,12 +3,9 @@
// See http://www.microsoft.com/resources/sharedsource/licensingbasics/sharedsourcelicenses.mspx.
// All other rights reserved.
-using LiteWare.Wpf.ShaderEffects;
-using System.Windows;
-using System.Windows.Media;
using System.Windows.Media.Effects;
-namespace WpfExtended.Effects
+namespace System.Windows.Media.Extensions.Effects
{
#if SILVERLIGHT
using UIPropertyMetadata = System.Windows.PropertyMetadata ;
diff --git a/WpfExtended/Effects/GrowablePoissonDisk/GrowablePoissonDiskEffect.cs b/WpfExtended/Effects/GrowablePoissonDisk/GrowablePoissonDiskEffect.cs
index a7fa25f..2833e70 100644
--- a/WpfExtended/Effects/GrowablePoissonDisk/GrowablePoissonDiskEffect.cs
+++ b/WpfExtended/Effects/GrowablePoissonDisk/GrowablePoissonDiskEffect.cs
@@ -3,12 +3,9 @@
// See http://www.microsoft.com/resources/sharedsource/licensingbasics/sharedsourcelicenses.mspx.
// All other rights reserved.
-using LiteWare.Wpf.ShaderEffects;
-using System.Windows;
-using System.Windows.Media;
using System.Windows.Media.Effects;
-namespace WpfExtended.Effects
+namespace System.Windows.Media.Extensions.Effects
{
#if SILVERLIGHT
using UIPropertyMetadata = System.Windows.PropertyMetadata ;
diff --git a/WpfExtended/Effects/InvertColor/InvertColorEffect.cs b/WpfExtended/Effects/InvertColor/InvertColorEffect.cs
index 13050d8..5501ec8 100644
--- a/WpfExtended/Effects/InvertColor/InvertColorEffect.cs
+++ b/WpfExtended/Effects/InvertColor/InvertColorEffect.cs
@@ -3,12 +3,9 @@
// See http://www.microsoft.com/resources/sharedsource/licensingbasics/sharedsourcelicenses.mspx.
// All other rights reserved.
-using System.Windows;
-using System.Windows.Media;
using System.Windows.Media.Effects;
-using LiteWare.Wpf.ShaderEffects;
-namespace WpfExtended.Effects
+namespace System.Windows.Media.Extensions.Effects
{
public class InvertColorEffect : ShaderEffect
{
diff --git a/WpfExtended/Effects/LightStreak/LightStreakEffect.cs b/WpfExtended/Effects/LightStreak/LightStreakEffect.cs
index c24df26..1366a5b 100644
--- a/WpfExtended/Effects/LightStreak/LightStreakEffect.cs
+++ b/WpfExtended/Effects/LightStreak/LightStreakEffect.cs
@@ -3,12 +3,9 @@
// See http://www.microsoft.com/resources/sharedsource/licensingbasics/sharedsourcelicenses.mspx.
// All other rights reserved.
-using LiteWare.Wpf.ShaderEffects;
-using System.Windows;
-using System.Windows.Media;
using System.Windows.Media.Effects;
-namespace WpfExtended.Effects
+namespace System.Windows.Media.Extensions.Effects
{
#if SILVERLIGHT
using UIPropertyMetadata = System.Windows.PropertyMetadata ;
diff --git a/WpfExtended/Effects/Magnify/MagnifyEffect.cs b/WpfExtended/Effects/Magnify/MagnifyEffect.cs
index 9150bd3..4fe3ab5 100644
--- a/WpfExtended/Effects/Magnify/MagnifyEffect.cs
+++ b/WpfExtended/Effects/Magnify/MagnifyEffect.cs
@@ -3,12 +3,9 @@
// See http://www.microsoft.com/resources/sharedsource/licensingbasics/sharedsourcelicenses.mspx.
// All other rights reserved.
-using System.Windows;
-using System.Windows.Media;
using System.Windows.Media.Effects;
-using LiteWare.Wpf.ShaderEffects;
-namespace WpfExtended.Effects
+namespace System.Windows.Media.Extensions.Effects
{
#if SILVERLIGHT
using UIPropertyMetadata = System.Windows.PropertyMetadata ;
diff --git a/WpfExtended/Effects/MonoChrome/MonochromeEffect.cs b/WpfExtended/Effects/MonoChrome/MonochromeEffect.cs
index 15010ef..2f17244 100644
--- a/WpfExtended/Effects/MonoChrome/MonochromeEffect.cs
+++ b/WpfExtended/Effects/MonoChrome/MonochromeEffect.cs
@@ -3,12 +3,9 @@
// See http://www.microsoft.com/resources/sharedsource/licensingbasics/sharedsourcelicenses.mspx.
// All other rights reserved.
-using System.Windows;
-using System.Windows.Media;
using System.Windows.Media.Effects;
-using LiteWare.Wpf.ShaderEffects;
-namespace WpfExtended.Effects
+namespace System.Windows.Media.Extensions.Effects
{
#if SILVERLIGHT
using UIPropertyMetadata = System.Windows.PropertyMetadata ;
diff --git a/WpfExtended/Effects/MotionBlur/MotionBlurEffect.cs b/WpfExtended/Effects/MotionBlur/MotionBlurEffect.cs
index 6869f94..eb1bbfc 100644
--- a/WpfExtended/Effects/MotionBlur/MotionBlurEffect.cs
+++ b/WpfExtended/Effects/MotionBlur/MotionBlurEffect.cs
@@ -20,11 +20,9 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
-using System.Windows;
-using System.Windows.Media;
using System.Windows.Media.Effects;
-namespace WpfExtended.Effects
+namespace System.Windows.Media.Extensions.Effects
{
public class MotionBlurEffect : ShaderEffect
{
diff --git a/WpfExtended/Effects/Negative/NegativeEffect.cs b/WpfExtended/Effects/Negative/NegativeEffect.cs
index d770174..d033d67 100644
--- a/WpfExtended/Effects/Negative/NegativeEffect.cs
+++ b/WpfExtended/Effects/Negative/NegativeEffect.cs
@@ -20,11 +20,9 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
-using System.Windows;
-using System.Windows.Media;
using System.Windows.Media.Effects;
-namespace WpfExtended.Effects
+namespace System.Windows.Media.Extensions.Effects
{
public class NegativeEffect : ShaderEffect
{
diff --git a/WpfExtended/Effects/Pinch/PinchEffect.cs b/WpfExtended/Effects/Pinch/PinchEffect.cs
index 7871a14..a987609 100644
--- a/WpfExtended/Effects/Pinch/PinchEffect.cs
+++ b/WpfExtended/Effects/Pinch/PinchEffect.cs
@@ -3,12 +3,9 @@
// See http://www.microsoft.com/resources/sharedsource/licensingbasics/sharedsourcelicenses.mspx.
// All other rights reserved.
-using LiteWare.Wpf.ShaderEffects;
-using System.Windows;
-using System.Windows.Media;
using System.Windows.Media.Effects;
-namespace WpfExtended.Effects
+namespace System.Windows.Media.Extensions.Effects
{
#if SILVERLIGHT
using UIPropertyMetadata = System.Windows.PropertyMetadata ;
diff --git a/WpfExtended/Effects/PixelShaderUtility.cs b/WpfExtended/Effects/PixelShaderUtility.cs
index 10ad8fc..5001028 100644
--- a/WpfExtended/Effects/PixelShaderUtility.cs
+++ b/WpfExtended/Effects/PixelShaderUtility.cs
@@ -23,7 +23,7 @@
using System;
using System.Windows.Media.Effects;
-namespace WpfExtended.Effects
+namespace System.Windows.Media.Extensions.Effects
{
internal static class PixelShaderUtility
{
diff --git a/WpfExtended/Effects/Pixelate/PixelateEffect.cs b/WpfExtended/Effects/Pixelate/PixelateEffect.cs
index d8663a8..d2ba2be 100644
--- a/WpfExtended/Effects/Pixelate/PixelateEffect.cs
+++ b/WpfExtended/Effects/Pixelate/PixelateEffect.cs
@@ -3,12 +3,9 @@
// See http://www.microsoft.com/resources/sharedsource/licensingbasics/sharedsourcelicenses.mspx.
// All other rights reserved.
-using LiteWare.Wpf.ShaderEffects;
-using System.Windows;
-using System.Windows.Media;
using System.Windows.Media.Effects;
-namespace WpfExtended.Effects
+namespace System.Windows.Media.Extensions.Effects
{
#if SILVERLIGHT
using UIPropertyMetadata = System.Windows.PropertyMetadata ;
diff --git a/WpfExtended/Effects/Ripple/RippleEffect.cs b/WpfExtended/Effects/Ripple/RippleEffect.cs
index 89aa115..cbc2ce7 100644
--- a/WpfExtended/Effects/Ripple/RippleEffect.cs
+++ b/WpfExtended/Effects/Ripple/RippleEffect.cs
@@ -3,11 +3,9 @@
// See http://www.microsoft.com/resources/sharedsource/licensingbasics/sharedsourcelicenses.mspx.
// All other rights reserved.
-using System.Windows;
-using System.Windows.Media;
using System.Windows.Media.Effects;
-namespace WpfExtended.Effects
+namespace System.Windows.Media.Extensions.Effects
{
#if SILVERLIGHT
using UIPropertyMetadata = System.Windows.PropertyMetadata ;
diff --git a/WpfExtended/Effects/Sharpen/SharpenEffect.cs b/WpfExtended/Effects/Sharpen/SharpenEffect.cs
index 031d883..0cf0c4b 100644
--- a/WpfExtended/Effects/Sharpen/SharpenEffect.cs
+++ b/WpfExtended/Effects/Sharpen/SharpenEffect.cs
@@ -3,11 +3,9 @@
// See http://www.microsoft.com/resources/sharedsource/licensingbasics/sharedsourcelicenses.mspx.
// All other rights reserved.
-using System.Windows;
-using System.Windows.Media;
using System.Windows.Media.Effects;
-namespace WpfExtended.Effects
+namespace System.Windows.Media.Extensions.Effects
{
#if SILVERLIGHT
using UIPropertyMetadata = System.Windows.PropertyMetadata ;
diff --git a/WpfExtended/Effects/SmoothMagnify/SmoothMagnifyEffect.cs b/WpfExtended/Effects/SmoothMagnify/SmoothMagnifyEffect.cs
index e2bbc02..ce2e90e 100644
--- a/WpfExtended/Effects/SmoothMagnify/SmoothMagnifyEffect.cs
+++ b/WpfExtended/Effects/SmoothMagnify/SmoothMagnifyEffect.cs
@@ -3,11 +3,9 @@
// See http://www.microsoft.com/resources/sharedsource/licensingbasics/sharedsourcelicenses.mspx.
// All other rights reserved.
-using System.Windows;
-using System.Windows.Media;
using System.Windows.Media.Effects;
-namespace WpfExtended.Effects
+namespace System.Windows.Media.Extensions.Effects
{
#if SILVERLIGHT
using UIPropertyMetadata = System.Windows.PropertyMetadata ;
diff --git a/WpfExtended/Effects/Swirl/SwirlEffect.cs b/WpfExtended/Effects/Swirl/SwirlEffect.cs
index 2d08327..c8ae7f1 100644
--- a/WpfExtended/Effects/Swirl/SwirlEffect.cs
+++ b/WpfExtended/Effects/Swirl/SwirlEffect.cs
@@ -3,12 +3,9 @@
// See http://www.microsoft.com/resources/sharedsource/licensingbasics/sharedsourcelicenses.mspx.
// All other rights reserved.
-using System;
-using System.Windows;
-using System.Windows.Media;
using System.Windows.Media.Effects;
-namespace WpfExtended.Effects
+namespace System.Windows.Media.Extensions.Effects
{
#if SILVERLIGHT
using UIPropertyMetadata = System.Windows.PropertyMetadata ;
diff --git a/WpfExtended/Effects/ToneMapping/ToneMappingEffect.cs b/WpfExtended/Effects/ToneMapping/ToneMappingEffect.cs
index 69c8452..095d6c0 100644
--- a/WpfExtended/Effects/ToneMapping/ToneMappingEffect.cs
+++ b/WpfExtended/Effects/ToneMapping/ToneMappingEffect.cs
@@ -3,11 +3,9 @@
// See http://www.microsoft.com/resources/sharedsource/licensingbasics/sharedsourcelicenses.mspx.
// All other rights reserved.
-using System.Windows;
-using System.Windows.Media;
using System.Windows.Media.Effects;
-namespace WpfExtended.Effects
+namespace System.Windows.Media.Extensions.Effects
{
#if SILVERLIGHT
using UIPropertyMetadata = System.Windows.PropertyMetadata ;
diff --git a/WpfExtended/Effects/ToonShader/ToonShaderEffect.cs b/WpfExtended/Effects/ToonShader/ToonShaderEffect.cs
index ceb9ec7..92ff493 100644
--- a/WpfExtended/Effects/ToonShader/ToonShaderEffect.cs
+++ b/WpfExtended/Effects/ToonShader/ToonShaderEffect.cs
@@ -3,11 +3,9 @@
// See http://www.microsoft.com/resources/sharedsource/licensingbasics/sharedsourcelicenses.mspx.
// All other rights reserved.
-using System.Windows;
-using System.Windows.Media;
using System.Windows.Media.Effects;
-namespace WpfExtended.Effects
+namespace System.Windows.Media.Extensions.Effects
{
public class ToonShaderEffect : ShaderEffect
{
diff --git a/WpfExtended/Effects/ZoomBlur/ZoomBlurEffect.cs b/WpfExtended/Effects/ZoomBlur/ZoomBlurEffect.cs
index 0e00b22..b6d1f87 100644
--- a/WpfExtended/Effects/ZoomBlur/ZoomBlurEffect.cs
+++ b/WpfExtended/Effects/ZoomBlur/ZoomBlurEffect.cs
@@ -20,11 +20,9 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
-using System.Windows;
-using System.Windows.Media;
using System.Windows.Media.Effects;
-namespace WpfExtended.Effects
+namespace System.Windows.Media.Extensions.Effects
{
public class ZoomBlurEffect : ShaderEffect
{
diff --git a/WpfExtended/Extensions/DependencyObjectExtensions.cs b/WpfExtended/Extensions/DependencyObjectExtensions.cs
new file mode 100644
index 0000000..690b3a0
--- /dev/null
+++ b/WpfExtended/Extensions/DependencyObjectExtensions.cs
@@ -0,0 +1,51 @@
+using System.Collections.Generic;
+using System.Windows.Media;
+
+namespace System.Windows.Extensions
+{
+ public static class DependencyObjectExtensions
+ {
+ public static T GetTypedValue(this DependencyObject dependencyObject, DependencyProperty dependencyProperty)
+ {
+ dependencyObject = dependencyObject ?? throw new ArgumentNullException(nameof(dependencyObject));
+
+ return (T)dependencyObject.GetValue(dependencyProperty);
+ }
+ public static void SetTypedValue(this DependencyObject dependencyObject, DependencyProperty dependencyProperty, T value)
+ {
+ dependencyObject = dependencyObject ?? throw new ArgumentNullException(nameof(dependencyObject));
+
+ dependencyObject.SetValue(dependencyProperty, value);
+ }
+ public static List FindVisualChildren(this DependencyObject obj) where T : DependencyObject
+ {
+ obj = obj ?? throw new ArgumentNullException(nameof(obj));
+
+ List children = new List();
+ for (int i = 0; i < VisualTreeHelper.GetChildrenCount(obj); i++)
+ {
+ var o = VisualTreeHelper.GetChild(obj, i);
+ if (o != null)
+ {
+ if (o is T t)
+ children.Add(t);
+
+ children.AddRange(FindVisualChildren(o)); // recursive
+ }
+ }
+ return children;
+ }
+ public static T FindUpVisualTree(this DependencyObject initial) where T : DependencyObject
+ {
+ initial = initial ?? throw new ArgumentNullException(nameof(initial));
+
+ DependencyObject current = initial;
+
+ while (current != null && current.GetType() != typeof(T))
+ {
+ current = VisualTreeHelper.GetParent(current);
+ }
+ return current as T;
+ }
+ }
+}
diff --git a/WpfExtended/Extensions/DependencyPropertyExtensions.cs b/WpfExtended/Extensions/DependencyPropertyExtensions.cs
new file mode 100644
index 0000000..acd3acc
--- /dev/null
+++ b/WpfExtended/Extensions/DependencyPropertyExtensions.cs
@@ -0,0 +1,12 @@
+using System.Windows;
+
+namespace System.Windows.Extensions
+{
+ public static class DependencyPropertyExtensions
+ {
+ public static DependencyProperty Register(string name, PropertyMetadata propertyMetadata = null)
+ {
+ return DependencyProperty.Register(name, typeof(TPropertyType), typeof(TOwnerType), propertyMetadata);
+ }
+ }
+}
diff --git a/WpfExtended/Extensions/FrameworkElementExtensions.cs b/WpfExtended/Extensions/FrameworkElementExtensions.cs
new file mode 100644
index 0000000..20d2efd
--- /dev/null
+++ b/WpfExtended/Extensions/FrameworkElementExtensions.cs
@@ -0,0 +1,48 @@
+using System;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+
+namespace System.Windows.Extensions
+{
+ public static class FrameworkElementExtensions
+ {
+ public static BitmapSource RenderBitmap(this FrameworkElement frameworkElement)
+ {
+ frameworkElement = frameworkElement ?? throw new ArgumentNullException(nameof(frameworkElement));
+
+ var source = PresentationSource.FromVisual(frameworkElement);
+ var dpix = 96 * source.CompositionTarget.TransformToDevice.M11;
+ var dpiy = 96 * source.CompositionTarget.TransformToDevice.M22;
+ var renderTargetBitmap = new RenderTargetBitmap((int)frameworkElement.ActualWidth, (int)frameworkElement.ActualHeight, dpix, dpiy, PixelFormats.Pbgra32);
+ renderTargetBitmap.Render(frameworkElement);
+ return renderTargetBitmap;
+ }
+
+ public static void RemoveParent(this FrameworkElement frameworkElement)
+ {
+ frameworkElement = frameworkElement ?? throw new ArgumentNullException(nameof(frameworkElement));
+
+ if (frameworkElement.Parent is null) return;
+
+ switch (frameworkElement.Parent)
+ {
+ case Panel panel:
+ panel.Children.Remove(frameworkElement);
+ break;
+ case Decorator decorator:
+ decorator.Child = null;
+ break;
+ case ContentPresenter presenter:
+ presenter.Content = null;
+ break;
+ case ContentControl contentControl:
+ contentControl.Content = null;
+ break;
+ default:
+ throw new InvalidOperationException($"Could not determine how to remove parent for parent type: {frameworkElement.Parent.GetType().Name}");
+ }
+ }
+ }
+}
diff --git a/WpfExtended/WpfExtended.csproj b/WpfExtended/WpfExtended.csproj
index 24c7cc5..e8ff8a8 100644
--- a/WpfExtended/WpfExtended.csproj
+++ b/WpfExtended/WpfExtended.csproj
@@ -9,6 +9,7 @@
0.1
Extension library for Windows Presentation Platform.
Alexandru Macocian
+ https://github.com/AlexMacocian/WpfExtended