packages/MaterialDesignThemes.2.5.1/src/net45/SnackbarMessage.cs

(开头部分) 5KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.ComponentModel;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Input;
using MaterialDesignThemes.Wpf.Converters;

namespace MaterialDesignThemes.Wpf
{
    /// <summary>
    /// Defines the content of a message within a <see cref="Snackbar"/>.  Primary content should be set via the 
    /// standard <see cref="SnackbarMessage.Content"/> property.  Where an action is allowed, content
    /// can be provided in <see cref="SnackbarMessage.ActionContent"/>.  Standard button properties are 
    /// provided for actions, includiing <see cref="SnackbarMessage.ActionCommand"/>.
    /// </summary>
    [TypeConverter(typeof(SnackbarMessageTypeConverter))]
    [TemplatePart(Name = ActionButtonPartName, Type = typeof(ButtonBase))]
    public class SnackbarMessage : ContentControl
    {
        public const string ActionButtonPartName = "PART_ActionButton";
        private Action _templateCleanupAction = () => {};

        static SnackbarMessage()
        {
            DefaultStyleKeyProperty.OverrideMetadata(typeof(SnackbarMessage), new FrameworkPropertyMetadata(typeof(SnackbarMessage)));
        }

        public static readonly DependencyProperty ActionCommandProperty = DependencyProperty.Register(
            "ActionCommand", typeof(ICommand), typeof(SnackbarMessage), new PropertyMetadata(default(ICommand)));

        public ICommand ActionCommand
        {
            get { return (ICommand) GetValue(ActionCommandProperty); }
            set { SetValue(ActionCommandProperty, value); }
        }

        public static readonly DependencyProperty ActionCommandParameterProperty = DependencyProperty.Register(
            "ActionCommandParameter", typeof(object), typeof(SnackbarMessage), new PropertyMetadata(default(object)));

        public object ActionCommandParameter
        {
            get { return (object) GetValue(ActionCommandParameterProperty); }
            set { SetValue(ActionCommandParameterProperty, value); }
        }

        public static readonly DependencyProperty ActionContentProperty = DependencyProperty.Register(
            "ActionContent", typeof(object), typeof(SnackbarMessage), new PropertyMetadata(default(object)));

        public object ActionContent
        {
            get { return (object) GetValue(ActionContentProperty); }
            set { SetValue(ActionContentProperty, value); }
        }

        public static readonly DependencyProperty ActionContentTemplateProperty = DependencyProperty.Register(
            "ActionContentTemplate", typeof(DataTemplate), typeof(SnackbarMessage), new PropertyMetadata(default(DataTemplate)));

        public DataTemplate ActionContentTemplate
        {
后面还有 63 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。