using ivf_tl_CustomControls;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace ivf_tl_Manage.UserControls
{
///
/// PicUserControl.xaml 的交互逻辑
///
public partial class PicUserControl : UserControl
{
public event Action SelectedPropertyChangedEevent;
public PicUserControl()
{
InitializeComponent();
}
public int SelectedNum
{
get { return (int)GetValue(SelectedNumProperty); }
set { SetValue(SelectedNumProperty, value); }
}
public static readonly DependencyProperty SelectedNumProperty =
DependencyProperty.Register("SelectedNum", typeof(int), typeof(PicUserControl), new PropertyMetadata(1));
public string ImageInfoString
{
get { return (string)GetValue(ImageInfoStringProperty); }
set { SetValue(ImageInfoStringProperty, value); }
}
public static readonly DependencyProperty ImageInfoStringProperty =
DependencyProperty.Register("ImageInfoString", typeof(string), typeof(PicUserControl), new PropertyMetadata(null));
public ImageSource ImageSourceUrl
{
get { return (ImageSource)GetValue(ImageSourceUrlProperty); }
set { SetValue(ImageSourceUrlProperty, value); }
}
public static readonly DependencyProperty ImageSourceUrlProperty =
DependencyProperty.Register("ImageSourceUrl", typeof(ImageSource), typeof(PicUserControl), new PropertyMetadata(null));
public bool IsSelected
{
get { return (bool)GetValue(IsSelectedProperty); }
set { SetValue(IsSelectedProperty, value); }
}
// Using a DependencyProperty as the backing store for IsSelected. This enables animation, styling, binding, etc...
public static readonly DependencyProperty IsSelectedProperty =
DependencyProperty.Register("IsSelected", typeof(bool), typeof(PicUserControl), new PropertyMetadata(false, new PropertyChangedCallback(IsSelectedPropertyChangedCallback)));
private static void IsSelectedPropertyChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
if (!(d is PicUserControl source)) return;
if (!(e.NewValue is bool newValue)) return;
source.SelectedPropertyChangedEevent?.Invoke(source, newValue);
}
}
}