wabbajack/Wabbajack/Views/Common/RadioButtonView.xaml.cs

48 lines
1.7 KiB
C#
Raw Normal View History

2019-11-21 14:25:40 +00:00
using System.Windows;
2019-11-10 06:39:40 +00:00
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media.Imaging;
namespace Wabbajack
{
/// <summary>
/// Interaction logic for ImageRadioButtonView.xaml
/// </summary>
public partial class ImageRadioButtonView : UserControl
{
public bool IsChecked
{
get => (bool)GetValue(IsCheckedProperty);
set => SetValue(IsCheckedProperty, value);
}
public static readonly DependencyProperty IsCheckedProperty = DependencyProperty.Register(nameof(IsChecked), typeof(bool), typeof(ImageRadioButtonView),
new FrameworkPropertyMetadata(default(bool), FrameworkPropertyMetadataOptions.BindsTwoWayByDefault));
public BitmapImage Image
{
get => (BitmapImage)GetValue(ImageProperty);
set => SetValue(ImageProperty, value);
}
public static readonly DependencyProperty ImageProperty = DependencyProperty.Register(nameof(Image), typeof(BitmapImage), typeof(ImageRadioButtonView),
new FrameworkPropertyMetadata(default(BitmapImage)));
public ICommand Command
{
get => (ICommand)GetValue(CommandProperty);
set => SetValue(CommandProperty, value);
}
public static readonly DependencyProperty CommandProperty = DependencyProperty.Register(nameof(Command), typeof(ICommand), typeof(ImageRadioButtonView),
new FrameworkPropertyMetadata(default(ICommand)));
public ImageRadioButtonView()
{
InitializeComponent();
}
private void Button_Click(object sender, RoutedEventArgs e)
{
2019-11-21 15:04:33 +00:00
IsChecked = true;
2019-11-10 06:39:40 +00:00
}
}
}