master
editor 2 months ago
commit c18bd35fcd

@ -0,0 +1,51 @@
WPF使用MATERIALDESIGN弹窗DEMO
一、源码描述
WPF使用MaterialDesign弹窗demo
环境VS2022 WPF
二、功能介绍
运行后,点击左侧菜单可弹出提示出窗口,有动画效果,会遮蔽窗体。
三、注意事项
ctrl+F5运行即可。
作者: coderbest
如需获得该源码的视频、更新等更多资料请访问: https://www.51aspx.com/Code/PopUp
------------------------------------------------------------------------------------------------
源码服务专家
官网: https://www.51aspx.com
讨论圈: https://club.51aspx.com/
平台声明:
1.51Aspx平台上提供下载的资源为免费、共享、商业三类源码,其中免费和共享源码仅供个人学习和研究使用,商业源码请在相应的授权许可条件下使用;
2.51Aspx平台对提供下载的软件及其它资源不拥有任何权利,其版权归属源码合法拥有者所有;
3.著作权人发现本网站载有侵害其合法权益的内容或作品,请与我们联系( 登录官网与客服反馈或发送邮件到support@51Aspx.com
4.51Aspx平台不保证提供的下载资源的准确性、安全性和完整性;
友情提示:
一般数据库文件默认在 DB_51Aspx 文件夹下
默认账号密码一般均为51Aspx
关于源码使用常见问题及解决方案,请参阅: https://www.51aspx.com/Help

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/>
</startup>
</configuration>

@ -0,0 +1,15 @@
<Application x:Class="ScreenOverlayMessage.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:ScreenOverlayMessage"
StartupUri="MainWindow.xaml">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Dark.xaml" />
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Defaults.xaml" />
<ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Primary/MaterialDesignColor.Green.xaml" />
<ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Accent/MaterialDesignColor.Lime.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
namespace ScreenOverlayMessage
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{

@ -0,0 +1,15 @@
<Window x:Class="ScreenOverlayMessage.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:ScreenOverlayMessage"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
mc:Ignorable="d" Height="576" Width="1024" ResizeMode="NoResize" WindowStartupLocation="CenterScreen" WindowStyle="None" Background="#FF3E3E3E">
<Grid>
<materialDesign:DialogHost BorderBrush="{DynamicResource MaterialDesignDivider}">
<materialDesign:DialogHost.DialogContent>
<Grid Width="300" Height="150" HorizontalAlignment="Center">
<StackPanel Orientation="Horizontal" Margin="15">
<materialDesign:PackIcon Kind="Folder" Foreground="{StaticResource PrimaryHueMidBrush}" Width="50" Height="50"/>
<TextBlock Foreground="Gray" Width="200" Margin="15 5" TextWrapping="Wrap">

@ -0,0 +1,15 @@
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;

@ -0,0 +1,15 @@
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("ScreenOverlayMessage")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ScreenOverlayMessage")]
[assembly: AssemblyCopyright("Copyright © 2019")]

@ -0,0 +1,15 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace ScreenOverlayMessage.Properties {
using System;
/// <summary>

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...

@ -0,0 +1,15 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace ScreenOverlayMessage.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.8.0.0")]

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{2160402F-CCAA-4079-BCBF-3EB5F640224F}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>ScreenOverlayMessage</RootNamespace>
<AssemblyName>ScreenOverlayMessage</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="MaterialDesignColors" version="1.1.2" targetFramework="net461" />
<package id="MaterialDesignThemes" version="2.5.1" targetFramework="net461" />
</packages>

@ -0,0 +1,15 @@
using System;
using System.Diagnostics;
using System.Windows;
using System.Windows.Media.Animation;
using ControlzEx;
namespace MaterialDesignThemes.Wpf
{
[TemplatePart(Name = BadgeContainerPartName, Type = typeof(UIElement))]
public class Badged : BadgedEx
{
public static readonly DependencyProperty BadgeChangedStoryboardProperty = DependencyProperty.Register(
"BadgeChangedStoryboard", typeof(Storyboard), typeof(Badged), new PropertyMetadata(default(Storyboard)));
public Storyboard BadgeChangedStoryboard

@ -0,0 +1,9 @@
namespace MaterialDesignThemes.Wpf
{
public enum BaseTheme
{
Inherit,
Light,
Dark
}
}

@ -0,0 +1,15 @@
using System.Windows;
using System.Windows.Media;
namespace MaterialDesignThemes.Wpf
{
public static class ButtonProgressAssist
{
public static readonly DependencyProperty MinimumProperty = DependencyProperty.RegisterAttached(
"Minimum", typeof(double), typeof(ButtonProgressAssist), new FrameworkPropertyMetadata(default(double)));
public static void SetMinimum(DependencyObject element, double value)
{
element.SetValue(MinimumProperty, value);
}

@ -0,0 +1,15 @@
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
namespace MaterialDesignThemes.Wpf
{
/// <summary>
/// A card is a content control, styled according to Material Design guidelines.
/// </summary>
[TemplatePart(Name = ClipBorderPartName, Type = typeof(Border))]
public class Card : ContentControl
{
public const string ClipBorderPartName = "PART_ClipBorder";

@ -0,0 +1,15 @@
using System.ComponentModel;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Input;
using System.Windows.Media;
namespace MaterialDesignThemes.Wpf
{
[TemplatePart(Name = DeleteButtonPartName, Type = typeof(Button))]
public class Chip : ButtonBase
{
private ButtonBase _deleteButton;
public const string DeleteButtonPartName = "PART_DeleteButton";

@ -0,0 +1,15 @@
using MaterialDesignThemes.Wpf.Converters;
using MaterialDesignThemes.Wpf.Transitions;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Data;
using System.Windows.Input;
namespace MaterialDesignThemes.Wpf
{
public enum ClockDisplayMode
{

@ -0,0 +1,15 @@
using System.Windows;
namespace MaterialDesignThemes.Wpf
{
public delegate void ClockChoiceMadeEventHandler(object sender, ClockChoiceMadeEventArgs e);
public class ClockChoiceMadeEventArgs : RoutedEventArgs
{
private readonly ClockDisplayMode _displayMode;
public ClockChoiceMadeEventArgs(ClockDisplayMode displayMode)
{
_displayMode = displayMode;
}

@ -0,0 +1,15 @@
using System;
using System.Windows;
using System.Windows.Controls.Primitives;
using System.Windows.Input;
namespace MaterialDesignThemes.Wpf
{
[TemplatePart(Name = ThumbPartName, Type = typeof(Thumb))]
public class ClockItemButton : ToggleButton
{
public const string ThumbPartName = "PART_Thumb";
public static readonly DependencyProperty CentreXProperty = DependencyProperty.Register(
nameof(CentreX), typeof (double), typeof (ClockItemButton), new PropertyMetadata(default(double)));

@ -0,0 +1,15 @@
using System.Windows;
using System.Windows.Controls;
namespace MaterialDesignThemes.Wpf
{
public enum ColorZoneMode
{
Standard,
Inverted,
PrimaryLight,
PrimaryMid,
PrimaryDark,
Accent,
Light,
Dark

@ -0,0 +1,15 @@
using System.Windows;
namespace MaterialDesignThemes.Wpf
{
public static class ColorZoneAssist
{
public static readonly DependencyProperty ModeProperty = DependencyProperty.RegisterAttached(
"Mode", typeof(ColorZoneMode), typeof(ColorZoneAssist), new FrameworkPropertyMetadata(default(ColorZoneMode), FrameworkPropertyMetadataOptions.Inherits));
public static void SetMode(DependencyObject element, ColorZoneMode value)
{
element.SetValue(ModeProperty, value);
}
public static ColorZoneMode GetMode(DependencyObject element)

@ -0,0 +1,15 @@
using System.Windows;
namespace MaterialDesignThemes.Wpf
{
public static class ComboBoxAssist
{
/// <summary>
/// By default ComboBox uses the wrapper popup. Popup can be switched to classic Windows desktop view by means of this attached property.
/// </summary>
public static readonly DependencyProperty ClassicModeProperty = DependencyProperty.RegisterAttached(
"ClassicMode",
typeof (bool),
typeof (ComboBoxAssist),
new FrameworkPropertyMetadata(false,
FrameworkPropertyMetadataOptions.AffectsRender | FrameworkPropertyMetadataOptions.Inherits));

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Media;
namespace MaterialDesignThemes.Wpf
{
public enum ComboBoxPopupPlacement
{
Undefined,
Down,

@ -0,0 +1,15 @@
using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;
namespace MaterialDesignThemes.Wpf.Converters
{
public class BooleanToVisibilityConverter : IValueConverter
{
public Visibility TrueValue { get; set; } = Visibility.Visible;
public Visibility FalseValue { get; set; } = Visibility.Collapsed;
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
bool bValue = false;

@ -0,0 +1,15 @@
using System;
using System.Globalization;
using System.Windows.Data;
using System.Windows.Media;
namespace MaterialDesignThemes.Wpf.Converters
{
public class BrushRoundConverter : IValueConverter
{
public Brush HighValue { get; set; } = Brushes.White;
public Brush LowValue { get; set; } = Brushes.Black;
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{

@ -0,0 +1,15 @@
using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;
using System.Windows.Media;
namespace MaterialDesignThemes.Wpf.Converters
{
public class BrushToRadialGradientBrushConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
var solidColorBrush = value as SolidColorBrush;
if (solidColorBrush == null) return Binding.DoNothing;

@ -0,0 +1,15 @@
using System;
using System.Globalization;
using System.Windows.Data;
namespace MaterialDesignThemes.Wpf.Converters
{
/// <summary>
/// Help us format the content of a header button in a calendar.
/// </summary>
/// <remarks>
/// Expected items, in the following order:
/// 1) DateTime Calendar.DisplayDate
/// 2) DateTime? Calendar.SelectedDate
/// </remarks>
public class CalendarDateCoalesceConverter : IMultiValueConverter

@ -0,0 +1,15 @@
using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;
namespace MaterialDesignThemes.Wpf.Converters.CircularProgressBar
{
public class ArcEndPointConverter : IMultiValueConverter
{
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
{
var actualWidth = values[0].ExtractDouble();
var value = values[1].ExtractDouble();
var minimum = values[2].ExtractDouble();
var maximum = values[3].ExtractDouble();

@ -0,0 +1,15 @@
using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;
namespace MaterialDesignThemes.Wpf.Converters.CircularProgressBar
{
public class ArcSizeConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is double && ((double)value > 0.0))
{
return new Size((double)value / 2, (double)value / 2);
}

@ -0,0 +1,15 @@
using System;
using System.Globalization;
using System.Windows.Data;
namespace MaterialDesignThemes.Wpf.Converters.CircularProgressBar
{
public class LargeArcConverter : IMultiValueConverter
{
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
{
var value = values[0].ExtractDouble();
var minimum = values[1].ExtractDouble();
var maximum = values[2].ExtractDouble();
if (new[] { value, minimum, maximum }.AnyNan())

@ -0,0 +1,15 @@
using System.Collections.Generic;
using System.Linq;
namespace MaterialDesignThemes.Wpf.Converters.CircularProgressBar
{
internal static class LocalEx
{
public static double ExtractDouble(this object val)
{
var d = val as double? ?? double.NaN;
return double.IsInfinity(d) ? double.NaN : d;
}
public static bool AnyNan(this IEnumerable<double> vals)

@ -0,0 +1,15 @@
using System;
using System.Globalization;
using System.Windows.Data;
namespace MaterialDesignThemes.Wpf.Converters.CircularProgressBar
{
public class RotateTransformCentreConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
//value == actual width
return (double) value/2;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)

@ -0,0 +1,15 @@
using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;
namespace MaterialDesignThemes.Wpf.Converters.CircularProgressBar
{
public class StartPointConverter : IValueConverter
{
[Obsolete]
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is double && ((double) value > 0.0))
{
return new Point((double)value / 2, 0);

@ -0,0 +1,15 @@
using System;
using System.Globalization;
using System.Windows.Data;
namespace MaterialDesignThemes.Wpf.Converters
{
internal class ClockItemIsCheckedConverter : IValueConverter
{
private readonly Func<DateTime> _currentTimeGetter;
private readonly ClockDisplayMode _displayMode;
private readonly bool _is24Hours;
public ClockItemIsCheckedConverter(Func<DateTime> currentTimeGetter, ClockDisplayMode displayMode, bool is24Hours)
{
_currentTimeGetter = currentTimeGetter ?? throw new ArgumentNullException(nameof(currentTimeGetter));

@ -0,0 +1,15 @@
using System;
using System.Globalization;
using System.Windows.Data;
using System.Windows.Markup;
namespace MaterialDesignThemes.Wpf.Converters
{
public class ClockLineConverter : MarkupExtension, IValueConverter
{
public ClockDisplayMode DisplayMode { get; set; }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
var time = (DateTime) value;

@ -0,0 +1,15 @@
using System;
using System.Globalization;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
namespace MaterialDesignThemes.Wpf.Converters
{
public class DrawerOffsetConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
var d = value as double? ?? 0;
if (double.IsInfinity(d) || double.IsNaN(d)) d = 0;

@ -0,0 +1,15 @@
using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;
namespace MaterialDesignThemes.Wpf.Converters
{
public class EqualityToVisibilityConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value != null && value.Equals(parameter)) return Visibility.Visible;
return Visibility.Collapsed;
}

@ -0,0 +1,15 @@
using System;
using System.Globalization;
using System.Windows.Controls;
using System.Windows.Data;
namespace MaterialDesignThemes.Wpf.Converters
{
/// <summary>
/// Converter for <see cref="SmartHint"/> control. Can be extended by <see cref="HintProxyFabric.RegisterBuilder(Func{Control, bool}, Func{Control, IHintProxy})"/> method.
/// </summary>
public class HintProxyFabricConverter : IValueConverter
{
private static readonly Lazy<HintProxyFabricConverter> _instance = new Lazy<HintProxyFabricConverter>();
public static HintProxyFabricConverter Instance => _instance.Value;

@ -0,0 +1,15 @@
using System;
using System.Globalization;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
namespace MaterialDesignThemes.Wpf.Converters
{
/// <summary>
/// Helps coerce the correct item container style for a <see cref="ListView"/>, according to whether the list is displaying in standard mode, or using a <see cref="ListView.View"/>, such as a <see cref="GridView"/>.
/// </summary>
public class ListViewGridViewConverter : IValueConverter
{
/// <summary>
/// Item container style to use when <see cref="ListView.View"/> is <c>null</c>.

@ -0,0 +1,15 @@
using System;
using System.Globalization;
using System.Windows.Data;
namespace MaterialDesignThemes.Wpf.Converters
{
public enum MathOperation
{
Add,
Subtract,
Multiply,
Divide
}
public sealed class MathConverter : IValueConverter

@ -0,0 +1,15 @@
using System;
using System.Globalization;
using System.Windows.Data;
namespace MaterialDesignThemes.Wpf.Converters
{
public sealed class MathMultipleConverter : IMultiValueConverter
{
public MathOperation Operation { get; set; }
public object Convert(object[] value, Type targetType, object parameter, CultureInfo culture)
{
if (value == null || value.Length < 2 || value[0] == null || value[1] == null) return Binding.DoNothing;
if (!double.TryParse(value[0].ToString(), out double value1) || !double.TryParse(value[1].ToString(), out double value2))

@ -0,0 +1,15 @@
using System;
using System.Globalization;
using System.Windows.Data;
namespace MaterialDesignThemes.Wpf.Converters
{
public class NotConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return !(value as bool?) ?? !bool.Parse(value.ToString());
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{

@ -0,0 +1,15 @@
using System;
using System.Globalization;
using System.Windows.Data;
namespace MaterialDesignThemes.Wpf.Converters
{
public class NotZeroConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (double.TryParse((value ?? "").ToString(), out double val))
{
return Math.Abs(val) > 0.0;
}
return null;

@ -0,0 +1,15 @@
using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;
namespace MaterialDesignThemes.Wpf.Converters
{
public class NotZeroToVisibilityConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
double val;
double.TryParse((value ?? "").ToString(), out val);
return Math.Abs(val) > 0.0 ? Visibility.Visible : Visibility.Collapsed;

@ -0,0 +1,15 @@
using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;
namespace MaterialDesignThemes.Wpf.Converters
{
public class NullableToVisibilityConverter : IValueConverter
{
public Visibility NullValue { get; set; } = Visibility.Collapsed;
public Visibility NotNullValue { get; set; } = Visibility.Visible;
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return value == null ? NullValue : NotNullValue;

@ -0,0 +1,15 @@
using System;
using System.Globalization;
using System.Windows.Data;
namespace MaterialDesignThemes.Wpf.Converters
{
public class NullableDateTimeToCurrentDateConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is DateTime)
return value;
return DateTime.Now.Date;
}

@ -0,0 +1,15 @@
using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;
namespace MaterialDesignThemes.Wpf.Converters
{
public class PointValueConverter : IMultiValueConverter
{
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
{
if (values?.Length == 2 && values[0] != null && values[1] != null)
{
double x, y;
if (double.TryParse(values[0].ToString(), out x) &&

@ -0,0 +1,15 @@
using System;
using System.Globalization;
using System.Linq;
using System.Windows.Data;
namespace MaterialDesignThemes.Wpf.Converters
{
public class RangeLengthConverter : IMultiValueConverter
{
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
{
if (values == null || values.Length != 4 || values.Any(v => v == null))
return Binding.DoNothing;
if (!double.TryParse(values[0].ToString(), out double min)

@ -0,0 +1,15 @@
using System;
using System.Globalization;
using System.Linq;
using System.Windows.Data;
namespace MaterialDesignThemes.Wpf.Converters
{
public class RangePositionConverter : IMultiValueConverter
{
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
{
if(values == null || values.Length != 3 || values.Any(v => v == null))
return Binding.DoNothing;
if (!double.TryParse(values[0].ToString(), out double positionAsScaleFactor)

@ -0,0 +1,15 @@
using System;
using System.Globalization;
using System.Windows.Data;
using System.Windows.Media.Effects;
namespace MaterialDesignThemes.Wpf.Converters
{
public class ShadowConverter : IValueConverter
{
public static readonly ShadowConverter Instance = new ShadowConverter();
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (!(value is ShadowDepth)) return null;

@ -0,0 +1,15 @@
using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;
using System.Windows.Media;
using System.Windows.Media.Effects;
namespace MaterialDesignThemes.Wpf.Converters
{
public class ShadowEdgeConverter : IMultiValueConverter
{
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
{
if (values?.Length != 4)
{

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Windows;
using System.Windows.Media.Effects;
namespace MaterialDesignThemes.Wpf.Converters
{
internal static class ShadowInfo
{
private static readonly IDictionary<ShadowDepth, DropShadowEffect> ShadowsDictionary;
static ShadowInfo()
{
var resourceDictionary = new ResourceDictionary { Source = new Uri("pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Shadows.xaml", UriKind.Absolute) };

@ -0,0 +1,15 @@
using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;
namespace MaterialDesignThemes.Wpf.Converters
{
public class CardClipConverter : IMultiValueConverter
{
/// <summary>
/// 1 - Content presenter render size,
/// 2 - Clipping border padding (main control padding)
/// </summary>
/// <param name="values"></param>
/// <param name="targetType"></param>

@ -0,0 +1,15 @@
using System;
using System.ComponentModel;
using System.Globalization;
namespace MaterialDesignThemes.Wpf.Converters
{
public class SnackbarMessageTypeConverter : TypeConverter
{
public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
{
return sourceType == typeof(string) || base.CanConvertFrom(context, sourceType);
}
public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
{

@ -0,0 +1,15 @@
using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;
namespace MaterialDesignThemes.Wpf.Converters
{
public class TextFieldHintVisibilityConverter : IValueConverter
{
public Visibility IsEmptyValue { get; set; } = Visibility.Visible;
public Visibility IsNotEmptyValue { get; set; } = Visibility.Hidden;
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return string.IsNullOrEmpty((value ?? "").ToString()) ? IsEmptyValue : IsNotEmptyValue;

@ -0,0 +1,15 @@
using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;
using System.Windows.Markup;
namespace MaterialDesignThemes.Wpf.Converters
{
public class TimeToVisibilityConverter: MarkupExtension, IValueConverter
{
public override object ProvideValue(IServiceProvider serviceProvider)
{
return this;
}

@ -0,0 +1,15 @@
using System.Windows;
using System.Windows.Controls.Primitives;
namespace MaterialDesignThemes.Wpf
{
public static class CustomPopupPlacementCallbackHelper
{
public static readonly CustomPopupPlacementCallback LargePopupCallback;
static CustomPopupPlacementCallbackHelper()
{
LargePopupCallback =
(size, targetSize, offset) => new[] {new CustomPopupPlacement(new Point(), PopupPrimaryAxis.Horizontal)};
}
}

@ -0,0 +1,15 @@
using System;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Media3D;
namespace MaterialDesignThemes.Wpf
{
public static class DataGridAssist
{
private static DataGrid _suppressComboAutoDropDown;

@ -0,0 +1,15 @@
using System;
using System.Globalization;
using System.Linq;
namespace MaterialDesignThemes.Wpf
{
internal static class DateTimeEx
{
internal static DateTimeFormatInfo GetDateFormat(this CultureInfo culture)
{
if (culture == null) throw new ArgumentNullException(nameof(culture));
if (culture.Calendar is GregorianCalendar || culture.Calendar is PersianCalendar)
{
return culture.DateTimeFormat;

@ -0,0 +1,15 @@
using System;
using System.Windows;
namespace MaterialDesignThemes.Wpf
{
public class DialogClosingEventArgs : RoutedEventArgs
{
public DialogClosingEventArgs(DialogSession session, object parameter)
{
if (session == null) throw new ArgumentNullException(nameof(session));
Session = session;
Parameter = parameter;
}

@ -0,0 +1,4 @@
namespace MaterialDesignThemes.Wpf
{
public delegate void DialogClosingEventHandler(object sender, DialogClosingEventArgs eventArgs);
}

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Data;
using System.Windows.Input;
using System.Windows.Threading;
using MaterialDesignThemes.Wpf.Transitions;
namespace MaterialDesignThemes.Wpf
{
/// <summary>

@ -0,0 +1,15 @@
using System;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
namespace MaterialDesignThemes.Wpf
{
/// <summary>
/// Helper extensions for showing dialogs.
/// </summary>
public static class DialogHostEx
{
/// <summary>
/// Shows a dialog using the first found <see cref="DialogHost"/> in a given <see cref="Window"/>.
/// </summary>

@ -0,0 +1,15 @@
using System;
using System.Windows;
namespace MaterialDesignThemes.Wpf
{
public class DialogOpenedEventArgs : RoutedEventArgs
{
public DialogOpenedEventArgs(DialogSession session, RoutedEvent routedEvent)
{
if (session == null) throw new ArgumentNullException(nameof(session));
Session = session;
RoutedEvent = routedEvent;
}

@ -0,0 +1,4 @@
namespace MaterialDesignThemes.Wpf
{
public delegate void DialogOpenedEventHandler(object sender, DialogOpenedEventArgs eventArgs);
}

@ -0,0 +1,15 @@
using System;
using System.Windows.Threading;
namespace MaterialDesignThemes.Wpf
{
/// <summary>
/// Allows an open dialog to be managed. Use is only permitted during a single display operation.
/// </summary>
public class DialogSession
{
private readonly DialogHost _owner;
internal DialogSession(DialogHost owner)
{
_owner = owner ?? throw new ArgumentNullException(nameof(owner));

@ -0,0 +1,15 @@
using System.Reflection;
using System.Windows;
using System.Windows.Media;
namespace MaterialDesignThemes.Wpf
{
internal static class DpiHelper
{
private static readonly int DpiX;
private static readonly int DpiY;
private const double StandardDpiX = 96.0;
private const double StandardDpiY = 96.0;
static DpiHelper()

@ -0,0 +1,15 @@
using System;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media;
using MaterialDesignThemes.Wpf.Transitions;
using System.Collections.Generic;
namespace MaterialDesignThemes.Wpf
{
[TemplateVisualState(GroupName = TemplateAllDrawersGroupName, Name = TemplateAllDrawersAllClosedStateName)]
[TemplateVisualState(GroupName = TemplateAllDrawersGroupName, Name = TemplateAllDrawersAnyOpenStateName)]
[TemplateVisualState(GroupName = TemplateLeftDrawerGroupName, Name = TemplateLeftClosedStateName)]
[TemplateVisualState(GroupName = TemplateLeftDrawerGroupName, Name = TemplateLeftOpenStateName)]

@ -0,0 +1,15 @@
using System.Windows;
namespace MaterialDesignThemes.Wpf
{
public static class ExpanderAssist
{
public static readonly DependencyProperty LeftHeaderPaddingProperty =
DependencyProperty.RegisterAttached(
"LeftHeaderPadding", typeof(Thickness), typeof(ExpanderAssist),
new FrameworkPropertyMetadata(new Thickness(0, 0, 0, 0), FrameworkPropertyMetadataOptions.Inherits));
public static void SetLeftHeaderPadding(DependencyObject element, Thickness value)
{
element.SetValue(LeftHeaderPaddingProperty, value);
}

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows;
using System.Windows.Media;
namespace MaterialDesignThemes.Wpf
{
internal static class Extensions
{
public static IEnumerable<DependencyObject> VisualDepthFirstTraversal(this DependencyObject node)
{
if (node == null) throw new ArgumentNullException(nameof(node));
yield return node;

@ -0,0 +1,15 @@
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Threading;
namespace MaterialDesignThemes.Wpf
{
[TemplatePart(Name = Plane3DPartName, Type = typeof(Plane3D))]
[TemplateVisualState(GroupName = TemplateFlipGroupName, Name = TemplateFlippedStateName)]
[TemplateVisualState(GroupName = TemplateFlipGroupName, Name = TemplateUnflippedStateName)]
public class Flipper : Control
{
public static RoutedCommand FlipCommand = new RoutedCommand();

@ -0,0 +1,15 @@
using System.Windows;
using System.Windows.Media;
namespace MaterialDesignThemes.Wpf
{
public static class HintAssist
{
#region UseFloating
public static readonly DependencyProperty IsFloatingProperty = DependencyProperty.RegisterAttached(
"IsFloating",
typeof(bool),
typeof(HintAssist),
new FrameworkPropertyMetadata(default(bool), FrameworkPropertyMetadataOptions.Inherits));

@ -0,0 +1,15 @@
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
namespace MaterialDesignThemes.Wpf
{
public static partial class HintProxyFabric
{
private sealed class ComboBoxHintProxy : IHintProxy
{
private readonly ComboBox _comboBox;
private readonly TextChangedEventHandler _comboBoxTextChangedEventHandler;
public ComboBoxHintProxy(ComboBox comboBox)

@ -0,0 +1,15 @@
using System;
using System.Windows.Controls;
namespace MaterialDesignThemes.Wpf
{
public static partial class HintProxyFabric
{
private sealed class PasswordBoxHintProxy : IHintProxy
{
private readonly PasswordBox _passwordBox;
public bool IsEmpty() => string.IsNullOrEmpty(_passwordBox.Password);
public object Content => _passwordBox.Password;

@ -0,0 +1,15 @@
using System;
using System.Windows;
using System.Windows.Controls;
namespace MaterialDesignThemes.Wpf
{
public static partial class HintProxyFabric
{
private sealed class TextBoxHintProxy : IHintProxy
{
private readonly TextBox _textBox;
public object Content => _textBox.Text;
public bool IsLoaded => _textBox.IsLoaded;

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Controls;
namespace MaterialDesignThemes.Wpf
{
public static partial class HintProxyFabric
{
private sealed class HintProxyBuilder
{
private readonly Func<Control, bool> _canBuild;
private readonly Func<Control, IHintProxy> _build;
public HintProxyBuilder(Func<Control, bool> canBuild, Func<Control, IHintProxy> build)

@ -0,0 +1,15 @@
using System;
using System.Windows.Controls;
namespace MaterialDesignThemes.Wpf
{
/// <summary>
/// This interface is the adapter from UiControl (like <see cref="TextBox"/>, <see cref="ComboBox"/> and others) to <see cref="SmartHint"/>
/// <para/>
/// You should implement this interface in order to use SmartHint for your own control.
/// </summary>
public interface IHintProxy : IDisposable
{
/// <summary>
/// Checks to see if the targetted control can be deemed as logically
/// empty, even if not null, affecting the current hint display.

@ -0,0 +1,15 @@
using System;
namespace MaterialDesignThemes.Wpf
{
public interface ISnackbarMessageQueue
{
/// <summary>
/// Queues a notificaton message for display in a snackbar.
/// </summary>
/// <param name="content">Message.</param>
void Enqueue(object content);
/// <summary>
/// Queues a notificaton message for display in a snackbar.
/// </summary>

@ -0,0 +1,15 @@
using System.Windows;
using System.Windows.Controls;
namespace MaterialDesignThemes.Wpf
{
/// <summary>
/// Displays an icon image/path, according to the specified <see cref="Type"/> name.
/// </summary>
/// <remarks>
/// All icons sourced from Material Design Icons Font - <see cref="https://materialdesignicons.com/"/> - in accordance of
/// <see cref="https://github.com/Templarian/MaterialDesign/blob/master/license.txt"/>.
/// </remarks>
public class Icon : Control
{
public static readonly DependencyProperty TypeProperty = DependencyProperty.Register(

@ -0,0 +1,14 @@
namespace MaterialDesignThemes.Wpf
{
/// <summary>
/// List of available icons for use with <see cref="Icon"/>.
/// </summary>
/// <remarks>
/// All icons sourced from Material Design Icons Font - <see cref="https://materialdesignicons.com/"/> - in accordance of
/// <see cref="https://github.com/Templarian/MaterialDesign/blob/master/license.txt"/>.
/// </remarks>
public enum IconType
{
AutoGeneratedDoNotAmend
}
}

@ -0,0 +1,15 @@
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media;
namespace MaterialDesignThemes.Wpf
{
public static class ListBoxAssist
{
static ListBoxAssist()
{
EventManager.RegisterClassHandler(typeof (ListBox), UIElement.PreviewMouseLeftButtonDownEvent,
new MouseButtonEventHandler(ListBoxMouseButtonEvent));
}

@ -0,0 +1,15 @@
using System.ComponentModel;
using System.Windows;
using System.Windows.Controls;
namespace MaterialDesignThemes.Wpf
{
[TemplateVisualState(GroupName = DirectionGroupName, Name = NoneStateName)]
[TemplateVisualState(GroupName = DirectionGroupName, Name = AscendingStateName)]
[TemplateVisualState(GroupName = DirectionGroupName, Name = DescendingStateName)]
public class ListSortDirectionIndicator : Control
{
public const string DirectionGroupName = "Direction";
public const string NoneStateName = "None";
public const string AscendingStateName = "Ascending";
public const string DescendingStateName = "Descending";

@ -0,0 +1,15 @@
using System.Windows;
namespace MaterialDesignThemes.Wpf
{
public static class ListViewAssist
{
public static readonly DependencyProperty ListViewItemPaddingProperty = DependencyProperty.RegisterAttached(
"ListViewItemPadding",
typeof(Thickness),
typeof(ListViewAssist),
new FrameworkPropertyMetadata(new Thickness(8, 8, 8, 8), FrameworkPropertyMetadataOptions.Inherits));
public static void SetListViewItemPadding(DependencyObject element, Thickness value)
{
element.SetValue(ListViewItemPaddingProperty, value);

@ -0,0 +1,15 @@
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
namespace MaterialDesignThemes.Wpf
{
public class MaterialDataGridComboBoxColumn : DataGridComboBoxColumn //DataGridBoundColumn
{
static MaterialDataGridComboBoxColumn()
{
ElementStyleProperty.OverrideMetadata(typeof(MaterialDataGridComboBoxColumn), new FrameworkPropertyMetadata(DefaultElementStyle));
EditingElementStyleProperty.OverrideMetadata(typeof(MaterialDataGridComboBoxColumn), new FrameworkPropertyMetadata(DefaultEditingElementStyle));
}
public Binding ItemsSourceBinding { get; set; }

@ -0,0 +1,15 @@
using System.Windows;
using System.Windows.Controls;
namespace MaterialDesignThemes.Wpf
{
public class MaterialDataGridTextColumn : DataGridTextColumn
{
protected override object PrepareCellForEdit(FrameworkElement editingElement, RoutedEventArgs editingEventArgs)
{
var textBox = editingElement as TextBox;
if (textBox != null)
{
textBox.MaxLength = MaxLength;
textBox.SelectionStart = textBox.Text.Length;
}

@ -0,0 +1,15 @@
using System;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using Calendar = System.Windows.Controls.Calendar;
namespace MaterialDesignThemes.Wpf
{
public class MaterialDateDisplay : Control
{
static MaterialDateDisplay()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(MaterialDateDisplay), new FrameworkPropertyMetadata(typeof(MaterialDateDisplay)));
}

@ -0,0 +1,15 @@
using System;
using System.Windows.Markup;
namespace MaterialDesignThemes.Wpf
{
/// <summary>
/// Provides shorthand to initialise a new <see cref="SnackbarMessageQueue"/> for a <see cref="Snackbar"/>.
/// </summary>
[MarkupExtensionReturnType(typeof(SnackbarMessageQueue))]
public class MessageQueueExtension : MarkupExtension
{
public override object ProvideValue(IServiceProvider serviceProvider)
{
return new SnackbarMessageQueue();
}

@ -0,0 +1,15 @@
using System.Windows;
using ControlzEx;
namespace MaterialDesignThemes.Wpf
{
/// <summary>
/// Icon from the Material Design Icons project, <see cref="https://materialdesignicons.com/"/>.
/// </summary>
public class PackIcon : PackIconBase<PackIconKind>
{
static PackIcon()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(PackIcon), new FrameworkPropertyMetadata(typeof(PackIcon)));
}

File diff suppressed because one or more lines are too long

@ -0,0 +1,15 @@
using System;
using System.Windows.Markup;
namespace MaterialDesignThemes.Wpf
{
[MarkupExtensionReturnType(typeof(PackIcon))]
public class PackIconExtension : MarkupExtension
{
public PackIconExtension()
{ }
public PackIconExtension(PackIconKind kind)
{
Kind = kind;
}

@ -0,0 +1,15 @@
namespace MaterialDesignThemes.Wpf
{
/// ******************************************
/// This code is auto generated. Do not amend.
/// ******************************************
/// <summary>
/// List of available icons for use with <see cref="PackIcon" />.
/// </summary>
/// <remarks>
/// All icons sourced from Material Design Icons Font - <see cref="https://materialdesignicons.com/"/> - in accordance of
/// <see cref="https://github.com/Templarian/MaterialDesign/blob/master/license.txt"/>.
/// </remarks>
public enum PackIconKind
{

@ -0,0 +1,15 @@
using MaterialDesignColors;
namespace MaterialDesignThemes.Wpf
{
/// <summary>
/// Provides full information about a palette.
/// </summary>
public class Palette
{
public Palette(Swatch primarySwatch, Swatch accentSwatch, int primaryLightHueIndex, int primaryMidHueIndex, int primaryDarkHueIndex, int accentHueIndex)
{
PrimarySwatch = primarySwatch;
AccentSwatch = accentSwatch;
PrimaryLightHueIndex = primaryLightHueIndex;
PrimaryMidHueIndex = primaryMidHueIndex;

@ -0,0 +1,15 @@
using MaterialDesignColors;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using System.Windows;
using System.Windows.Media;
using System.Windows.Media.Animation;
namespace MaterialDesignThemes.Wpf
{
public class PaletteHelper
{
public virtual void SetLightDark(bool isDark)

@ -0,0 +1,15 @@
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Markup;
using System.Windows.Media;
using System.Windows.Media.Media3D;
namespace MaterialDesignThemes.Wpf
{
/// <summary>
/// View a control on a 3D plane.
/// </summary>
/// <remarks>
/// Taken from http://blogs.msdn.com/greg_schechter/archive/2007/10/26/enter-the-planerator-dead-simple-3d-in-wpf-with-a-stupid-name.aspx , Greg Schechter - Fall 2007
/// </remarks>

@ -0,0 +1,15 @@
using ControlzEx;
using System;
using System.ComponentModel;
using System.Linq;
using System.Runtime.InteropServices;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Input;
using System.Windows.Markup;
using System.Windows.Media;
using System.Windows.Media.Animation;
namespace MaterialDesignThemes.Wpf
{

@ -0,0 +1,15 @@
using System.Reflection;
using System.Runtime.InteropServices;
using System.Windows;
using System.Windows.Markup;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("MaterialDesignThemes.Wpf")]
[assembly: AssemblyDescription("Material Design in XAML Toolkit - WPF Themes")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Mulholland Software/James Willock")]
[assembly: AssemblyProduct("MaterialDesignColors.Wpf")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]

@ -0,0 +1,15 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.0
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace MaterialDesignThemes.Wpf.Properties {
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.

@ -0,0 +1,15 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.0
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace MaterialDesignThemes.Wpf.Properties
{
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]

@ -0,0 +1,15 @@
using System.Collections.ObjectModel;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
namespace MaterialDesignThemes.Wpf
{
/// <summary>
/// A custom control implementing a rating bar.
/// The icon aka content may be set as a DataTemplate via the ButtonContentTemplate property.
/// </summary>
public class RatingBar : Control
{
public static RoutedCommand SelectRatingCommand = new RoutedCommand();

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save