ScreenToGif/Controls/AdornerControl.cs
(开头部分) 8KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using ScreenToGif.Util;
namespace ScreenToGif.Controls
{
/// <summary>
/// A content control that allows an adorner for the content to
/// be defined in XAML.
/// </summary>
public class AdornedControl : ContentControl
{
#region Dependency Properties
public static readonly DependencyProperty IsAdornerVisibleProperty = DependencyProperty.Register("IsAdornerVisible", typeof(bool), typeof(AdornedControl),
new FrameworkPropertyMetadata(IsAdornerVisible_PropertyChanged));
public static readonly DependencyProperty AdornerContentProperty = DependencyProperty.Register("AdornerContent", typeof(FrameworkElement), typeof(AdornedControl),
new FrameworkPropertyMetadata(AdornerContent_PropertyChanged));
public static readonly DependencyProperty HorizontalAdornerPlacementProperty = DependencyProperty.Register("HorizontalAdornerPlacement", typeof(AdornerPlacement), typeof(AdornedControl),
new FrameworkPropertyMetadata(AdornerPlacement.Inside));
public static readonly DependencyProperty VerticalAdornerPlacementProperty = DependencyProperty.Register("VerticalAdornerPlacement", typeof(AdornerPlacement), typeof(AdornedControl),
new FrameworkPropertyMetadata(AdornerPlacement.Inside));
public static readonly DependencyProperty AdornerOffsetXProperty = DependencyProperty.Register("AdornerOffsetX", typeof(double), typeof(AdornedControl));
public static readonly DependencyProperty AdornerOffsetYProperty = DependencyProperty.Register("AdornerOffsetY", typeof(double), typeof(AdornedControl));
#endregion Dependency Properties
#region Commands
public static readonly RoutedCommand ShowAdornerCommand = new RoutedCommand("ShowAdorner", typeof(AdornedControl));
public static readonly RoutedCommand HideAdornerCommand = new RoutedCommand("HideAdorner", typeof(AdornedControl));
#endregion Commands
static AdornedControl()
{
CommandManager.RegisterClassCommandBinding(typeof(AdornedControl), ShowAdornerCommandBinding);
CommandManager.RegisterClassCommandBinding(typeof(AdornedControl), HideAdornerCommandBinding);
}
public AdornedControl()
{
Focusable = false; // By default don't want 'AdornedControl' to be focusable.
DataContextChanged += AdornedControl_DataContextChanged;
}
/// <summary>
/// Event raised when the DataContext of the adorned control changes.
/// </summary>
private void AdornedControl_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e)
{
后面还有 206 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
