add ToggleButtonFlip Style

This commit is contained in:
NaBian committed 2019-06-14 23:07:32 +08:00
1 parent c195196d58
commit d26b4693c2
8 files changed
+232

No files matched your search

@@ -0,0 +1,58 @@
using System.Windows;
namespace HandyControl.Tools.Extension
{
public static class FrameworkElementExtension
{
public static double GetValidWidth(this FrameworkElement element)
{
if (!double.IsNaN(element.Width))
{
if (element.Width > 0)
{
return element.Width;
}
}
else
{
if (element.ActualWidth > 0)
{
return element.ActualWidth;
}
if (element.DesiredSize.Width > 0)
{
return element.DesiredSize.Width;
}
}
return 0;
}
public static double GetValidHeight(this FrameworkElement element)
{
if (!double.IsNaN(element.Height))
{
if (element.Height > 0)
{
return element.Height;
}
}
else
{
if (element.ActualHeight > 0)
{
return element.ActualHeight;
}
if (element.DesiredSize.Height > 0)
{
return element.DesiredSize.Height;
}
}
return 0;
}
}
}