#if HAS_UWP
using Windows.UI.Xaml;
#elif HAS_WINUI
using Microsoft.UI.Xaml;
#else
using System.Windows;
#endif
namespace WxOrder.Framework.Commons.Dialogs
{
///
/// This class contains attached properties.
///
public class Dialog
{
///
/// Identifies the WindowStyle attached property.
///
///
/// This attached property is used to specify the style of a .
///
public static readonly DependencyProperty WindowStyleProperty =
DependencyProperty.RegisterAttached("WindowStyle", typeof(Style), typeof(Dialog), new PropertyMetadata(null));
///
/// Gets the value for the attached property.
///
/// The target element.
/// The attached to the element.
public static Style GetWindowStyle(DependencyObject obj)
{
return (Style)obj.GetValue(WindowStyleProperty);
}
///
/// Sets the attached property.
///
/// The target element.
/// The Style to attach.
public static void SetWindowStyle(DependencyObject obj, Style value)
{
obj.SetValue(WindowStyleProperty, value);
}
#if !HAS_UWP && !HAS_WINUI
///
/// Identifies the WindowStartupLocation attached property.
///
///
/// This attached property is used to specify the startup location of a .
///
public static readonly DependencyProperty WindowStartupLocationProperty =
DependencyProperty.RegisterAttached("WindowStartupLocation", typeof(WindowStartupLocation), typeof(Dialog), new UIPropertyMetadata(OnWindowStartupLocationChanged));
///
/// Gets the value for the attached property.
///
/// The target element.
/// The attached to the element.
public static WindowStartupLocation GetWindowStartupLocation(DependencyObject obj)
{
return (WindowStartupLocation)obj.GetValue(WindowStartupLocationProperty);
}
///
/// Sets the attached property.
///
/// The target element.
/// The WindowStartupLocation to attach.
public static void SetWindowStartupLocation(DependencyObject obj, WindowStartupLocation value)
{
obj.SetValue(WindowStartupLocationProperty, value);
}
private static void OnWindowStartupLocationChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
{
if (sender is Window window)
window.WindowStartupLocation = (WindowStartupLocation)e.NewValue;
}
#endif
}
}