diff --git a/docs/en/getting-started.md b/docs/en/getting-started.md
index 6a87eda4..e1e3160a 100644
--- a/docs/en/getting-started.md
+++ b/docs/en/getting-started.md
@@ -1,4 +1,4 @@
-# WPFDevelopers Getting Started
+# WPFDevelopers Getting Started
> Get started with WPFDevelopers controls in your WPF project in three steps.
@@ -73,7 +73,7 @@ Add the WD namespace and theme resources in `App.xaml`:
| Configuration | Effect |
|---------------|--------|
-| `` | Default Light theme, 4px control corner radius (follows system Light/Dark on Windows 10+) |
+| `` | Restores the previous theme mode; follows the system on first use, 4px control corner radius |
| `` | Fixed light theme, 4px corner radius |
| `` | Fixed dark theme, 4px corner radius |
| `` | Custom theme color, 4px corner radius |
@@ -82,6 +82,22 @@ Add the WD namespace and theme resources in `App.xaml`:
> **Important**: `wd:Resources` must be placed **after** `Theme.xaml` in MergedDictionaries, otherwise the theme will not load correctly.
+### High-DPI Border Clipping on Older .NET Framework Targets
+
+Applications targeting .NET Framework versions below 4.6 can clip borders when fixed-width controls combine `Margin` with `UseLayoutRounding` at scaling factors such as 125%. `PanelHelper.Spacing` adjusts the margins of direct children, so it can also trigger this behavior.
+
+Enable the layout-rounding fix introduced in .NET Framework 4.6 in the application's `App.config`, without removing `Width` or `Spacing`:
+
+```xml
+
+
+
+
+
+```
+
+If `AppContextSwitchOverrides` already exists, append this switch to its `value`, separated by a semicolon, rather than adding another element. The fix requires .NET Framework 4.6 or later at runtime and an application restart. On earlier runtimes, setting `UseLayoutRounding="False"` on the affected control is a local workaround.
+
---
## Step 3: Use Controls in XAML
@@ -414,6 +430,26 @@ The sample navigation identifies these implementations and composed effects with
### Windows & Navigation
+`wd:Window` includes a theme mode menu controlled by the `ShowTheme` dependency property (default: `False`):
+
+```xml
+
+
+
+```
+
+Supported in `Normal` and `High` title bars. Hovering opens a Follow system / Light mode / Dark mode popup; leaving both the entry and popup dismisses it. The entry icon reflects the selected mode, with a checkmark on the right of the selected row. Keyboard users can focus the entry and press Space to open, use Up/Down to navigate, Space to confirm, and Escape to dismiss. Actual light/dark changes retain the circular reveal animation. `TitleBarLayout` remains available for custom content. This property does not control the accent-color picker, and the button is hidden without a title bar.
+
+Read or set the user's preference through `ThemeManager.Instance.Resources.ThemeMode` (`System`, `Light`, or `Dark`). `Theme` / `IsDarkTheme` report the effective theme. System changes do not overwrite the System preference; setting the existing `ThemeType.Default` still enables following the system.
+
+Theme preferences are automatically saved to `HKEY_CURRENT_USER\Software\WPFDevelopers\Applications\` and restored on the next launch. The `ThemeMode` string value is `System` (follow system), `Light` (light mode), or `Dark` (dark mode). Each application stores its preference separately.
+
+Runtime verification (replace `net48` with `net40` for the .NET 4.0 build):
+
+```powershell
+powershell -NoProfile -STA -File .\tests\Window.Theme.SmokeTests.ps1 -AssemblyPath .\OutPut\net48\WPFDevelopers.dll
+```
+
| Control | Source | Example File | Description |
|---------|--------|-------------|-------------|
| `wd:Window` | NuGet | [MainWindow.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/MainWindow.xaml) | Custom window (ToolWindow / NoneTitleBar / Normal / HighTitleBar) |
@@ -754,6 +790,96 @@ MessageBox.Show("Operation successful!", "Info", MessageBoxButton.OK, MessageBox
---
+## Dialog
+
+`Dialog` displays custom forms or confirmation content using a `UserControl` or `Page`, with a mask, title, and confirm/cancel buttons.
+
+### Opening and validating input
+
+```csharp
+var editor = new UserEditor(); // Your custom UserControl
+var dialog = new WPFDevelopers.Controls.Dialog
+{
+ Title = "Edit user",
+ Content = editor,
+ Owner = this,
+ DialogWidth = 520
+};
+dialog.Closing += (sender, e) =>
+{
+ if (e.Reason == WPFDevelopers.Controls.DialogCloseReason.Confirm)
+ e.Cancel = !editor.Validate(); // Keep open when validation fails
+};
+if (await dialog.ShowAsync() == WPFDevelopers.Controls.DialogResult.Confirmed)
+{
+ Save(editor.DataContext);
+}
+```
+
+Implement `Validate()` and `Save()` in your application. Validate input in `Closing` when confirming, set `e.Cancel = true` to keep the dialog open, and display an error in the content. WPF binding validation errors also prevent confirmation automatically.
+
+### Common options
+
+| Property/method | Default | Description |
+|---|---|---|
+| `Content` | null | Required; a `UserControl` or `Page` not placed in another container |
+| `Title` | Empty string | Dialog title |
+| `CornerRadius` | `10` | Corner radius; use `new CornerRadius(0)` for square corners |
+| `Owner` | null | Parent window; finds the current window if omitted |
+| `DialogWidth` / `DialogHeight` | `440` / `double.NaN` | Width and height; `double.NaN` sizes automatically |
+| `ShowFooter` | true | Whether to show the footer buttons |
+| `ConfirmText` / `CancelText` | null | Button labels; follow language settings by default |
+| `IsConfirmEnabled` | true | Bindable confirmation button availability |
+| `IsOpen` | false | Two-way open state; false requests cancellation |
+| `ClosedCommand` | null | Runs after closure with a `DialogResult` parameter |
+| `ShowAsync(owner = null)` | — | Opens the dialog and awaits `Confirmed` or `Canceled` |
+| `Close(reason)` | `Cancel` | Requests closure, still running `Closing` validation |
+
+- Call on the UI thread. Only one dialog per owner is supported; do not change `Content` while open.
+- Cancel does not roll back ViewModel changes. Use a working copy if edits must be discarded.
+- Custom window templates need an `AdornerDecorator`. For a draggable independent window, use a custom `Window` with `MaskShowDialog()`.
+
+The example uses `await` (.NET 4.5+). On .NET 4.0 use the same API with a UI scheduler:
+
+```csharp
+dialog.ShowAsync().ContinueWith(task =>
+{
+ if (task.Result == WPFDevelopers.Controls.DialogResult.Confirmed)
+ Save(editor.DataContext);
+}, TaskScheduler.FromCurrentSynchronizationContext());
+```
+
+### MVVM
+
+Declare the dialog in `Resources`, not directly in the layout. Assign the ViewModel explicitly (`DialogViewModel` below is a previously declared resource):
+
+```xml
+
+
+
+
+
+```
+
+Reference the dialog's DataContext from the opening button:
+
+```xml
+
+```
+
+`OpenDialogCommand` sets `IsDialogOpen` to true; `CanConfirm` controls the confirm button. After closure, `DialogClosedCommand` receives `DialogResult.Confirmed` or `Canceled`.
+
+Full examples: [C# / MVVM](../../src/WPFDevelopers.Samples.Shared/ExampleViews/Dialog).
+
+---
+
## SplitButton Usage Tutorial
`SplitButton` is a split button control provided by WPFDevelopers. The left side is a clickable main button area, and the right side is a dropdown toggle button. It supports both text options and rich content options with icons.
diff --git a/docs/zh/getting-started.md b/docs/zh/getting-started.md
index 307a14b8..933c447b 100644
--- a/docs/zh/getting-started.md
+++ b/docs/zh/getting-started.md
@@ -1,4 +1,4 @@
-# WPFDevelopers 快速开始
+# WPFDevelopers 快速开始
> 三步即可在你的 WPF 项目中使用 WPFDevelopers 控件库
@@ -73,7 +73,7 @@ Install-Package WPFDevelopers
| 配置方式 | 效果 |
|----------|------|
-| `` | 默认 Light 主题,控件圆角 4px(Windows 10+ 跟随系统 Light/Dark 切换) |
+| `` | 恢复上次主题模式,首次使用跟随系统,控件圆角 4px |
| `` | 固定浅色主题,控件圆角 4px |
| `` | 固定深色主题,控件圆角 4px |
| `` | 自定义主题色,控件圆角 4px |
@@ -82,6 +82,23 @@ Install-Package WPFDevelopers
> **重要**:`wd:Resources` 必须放在 `Theme.xaml` 之后,否则主题无法正确加载。
+
+### 旧版 .NET Framework 的高 DPI 边框裁剪
+
+目标框架低于 .NET Framework 4.6 的应用,在 125% 等缩放比例下,启用 `UseLayoutRounding` 后,固定宽度控件配合 `Margin` 可能出现边框裁剪。`PanelHelper.Spacing` 通过修改直接子元素的 `Margin` 实现间距,因此也可能触发此问题。
+
+在应用的 `App.config` 中启用 .NET Framework 4.6 引入的布局取整修复,无需删除 `Width` 或 `Spacing`:
+
+```xml
+
+
+
+
+
+```
+
+如已有 `AppContextSwitchOverrides`,请将此开关以分号追加到现有 `value` 中,不要重复添加节点。该修复要求运行时为 .NET Framework 4.6 或更高,修改后需重新启动应用;更早的运行时可对受影响控件设置 `UseLayoutRounding="False"` 作为局部规避方案。
+
---
## 第三步:在 XAML 中使用控件
@@ -418,6 +435,26 @@ WD 提供了一套主题资源,可在 XAML 中引用:
### 窗口与导航
+`wd:Window` 内置主题模式菜单,通过依赖属性 `ShowTheme` 控制入口显示(默认 `False`):
+
+```xml
+
+
+
+```
+
+支持 `Normal` 和 `High` 标题栏;鼠标移入主题入口时展开“跟随系统 / 浅色模式 / 深色模式”弹层,移出入口和弹层后收起。入口图标随所选模式变化,选中项右侧显示对勾。键盘可聚焦入口并按空格打开,通过上下方向键选择、空格确认或 Esc 收起。实际明暗变化沿用圆形扩散动画。`TitleBarLayout` 仍可放置自定义内容;该属性不控制主题色调色板,无标题栏时不显示按钮。
+
+通过 `ThemeManager.Instance.Resources.ThemeMode` 获取或设置用户选择(`System`、`Light`、`Dark`),`Theme` / `IsDarkTheme` 表示实际显示的主题。“跟随系统”模式不会因系统明暗变化而变成固定模式;旧的 `ThemeType.Default` 设置仍可用于开启跟随系统。
+
+主题选择自动保存至 `HKEY_CURRENT_USER\Software\WPFDevelopers\Applications\<入口程序集名称>`,下次启动恢复。`ThemeMode` 字符串值:`System` 表示跟随系统,`Light` 表示浅色模式,`Dark` 表示深色模式;不同应用分别保存。
+
+运行时验证(将 `net48` 替换为 `net40` 可验证 .NET 4.0 版本):
+
+```powershell
+powershell -NoProfile -STA -File .\tests\Window.Theme.SmokeTests.ps1 -AssemblyPath .\OutPut\net48\WPFDevelopers.dll
+```
+
| 控件名 | 来源 | 示例文件 | 说明 |
|--------|------|----------|------|
| `wd:Window` | NuGet | [MainWindow.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/MainWindow.xaml) | 自定义窗体(ToolWindow/NoneTitleBar/Normal/HighTitleBar) |
@@ -482,6 +519,18 @@ WD 提供了一套主题资源,可在 XAML 中引用:
| `wd:SvgViewer` | NuGet | [SvgViewerExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/SvgViewerExample.xaml) | SVG 查看器 |
| `wd:OtpBox` | NuGet | [OtpBoxExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/OtpBoxExample.xaml) | OTP 验证码输入框(自动跳转/退格/粘贴) |
+`wd:NumericBox` 默认提供复制、粘贴、剪切右键菜单。设置 `ContextMenu` 可以替换默认菜单,内部输入框会通过 `TemplateBinding` 使用该菜单;设置 `ContextMenu="{x:Null}"` 可以禁用菜单。
+
+```xml
+
+
+
+
+
+
+
+```
+
### 加载动画
| 控件名 | 来源 | 示例文件 | 说明 |
@@ -774,6 +823,96 @@ MessageBox.Show("操作成功!", "提示", MessageBoxButton.OK, MessageBoxImag
---
+## Dialog 通用弹窗
+
+`Dialog` 用于显示自定义表单或确认内容,支持 `UserControl` 和 `Page`,自带遮罩、标题及确定/取消按钮。
+
+### 打开弹窗与输入校验
+
+```csharp
+var editor = new UserEditor(); // 自定义 UserControl
+var dialog = new WPFDevelopers.Controls.Dialog
+{
+ Title = "编辑用户",
+ Content = editor,
+ Owner = this,
+ DialogWidth = 520
+};
+dialog.Closing += (sender, e) =>
+{
+ if (e.Reason == WPFDevelopers.Controls.DialogCloseReason.Confirm)
+ e.Cancel = !editor.Validate(); // 业务校验失败时保持打开
+};
+if (await dialog.ShowAsync() == WPFDevelopers.Controls.DialogResult.Confirmed)
+{
+ Save(editor.DataContext);
+}
+```
+
+`Validate()` 和 `Save()` 为业务方法,需自行实现。点击确定时,在 `Closing` 中校验输入,设置 `e.Cancel = true` 即可保持弹窗打开,并在内容中显示错误提示。WPF 绑定校验错误也会自动阻止确认。
+
+### 常用配置
+
+| 属性/方法 | 默认值 | 说明 |
+|---|---|---|
+| `Content` | null | 必填,使用未放入其他容器的 `UserControl` 或 `Page` |
+| `Title` | 空字符串 | 标题 |
+| `CornerRadius` | `10` | 圆角,设为 `new CornerRadius(0)` 使用直角 |
+| `Owner` | null | 父窗口,未指定时自动查找当前窗口 |
+| `DialogWidth` / `DialogHeight` | `440` / `double.NaN` | 宽高,`double.NaN` 表示自适应 |
+| `ShowFooter` | true | 是否显示底部按钮 |
+| `ConfirmText` / `CancelText` | null | 按钮文本,默认跟随语言设置 |
+| `IsConfirmEnabled` | true | 可绑定确认按钮启用状态 |
+| `IsOpen` | false | 双向绑定打开状态,false 请求取消 |
+| `ClosedCommand` | null | 关闭后执行,参数为 `DialogResult` |
+| `ShowAsync(owner = null)` | — | 打开弹窗,等待关闭结果:`Confirmed` 或 `Canceled` |
+| `Close(reason)` | `Cancel` | 请求关闭,仍会触发 `Closing` 校验 |
+
+- 在 UI 线程调用;同一父窗口只支持一个弹窗,打开期间不要更换 `Content`。
+- 取消不会回滚已更新的 ViewModel;需要撤销编辑时,请使用数据副本。
+- 自定义窗口模板需包含 `AdornerDecorator`。需要可拖动的独立窗口时,使用自定义 `Window` 配合 `MaskShowDialog()`。
+
+上例使用 `await`(.NET 4.5+)。.NET 4.0 使用同一个 API,通过 UI 线程调度器处理结果:
+
+```csharp
+dialog.ShowAsync().ContinueWith(task =>
+{
+ if (task.Result == WPFDevelopers.Controls.DialogResult.Confirmed)
+ Save(editor.DataContext);
+}, TaskScheduler.FromCurrentSynchronizationContext());
+```
+
+### MVVM
+
+将 Dialog 声明在 `Resources` 中,不要直接放入布局。显式指定 ViewModel(下例的 `DialogViewModel` 为已声明的资源):
+
+```xml
+
+
+
+
+
+```
+
+打开按钮引用该 Dialog 的 DataContext:
+
+```xml
+
+```
+
+`OpenDialogCommand` 将 `IsDialogOpen` 设为 true;`CanConfirm` 控制确定按钮是否可用。关闭后,`DialogClosedCommand` 接收 `DialogResult.Confirmed` 或 `Canceled`。
+
+完整示例:[C# / MVVM](../../src/WPFDevelopers.Samples.Shared/ExampleViews/Dialog)。
+
+---
+
## SplitButton 分割按钮使用教程
`SplitButton` 是 WPFDevelopers 提供的分割按钮控件,左侧为可点击的主按钮区域,右侧为下拉菜单切换按钮,支持文本选项和带图标的富内容选项。
diff --git a/src/WPFDevelopers.Net40/Styles/Styles.TreeView.xaml b/src/WPFDevelopers.Net40/Styles/Styles.TreeView.xaml
index 3f96ec23..16b3413d 100644
--- a/src/WPFDevelopers.Net40/Styles/Styles.TreeView.xaml
+++ b/src/WPFDevelopers.Net40/Styles/Styles.TreeView.xaml
@@ -20,6 +20,7 @@
+
@@ -44,9 +45,25 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/WPFDevelopers.Net40/Themes/Generic.xaml b/src/WPFDevelopers.Net40/Themes/Generic.xaml
index d8cef5bf..887c40c8 100644
--- a/src/WPFDevelopers.Net40/Themes/Generic.xaml
+++ b/src/WPFDevelopers.Net40/Themes/Generic.xaml
@@ -36,13 +36,13 @@
Grid.Row="0"
HorizontalAlignment="Stretch"
Background="{TemplateBinding TitleBackground}" />
-
-
+
+
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
-
-
+
+
+
+
+
-
-
+
+
+
+
+
+
+
-
-
-
-
-
+
@@ -325,4 +238,4 @@
-
\ No newline at end of file
+
diff --git a/src/WPFDevelopers.Net40/Window.cs b/src/WPFDevelopers.Net40/Window.cs
index 137189ee..56e71493 100644
--- a/src/WPFDevelopers.Net40/Window.cs
+++ b/src/WPFDevelopers.Net40/Window.cs
@@ -1,13 +1,15 @@
-using Microsoft.Windows.Shell;
+using Microsoft.Windows.Shell;
using System;
using System.Runtime.InteropServices;
using System.Windows;
using System.Windows.Automation.Peers;
using System.Windows.Automation.Provider;
using System.Windows.Controls;
+using System.Windows.Controls.Primitives;
using System.Windows.Input;
using System.Windows.Interop;
using System.Windows.Media;
+using System.Windows.Threading;
using WPFDevelopers.Controls;
using WPFDevelopers.Core.Helpers;
using WPFDevelopers.Helpers;
@@ -15,25 +17,31 @@
namespace WPFDevelopers.Net40
{
[TemplatePart(Name = TitleBarIcon, Type = typeof(Button))]
- [TemplatePart(Name = HighTitleMaximizeButton, Type = typeof(Button))]
- [TemplatePart(Name = HighTitleRestoreButton, Type = typeof(Button))]
[TemplatePart(Name = TitleBarMaximizeButton, Type = typeof(Button))]
[TemplatePart(Name = TitleBarRestoreButton, Type = typeof(Button))]
+ [TemplatePart(Name = TitleBarThemeSwitchButton, Type = typeof(Button))]
+ [TemplatePart(Name = ThemePopup, Type = typeof(Popup))]
+ [TemplatePart(Name = ThemeItems, Type = typeof(StackPanel))]
public class Window : System.Windows.Window
{
private const string TitleBarIcon = "PART_TitleBarIcon";
- private const string HighTitleMaximizeButton = "PART_MaximizeButton";
- private const string HighTitleRestoreButton = "PART_RestoreButton";
private const string TitleBarMaximizeButton = "PART_TitleBarMaximizeButton";
private const string TitleBarRestoreButton = "PART_TitleBarRestoreButton";
+ private const string TitleBarThemeSwitchButton = "PART_TitleBarThemeSwitchButton";
+ private const string ThemePopup = "PART_ThemePopup";
+ private const string ThemeItems = "PART_ThemeItems";
+ private Button _titleBarThemeSwitchButton;
private WindowStyle _windowStyle;
private Button _titleBarIcon;
- private Button _highTitleMaximizeButton;
- private Button _highTitleRestoreButton;
private Button _titleBarMaximizeButton;
private Button _titleBarRestoreButton;
private IntPtr hWnd;
private WindowChrome _windowChrome;
+ private Popup _themePopup;
+ private UIElement _themePopupChild;
+ private StackPanel _themeItems;
+ private DispatcherTimer _themeCloseTimer;
+ private Resources _themeResources;
[StructLayout(LayoutKind.Sequential)]
struct NCCALCSIZE_PARAMS
@@ -65,6 +73,9 @@ struct RECT
public static readonly DependencyProperty TitleBarLayoutProperty =
DependencyProperty.Register("TitleBarLayout", typeof(object), typeof(Window), new PropertyMetadata(null));
+ public static readonly DependencyProperty ShowThemeProperty =
+ DependencyProperty.Register("ShowTheme", typeof(bool), typeof(Window), new PropertyMetadata(false));
+
static Window()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(Window), new FrameworkPropertyMetadata(typeof(Window)));
@@ -90,14 +101,49 @@ public Window()
private void Resources_ThemeChanged(ThemeType currentTheme)
{
- var isDark = currentTheme == ThemeType.Dark ? true : false;
+ var isDark = currentTheme == ThemeType.Dark;
var source = (HwndSource)PresentationSource.FromVisual(this);
Win32.EnableDarkModeForWindow(source, isDark);
}
+ protected override void OnTemplateChanged(ControlTemplate oldTemplate, ControlTemplate newTemplate)
+ {
+ DetachThemeSwitchButtons();
+ base.OnTemplateChanged(oldTemplate, newTemplate);
+ }
+
public override void OnApplyTemplate()
{
+ DetachThemeSwitchButtons();
base.OnApplyTemplate();
+ _titleBarThemeSwitchButton = GetTemplateChild(TitleBarThemeSwitchButton) as Button;
+ if (_titleBarThemeSwitchButton != null)
+ {
+ _titleBarThemeSwitchButton.Click += ThemeSwitchButton_Click;
+ _themePopup = GetTemplateChild(ThemePopup) as Popup;
+ _themeItems = GetTemplateChild(ThemeItems) as StackPanel;
+ if (_themePopup == null || _themeItems == null)
+ throw new InvalidOperationException("The window template requires PART_ThemePopup and PART_ThemeItems.");
+
+ _themePopup.PlacementTarget = _titleBarThemeSwitchButton;
+ _themePopupChild = _themePopup.Child as UIElement;
+ _themeCloseTimer = new DispatcherTimer { Interval = TimeSpan.FromMilliseconds(150) };
+ _themeCloseTimer.Tick += ThemeCloseTimer_Tick;
+ _titleBarThemeSwitchButton.MouseEnter += ThemeMenu_MouseEnter;
+ _titleBarThemeSwitchButton.MouseLeave += ThemeMenu_MouseLeave;
+ _titleBarThemeSwitchButton.IsVisibleChanged += ThemeSwitchButton_VisibilityChanged;
+ _titleBarThemeSwitchButton.IsEnabledChanged += ThemeSwitchButton_VisibilityChanged;
+ if (_themePopupChild != null)
+ {
+ _themePopupChild.MouseEnter += ThemeMenu_MouseEnter;
+ _themePopupChild.MouseLeave += ThemeMenu_MouseLeave;
+ }
+ _themeItems.AddHandler(ButtonBase.ClickEvent, new RoutedEventHandler(ThemeItem_Click));
+ _themeResources = ThemeManager.Instance.Resources;
+ _themeResources.ThemeModeChanged += ThemeMode_Changed;
+ Deactivated += ThemeWindow_Deactivated;
+ ThemeMode_Changed(_themeResources.ThemeMode);
+ }
_windowStyle = WindowStyle;
_titleBarIcon = GetTemplateChild(TitleBarIcon) as Button;
if (_titleBarIcon != null)
@@ -105,13 +151,108 @@ public override void OnApplyTemplate()
_titleBarIcon.MouseDoubleClick -= Icon_MouseDoubleClick;
_titleBarIcon.MouseDoubleClick += Icon_MouseDoubleClick;
}
- _highTitleMaximizeButton = GetTemplateChild(HighTitleMaximizeButton) as Button;
- _highTitleRestoreButton = GetTemplateChild(HighTitleRestoreButton) as Button;
_titleBarMaximizeButton = GetTemplateChild(TitleBarMaximizeButton) as Button;
_titleBarRestoreButton = GetTemplateChild(TitleBarRestoreButton) as Button;
SetTitleHeight();
}
+ private void DetachThemeSwitchButtons()
+ {
+ if (_themeCloseTimer != null)
+ {
+ _themeCloseTimer.Stop();
+ _themeCloseTimer.Tick -= ThemeCloseTimer_Tick;
+ _themeCloseTimer = null;
+ }
+ CloseThemePopup();
+ if (_themeItems != null)
+ _themeItems.RemoveHandler(ButtonBase.ClickEvent, new RoutedEventHandler(ThemeItem_Click));
+ if (_themePopupChild != null)
+ {
+ _themePopupChild.MouseEnter -= ThemeMenu_MouseEnter;
+ _themePopupChild.MouseLeave -= ThemeMenu_MouseLeave;
+ _themePopupChild = null;
+ }
+ if (_titleBarThemeSwitchButton != null)
+ {
+ _titleBarThemeSwitchButton.Click -= ThemeSwitchButton_Click;
+ _titleBarThemeSwitchButton.MouseEnter -= ThemeMenu_MouseEnter;
+ _titleBarThemeSwitchButton.MouseLeave -= ThemeMenu_MouseLeave;
+ _titleBarThemeSwitchButton.IsVisibleChanged -= ThemeSwitchButton_VisibilityChanged;
+ _titleBarThemeSwitchButton.IsEnabledChanged -= ThemeSwitchButton_VisibilityChanged;
+ }
+ if (_themeResources != null)
+ {
+ _themeResources.ThemeModeChanged -= ThemeMode_Changed;
+ _themeResources = null;
+ }
+ Deactivated -= ThemeWindow_Deactivated;
+ _themePopup = null;
+ _themeItems = null;
+ }
+
+ private void ThemeSwitchButton_Click(object sender, RoutedEventArgs e)
+ {
+ if (_themePopup != null)
+ _themePopup.IsOpen = true;
+ }
+
+ private void ThemeMenu_MouseEnter(object sender, System.Windows.Input.MouseEventArgs e)
+ {
+ _themeCloseTimer?.Stop();
+ if (sender == _titleBarThemeSwitchButton && _themePopup != null)
+ _themePopup.IsOpen = true;
+ }
+
+ private void ThemeMenu_MouseLeave(object sender, System.Windows.Input.MouseEventArgs e)
+ {
+ _themeCloseTimer?.Start();
+ }
+
+ private void ThemeSwitchButton_VisibilityChanged(object sender, DependencyPropertyChangedEventArgs e)
+ {
+ if (!_titleBarThemeSwitchButton.IsVisible || !_titleBarThemeSwitchButton.IsEnabled)
+ CloseThemePopup();
+ }
+
+ private void ThemeWindow_Deactivated(object sender, EventArgs e)
+ {
+ CloseThemePopup();
+ }
+
+ private void ThemeCloseTimer_Tick(object sender, EventArgs e)
+ {
+ _themeCloseTimer.Stop();
+ if (_titleBarThemeSwitchButton.IsMouseOver || (_themePopupChild != null && _themePopupChild.IsMouseOver))
+ return;
+ _themePopup.IsOpen = false;
+ }
+
+ private void CloseThemePopup()
+ {
+ _themeCloseTimer?.Stop();
+ if (_themePopup != null)
+ _themePopup.IsOpen = false;
+ }
+
+ private void ThemeItem_Click(object sender, RoutedEventArgs e)
+ {
+ var item = e.OriginalSource as ToggleButton;
+ if (item == null)
+ return;
+
+ CloseThemePopup();
+ ThemeManager.Instance.SwitchThemeMode(_titleBarThemeSwitchButton, (ThemeMode)item.Tag);
+ e.Handled = true;
+ }
+
+ private void ThemeMode_Changed(ThemeMode mode)
+ {
+ _titleBarThemeSwitchButton.SetCurrentValue(FrameworkElement.TagProperty, mode);
+ foreach (ToggleButton item in _themeItems.Children)
+ item.IsChecked = (ThemeMode)item.Tag == mode;
+ }
+
private static void OnTitleBarModeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var ctrl = d as Window;
@@ -138,7 +279,7 @@ void SetTitleHeight()
private void Icon_MouseDoubleClick(object sender, MouseButtonEventArgs e)
{
- if (e.ChangedButton == MouseButton.Left)
+ if (TitleBarMode == TitleBarMode.Normal && e.ChangedButton == MouseButton.Left)
Close();
}
@@ -172,6 +313,12 @@ public object TitleBarLayout
set => SetValue(TitleBarLayoutProperty, value);
}
+ public bool ShowTheme
+ {
+ get => (bool)GetValue(ShowThemeProperty);
+ set => SetValue(ShowThemeProperty, value);
+ }
+
protected override void OnInitialized(EventArgs e)
{
base.OnInitialized(e);
@@ -187,7 +334,7 @@ protected override void OnSourceInitialized(EventArgs e)
source.AddHook(WindowProc);
var resources = ThemeManager.Instance.Resources;
if (resources != null)
- Win32.EnableDarkModeForWindow(source, resources.Theme == ThemeType.Dark);
+ Win32.EnableDarkModeForWindow(source, resources.IsDarkTheme);
}
protected override void OnContentRendered(EventArgs e)
@@ -199,6 +346,7 @@ protected override void OnContentRendered(EventArgs e)
protected override void OnClosed(EventArgs e)
{
+ DetachThemeSwitchButtons();
WPFDevelopers.Resources.ThemeChanged -= Resources_ThemeChanged;
base.OnClosed(e);
}
@@ -272,22 +420,20 @@ private IntPtr WindowProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, re
case WindowsMessageCodes.WM_NCHITTEST:
if (OSVersionHelper.IsSnapLayoutSupported() && ResizeMode != ResizeMode.NoResize && ResizeMode != ResizeMode.CanMinimize)
{
- var button = TitleBarMode == TitleBarMode.Normal
- ? (WindowState != WindowState.Maximized ? _titleBarMaximizeButton : _titleBarRestoreButton)
- : (WindowState != WindowState.Maximized ? _highTitleMaximizeButton : _highTitleRestoreButton);
+ var button = WindowState != WindowState.Maximized ? _titleBarMaximizeButton : _titleBarRestoreButton;
if (button != null)
{
- var contentPresenter = button.Template.FindName("PART_ContentPresenter", button) as ContentPresenter;
- if (contentPresenter != null)
+ bool isOverButton = IsPointOverButton(button, lParam);
+ if (isOverButton)
{
- bool isOverButton = IsPointOverButton(button, lParam);
- contentPresenter.Opacity = isOverButton ? 1 : 0.7;
- if (isOverButton)
- {
- handled = true;
- return new IntPtr(OSVersionHelper.HTMAXBUTTON);
- }
+ button.SetCurrentValue(
+ Button.BackgroundProperty,
+ (Brush)button.FindResource("WD.WindowCaptionButtonHoverBrush"));
+ handled = true;
+ return new IntPtr(OSVersionHelper.HTMAXBUTTON);
}
+
+ button.ClearValue(Button.BackgroundProperty);
}
}
break;
@@ -298,9 +444,7 @@ private IntPtr WindowProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, re
&&
ResizeMode != ResizeMode.CanMinimize))
{
- Button button = TitleBarMode == TitleBarMode.Normal
- ? (WindowState != WindowState.Maximized ? _titleBarMaximizeButton : _titleBarRestoreButton)
- : (WindowState != WindowState.Maximized ? _highTitleMaximizeButton : _highTitleRestoreButton);
+ Button button = WindowState != WindowState.Maximized ? _titleBarMaximizeButton : _titleBarRestoreButton;
if (button != null)
{
if (IsPointOverButton(button, lParam))
diff --git a/src/WPFDevelopers.Net45x/Themes/Generic.xaml b/src/WPFDevelopers.Net45x/Themes/Generic.xaml
index bac95a41..77189bf9 100644
--- a/src/WPFDevelopers.Net45x/Themes/Generic.xaml
+++ b/src/WPFDevelopers.Net45x/Themes/Generic.xaml
@@ -38,13 +38,13 @@
Grid.Row="0"
HorizontalAlignment="Stretch"
Background="{TemplateBinding TitleBackground}" />
-
-
+
+
-
+
+
-
-
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
-
-
+
+
+
+
+
-
-
+
+
+
+
+
+
+
-
-
@@ -311,12 +195,10 @@
-
-
-
+
diff --git a/src/WPFDevelopers.Net45x/Themes/Theme.xaml b/src/WPFDevelopers.Net45x/Themes/Theme.xaml
index c7b39b33..a9cb8927 100644
--- a/src/WPFDevelopers.Net45x/Themes/Theme.xaml
+++ b/src/WPFDevelopers.Net45x/Themes/Theme.xaml
@@ -35,6 +35,9 @@
Normal
Normal
M384 690l452-452 60 60-512 512-238-238 60-60z
+ M12 2a10 10 0 1 0 10 10A7 7 0 0 1 12 2Z
+ M2 5H7 M11 5H22 M2 12H13 M17 12H22 M2 19H5 M9 19H22 M9 3A2 2 0 1 1 9 7A2 2 0 1 1 9 3 M15 10A2 2 0 1 1 15 14A2 2 0 1 1 15 10 M7 17A2 2 0 1 1 7 21A2 2 0 1 1 7 17
+ M12 19a7 7 0 1 1 0-14 7 7 0 0 1 0 14Zm0-1.5a5.5 5.5 0 1 0 0-11 5.5 5.5 0 1 0 0 11Zm-5.657.157a.75.75 0 0 1 0 1.06l-1.768 1.768a.749.749 0 0 1-1.275-.326.749.749 0 0 1 .215-.734l1.767-1.768a.75.75 0 0 1 1.061 0ZM3.515 3.515a.75.75 0 0 1 1.06 0l1.768 1.768a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215L3.515 4.575a.75.75 0 0 1 0-1.06ZM12 0a.75.75 0 0 1 .75.75v2.5a.75.75 0 0 1-1.5 0V.75A.75.75 0 0 1 12 0ZM4 12a.75.75 0 0 1-.75.75H.75a.75.75 0 0 1 0-1.5h2.5A.75.75 0 0 1 4 12Zm8 8a.75.75 0 0 1 .75.75v2.5a.75.75 0 0 1-1.5 0v-2.5A.75.75 0 0 1 12 20Zm12-8a.75.75 0 0 1-.75.75h-2.5a.75.75 0 0 1 0-1.5h2.5A.75.75 0 0 1 24 12Zm-6.343 5.657a.75.75 0 0 1 1.06 0l1.768 1.768a.751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018l-1.768-1.767a.75.75 0 0 1 0-1.061Zm2.828-14.142a.75.75 0 0 1 0 1.06l-1.768 1.768a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l1.767-1.768a.75.75 0 0 1 1.061 0Z
M 998 352 C 998 344 994 335 988 329 L 938 279 C 932 273 924 269 915 269 C 907 269 898 273 892 279 L 499 672 L 106 279 C 100 273 91 269 83 269 C 75 269 66 273 60 279 L 10 329 C 4 335 0 344 0 352 C 0 360 4 369 10 375 L 476 841 C 482 847 491 851 499 851 C 507 851 516 847 522 841 L 988 375 C 994 369 998 360 998 352 Z
M8.1772461,11.029181 L10.433105,
@@ -146,6 +149,7 @@
+
@@ -685,36 +689,102 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
-
-
+
@@ -920,15 +855,15 @@
-
-
-
+
+
+
+
-
-
-
+
+
@@ -938,7 +873,7 @@
-
+
@@ -950,7 +885,7 @@
-
+
@@ -974,21 +909,23 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -1005,28 +942,33 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -1325,7 +1267,7 @@
-
diff --git a/src/WPFDevelopers.Samples.Shared/ExampleViews/Window/NormalWindow.xaml b/src/WPFDevelopers.Samples.Shared/ExampleViews/Window/NormalWindow.xaml
index 65cd4871..6e6ba562 100644
--- a/src/WPFDevelopers.Samples.Shared/ExampleViews/Window/NormalWindow.xaml
+++ b/src/WPFDevelopers.Samples.Shared/ExampleViews/Window/NormalWindow.xaml
@@ -10,6 +10,7 @@
Width="710"
Height="520"
Icon="pack://application:,,,/WPFDevelopers.Samples;component/WPFDevelopers.ico"
+ ShowTheme="True"
WindowStartupLocation="CenterScreen"
mc:Ignorable="d">
@@ -17,7 +18,7 @@
+ Text="ShowTheme: Light / Dark" />
diff --git a/src/WPFDevelopers.Samples.Shared/ExampleViews/Window/NormalWindow.xaml.cs b/src/WPFDevelopers.Samples.Shared/ExampleViews/Window/NormalWindow.xaml.cs
index 5673fc64..e864a6a9 100644
--- a/src/WPFDevelopers.Samples.Shared/ExampleViews/Window/NormalWindow.xaml.cs
+++ b/src/WPFDevelopers.Samples.Shared/ExampleViews/Window/NormalWindow.xaml.cs
@@ -9,6 +9,6 @@ public partial class NormalWindow
public NormalWindow()
{
InitializeComponent();
- }
+ }
}
}
\ No newline at end of file
diff --git a/src/WPFDevelopers.Samples.Shared/ExampleViews/Window/WindowExample.xaml b/src/WPFDevelopers.Samples.Shared/ExampleViews/Window/WindowExample.xaml
index 9dc82f30..81eed71d 100644
--- a/src/WPFDevelopers.Samples.Shared/ExampleViews/Window/WindowExample.xaml
+++ b/src/WPFDevelopers.Samples.Shared/ExampleViews/Window/WindowExample.xaml
@@ -11,40 +11,125 @@
d:DesignWidth="800"
mc:Ignorable="d">
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
diff --git a/src/WPFDevelopers.Samples.Shared/Helpers/MenuEnum.cs b/src/WPFDevelopers.Samples.Shared/Helpers/MenuEnum.cs
index 8cd13dc7..fb34c726 100644
--- a/src/WPFDevelopers.Samples.Shared/Helpers/MenuEnum.cs
+++ b/src/WPFDevelopers.Samples.Shared/Helpers/MenuEnum.cs
@@ -34,7 +34,6 @@ public enum MenuEnum
CardCarousel,
FocusCarousel,
Pagination,
- ScrollViewer,
Flame,
ScreenCut,
TransitionPanel,
@@ -107,6 +106,7 @@ public enum MenuEnum
ScrollNavigation,
WaterfallPanel,
Timeline,
+ Dialog,
VirtualizingWrapPanel,
AcrylicBlur,
Theme,
@@ -130,6 +130,7 @@ public enum MenuEnum
ListBox,
ListView,
TreeView,
+ ScrollViewer,
Expander,
GroupBox,
TabControl,
diff --git a/src/WPFDevelopers.Samples.Shared/Helpers/MenuNameLocalizer.cs b/src/WPFDevelopers.Samples.Shared/Helpers/MenuNameLocalizer.cs
index 3e2d5d35..e4215d5b 100644
--- a/src/WPFDevelopers.Samples.Shared/Helpers/MenuNameLocalizer.cs
+++ b/src/WPFDevelopers.Samples.Shared/Helpers/MenuNameLocalizer.cs
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
-using System.Globalization;
namespace WPFDevelopers.Samples.Helpers
{
@@ -12,6 +11,7 @@ internal static class MenuNameLocalizer
[MenuEnum.UsageGuide] = "使用指南",
[MenuEnum.UsageColor] = "色彩指南",
[MenuEnum.MessageBox] = "消息框",
+ [MenuEnum.Dialog] = "对话框",
[MenuEnum.NotifyIcon] = "托盘图标",
[MenuEnum.PanningItems] = "平移列表",
[MenuEnum.BreatheLight] = "呼吸灯",
@@ -71,7 +71,7 @@ internal static class MenuNameLocalizer
[MenuEnum.Magnifier] = "放大镜",
[MenuEnum.Step] = "步骤条",
[MenuEnum.MultiSelectComboBox] = "多选下拉框(带搜索)",
- [MenuEnum.Mask] = "遮罩",
+ [MenuEnum.Mask] = "遮罩与窗口遮罩",
[MenuEnum.Loading] = "加载动画",
[MenuEnum.Selector] = "列表定位",
//[MenuEnum.MultiSelectSearchComboBox] = "示例多选下拉框",
@@ -137,17 +137,18 @@ internal static class MenuNameLocalizer
[MenuEnum.TaskbarInfo] = "任务栏信息"
};
- public static string GetDisplayName(string name, CultureInfo culture)
+ public static string GetDisplayName(string name)
{
if (name == "持续更新中")
- return culture.TwoLetterISOLanguageName == "zh" ? name : "More updates coming";
+ return SampleLanguageManager.Instance.TranslateText(name);
- if (culture.TwoLetterISOLanguageName != "zh" ||
- !Enum.TryParse(name, out MenuEnum menu) ||
+ if (!Enum.TryParse(name, out MenuEnum menu) ||
!ChineseNames.TryGetValue(menu, out var chineseName))
+ {
return name;
+ }
- return chineseName;
+ return SampleLanguageManager.Instance.TranslateText(chineseName);
}
}
}
diff --git a/src/WPFDevelopers.Samples.Shared/Languages/SamplesLanguage.en-US.resx b/src/WPFDevelopers.Samples.Shared/Languages/SamplesLanguage.en-US.resx
new file mode 100644
index 00000000..3b695f35
--- /dev/null
+++ b/src/WPFDevelopers.Samples.Shared/Languages/SamplesLanguage.en-US.resx
@@ -0,0 +1,2514 @@
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ After installing the NuGet package, add the theme and wd:Resources in App.xaml, then browse controls and sample source from the left menu.
+
+
+ Button style --
+
+
+ Hold to boost~ meow (゜-゜)つロ
+
+
+ Save
+
+
+ Save image
+
+
+ Background color --
+
+
+ Background image --
+
+
+ This page creates one sample icon, separate from the main window icon. It is removed when you leave, so revisiting will not create duplicates.
+
+
+ Identifier --
+
+
+ Title bar --
+
+
+ Title bar toolbar
+
+
+ Standard
+
+
+ Standard ContextMenu
+
+
+ Standard map
+
+
+ Standard audio quality
+
+
+ Play/Pause
+
+
+ Playback
+
+
+ Hide button group
+
+
+ Crop area ratio:
+
+
+ Action feedback
+
+
+ Vehicle track
+
+
+ The drawer slides in from the bottom; click the overlay to close it.
+
+
+ The drawer slides in from the top; click the overlay to close it.
+
+
+ The drawer slides in from the right; click the overlay to close it.
+
+
+ The drawer slides in from the left; click the overlay to close it.
+
+
+ Trigger --
+
+
+ Window style --
+
+
+ Window overlay
+
+
+ Window shake
+
+
+ Create sample icon
+
+
+ The Radius property also controls control corner rounding (default is 4 on Windows 11).
+
+
+ Error
+
+
+ Open the Avalonia AtomGit repository
+
+
+ Open the Avalonia Gitee repository
+
+
+ Open the Avalonia GitHub repository
+
+
+ Open the Avalonia NuGet package
+
+
+ Open the WPF AtomGit repository
+
+
+ Open the WPF Gitee repository
+
+
+ Open the WPF GitHub repository
+
+
+ Open the WPF NuGet package
+
+
+ Open tall title bar window
+
+
+ Open tool window
+
+
+ Open feature demo
+
+
+ Open standard window
+
+
+ Open custom title bar window
+
+
+ 大话西游之大圣娶亲
+
+
+ Code
+
+
+ Source repository
+
+
+ Use when the UI thread is blocked
+
+
+ Currently running control library version
+
+
+ Export
+
+
+ Import
+
+
+ Road
+
+
+ Map click
+
+
+ Map controls
+
+
+ Map source
+
+
+ Map overview
+
+
+ Log in
+
+
+ Log in
+
+
+ Log-in/sign-up button --
+
+
+ Log-in button --
+
+
+ Waiting for action.
+
+
+ Basemap style
+
+
+ Section 2: Client area --
+
+
+ Section 1: Title bar --
+
+
+ Point
+
+
+ By clicking “Sign up,” you confirm that you have read and agree to
+
+
+ Click a label to open the project in your browser.
+
+
+ Click the map to get coordinates
+
+
+ Click a point, line, or polygon to see hit-test results
+
+
+ Zoom automatically when a point is clicked
+
+
+ Click event and context menu
+
+
+ Locate running point
+
+
+ Locate row
+
+
+ Polygon
+
+
+ Send bullet comment
+
+
+ Send
+
+
+ Send tray notification
+
+
+ Disapproval rate
+
+
+ Reaction disk
+
+
+ FangSong
+
+
+ Magnifier
+
+
+ Plane.png
+
+
+ Show non-modally (MaskShow)
+
+
+ Open windows modally and non-modally, with an overlay on the current window.
+
+
+ Section --
+
+
+ Rich control themes and practical components make Windows desktop development easier.
+
+
+ Amap
+
+
+ Update
+
+
+ Tool window
+
+
+ Features
+
+
+ Feature settings
+
+
+ Feature demos
+
+
+ Close
+
+
+ Close button --
+
+
+ About
+
+
+ About this sample
+
+
+ About us
+
+
+ Follow us on WeChat
+
+
+ Following and followers
+
+
+ Blocked list
+
+
+ Horizontal
+
+
+ Welcome to WPFDevelopers!
+
+
+ Welcome to WPFDevelopers.Avalonia. Build desktop apps for Windows, macOS, and Linux with Avalonia.
+
+
+ Grayscale intensity:
+
+
+ Restore default z-order
+
+
+ Premium audio quality
+
+
+ Draw the pattern 0 → 4 → 2 → 6 to unlock.
+
+
+ Get
+
+
+ Get IP address
+
+
+ Focused --
+
+
+ Get selected
+
+
+ Highest audio quality
+
+
+ Opening in Microsoft Edge…
+
+
+ Resume run
+
+
+ Join QQ group: 458041663
+
+
+ Loading…
+
+
+ Buildings
+
+
+ High audio quality
+
+
+ Result
+
+
+ End date
+
+
+ Screenshot
+
+
+ Extended screenshot
+
+
+ Hide the current window while taking a screenshot
+
+
+ Go live
+
+
+ Disabled --
+
+
+ When disabled --
+
+
+ Longitude
+
+
+ Compact pagination
+
+
+ Warning
+
+
+ Rectangle
+
+
+ Cluster radius
+
+
+ Developer
+
+
+ Developer - avatar selector
+
+
+ Enable proportional scaling
+
+
+ Enable grayscale
+
+
+ Enable boost [PC Manager-style rocket boost]
+
+
+ Enable icon flashing (switch every 500 ms)
+
+
+ Start run
+
+
+ Start date
+
+
+ Open-source WPF UI component library
+
+
+ Open-source software notice
+
+
+ Clickable text --
+
+
+ Add interactive content between the title and window buttons with TitleBarLayout.
+
+
+ Client area --
+
+
+ Space
+
+
+ Control overlay (Mask.IsShow)
+
+
+ Keyboard shortcuts
+
+
+ Quick start
+
+
+ Source coordinate system
+
+
+ Type
+
+
+ For example, set it to a Fuchsia hue.) -->
+
+
+ Connection multiplier:
+
+
+ Gitee source code
+
+
+ Gitee source
+
+
+ Password
+
+
+ Password box --
+
+
+ Password box style --
+
+
+ Password input --
+
+
+ Name
+
+
+ Template --
+
+
+ Mode:
+
+
+ Show modally (MaskShowDialog)
+
+
+ Default and custom pushpins; ClusterTemplate with 99+ count; polylines, polygons, and dynamic point sets; scale bar, diagnostics, and click-to-zoom
+
+
+ By default, Theme follows the system theme (Windows 10 and later) and switches automatically between Light and Dark modes.
+
+
+ Target coordinate system
+
+
+ Currently, only WD custom controls have been translated.
+
+
+ Content --
+
+
+ Radar chart
+
+
+ You can also customize the theme color with Color=
+
+
+ Adjust this value as needed to make the corners rounder. -->
+
+
+ Disk 1
+
+
+ Disk 2
+
+
+ Disk 3
+
+
+ Disk 4
+
+
+ Disk 5
+
+
+ Running demo
+
+
+ Smoothing:
+
+
+ Standard title bar
+
+
+ Start loading animation
+
+
+ Hide the current window when opening the magnifier
+
+
+ Enable
+
+
+ Enable point clustering
+
+
+ Toggle icon flashing
+
+
+ Clear text button --
+
+
+ Clear drawing board
+
+
+ Clear canvas
+
+
+ Bullet comment text
+
+
+ Enter token
+
+
+ Enter IP address
+
+
+ Enter text
+
+
+ Enter search text
+
+
+ Enter your password
+
+
+ Select a stock ticker
+
+
+ Select an item
+
+
+ Select a time
+
+
+ Group: 340500857
+
+
+ Group: 340500857 | QQ group: 458041663
+
+
+ Group: 458041663
+
+
+ Music that understands you
+
+
+ Date yyyy/MM/dd
+
+
+ Date yyyy-MM-dd HH:mm:ss
+
+
+ To set Light mode manually, use Theme=
+
+
+ Triangle
+
+
+ Delete selected
+
+
+ Flash
+
+
+ Previous step
+
+
+ Previous track
+
+
+ Set a new password
+
+
+ Authentication
+
+
+ Generate
+
+
+ Lifecycle: create the instance on Loaded and call Dispose on Unloaded. The icon is not destroyed when switching tabs. See the XAML / CSharp in CodeViewer.
+
+
+ Toggle common MapView features in real time
+
+
+ Use the default title bar height and standard window buttons.
+
+
+ Use a custom title bar and set the window to tool-window style and non-resizable.
+
+
+ Use a custom cluster template
+
+
+ Sample
+
+
+ Sample includes
+
+
+ Sample icon has not been created
+
+
+ Reagent storage
+
+
+ Favorite song
+
+
+ First playlist and album
+
+
+ Home
+
+
+ Enter text
+
+
+ Enter a number from 0 to 199
+
+
+ On mouse press --
+
+
+ Mouse hover --
+
+
+ On hover --
+
+
+ Vertical
+
+
+ Data information
+
+
+ Refresh
+
+
+ Refresh statistics
+
+
+ Double-click:
+
+
+ Private account
+
+
+ Random
+
+
+ Submit
+
+
+ Hint text --
+
+
+ Tianditu
+
+
+ Tianditu token
+
+
+ Enter account
+
+
+ Customize the title bar and window control buttons with TitleBar and TitleHeight.
+
+
+ Notification title
+
+
+ Notification message
+
+
+ Icon --
+
+
+ Icon flashing
+
+
+ Icon and lifecycle
+
+
+ Image selector
+
+
+ Exit
+
+
+ Tray notification
+
+
+ Drag, zoom with the wheel, and click a point to see the result
+
+
+ Appearance --
+
+
+ Done
+
+
+ Forgot password
+
+
+ WPFDevelopers WeChat Official Account
+
+
+ WeChat Official Account: WPFDevelopers
+
+
+ WeChat Official Account QR code
+
+
+ WeChat Official Account: WPFDevelopers
+
+
+ Scan the QR code to follow
+
+
+ Scan to follow WPFDevelopers on WeChat for project updates and developer tips.
+
+
+ Latitude
+
+
+ Satellite
+
+
+ Satellite map
+
+
+ Vertically centered text --
+
+
+ Text box --
+
+
+ Text box style --
+
+
+ Text color --
+
+
+ I am a masked input box
+
+
+ No icon
+
+
+ No signal
+
+
+ System tray NotifyIcon
+
+
+ Searchable multi-select dropdown
+
+
+ Next step
+
+
+ Next track
+
+
+ Show badge
+
+
+ Show scale bar
+
+
+ Show independent data layer
+
+
+ Show control overlay
+
+
+ Show zoom controls
+
+
+ Show diagnostic information
+
+
+ Line
+
+
+ Project overview
+
+
+ Eraser
+
+
+ Messages are sent by the sample icon’s ShowBalloonTips instance method. Windows notification settings or Do Not Disturb may prevent them from appearing.
+
+
+ Signal source 1
+
+
+ Information
+
+
+ Number of stars:
+
+
+ Note that wd:Resources must come after Theme.xaml. -->
+
+
+ Hover over the icon to see “WPFDevelopers - NotifyIcon Sample.” It may be in the Windows hidden icons area.
+
+
+ Select video
+
+
+ Select image
+
+
+ Selected index:
+
+
+ Demo
+
+
+ Demonstrates standard, tall, and custom title bar windows. Click a button to open a window and view each style.
+
+
+ Feature click
+
+
+ Want to build cross-platform apps too?
+
+
+ Remove
+
+
+ Move the first dynamic point
+
+
+ Volume -
+
+
+ Volume +
+
+
+ Hide all --
+
+
+ Privacy settings
+
+
+ Privacy Policy
+
+
+ Username
+
+
+ Username input --
+
+
+ User Agreement
+
+
+ Email
+
+
+ Invalid email format
+
+
+ Email input --
+
+
+ “Toggle icon flashing” in the context menu and custom panel is synchronized with this setting. The original icon is restored when stopped.
+
+
+ Right-click to show:
+
+
+ Preview 120x120
+
+
+ Source code
+
+
+ Source
+
+
+ Click or double-click the sample icon in the system tray to update the count and feedback below.
+
+
+ Stream audio
+
+
+ Pause run
+
+
+ Add
+
+
+ Tension:
+
+
+ Account
+
+
+ Standard pagination
+
+
+ Live
+
+
+ Stock ticker:
+
+
+ Value
+
+
+ Always on top (toggle at runtime)
+
+
+ Medium
+
+
+ March of the Volunteers
+
+
+ Chinese
+
+
+ Chinese / English
+
+
+ Reset map view
+
+
+ Stephen Chow | Uncle Tat
+
+
+ Main road name
+
+
+ Sign up
+
+
+ Sign-up button --
+
+
+ Create account
+
+
+ Convert
+
+
+ Desktop lyrics
+
+
+ Custom
+
+
+ Custom marker
+
+
+ Custom title bar
+
+
+ Custom step size
+
+
+ Custom panel ContextContent
+
+
+ Custom tray panel
+
+
+ Custom context menu
+
+
+ Custom increment and decrement events
+
+
+ Custom center point
+
+
+ Combined features
+
+
+ Maximum size:
+
+
+ Maximum speed:
+
+
+ Maximum rotation speed:
+
+
+ Minimum size:
+
+
+ Minimum cluster size
+
+
+ Minimum speed:
+
+
+ Minimum rotation speed:
+
+
+ Left-click:
+
+
+ Coordinate conversion demo
+
+
+ Switching languages updates both the samples and WPFDevelopers controls.
+
+
+ Pin Circle to the top (update dynamically)
+
+
+ GitHub source code
+
+
+ GitHub source code
+
+
+ QQ group: 340500857
+
+
+ QQ group: 458041663
+
+
+ QQ groups: 340500857 | 458041663
+
+
+ WPFDevelopers
+
+
+ WPFDevelopers - Avatar Picker
+
+
+ Use LoadingExt when the UI thread is blocked
+
+
+ WPFDevelopers - NotifyIcon sample
+
+
+ MapView feature demo
+
+
+ ShapeZIndex demo
+
+
+ MapView features overview
+
+
+ XAML mode:
+
+
+ MVVM mode:
+
+
+ Normal · Standard title bar
+
+
+ TitleBarMode=Normal uses the default title bar height and standard window buttons.
+
+
+ High · Title bar toolbar area
+
+
+ TitleBarMode=High lets you add interactive content between the title and window buttons with TitleBarLayout.
+
+
+ ToolWindow · Tool window
+
+
+ None · Custom title bar
+
+
+ TitleBarMode=None customizes the title bar and window buttons with TitleBar and TitleHeight.
+
+
+ WPFDevelopers public WeChat account QR code
+
+
+ {0:0} value
+
+
+ Click “Refresh statistics” to try again.
+
+
+ {DateTime.Now} Cancel screenshot
+
+
+ Prize tier {i}
+
+
+ {key} copied to clipboard
+
+
+ {MyMultiSelectComboBox.Text} Total selected: {MyMultiSelectComboBox.SelectedItems.Count}
+
+
+ {MyMultiSelectionSearchComboBox2.Text} Total selected: {SelectedItems.Count}
+
+
+ {p.Name} ({(int)p.GetValue(player, null)} points)
+
+
+ · Downloads are cumulative across all NuGet package versions
+
+
+ Circle is now on top; current ShapeZIndex={DemoCircle.ShapeZIndex}
+
+
+ Event: Clicked item {carousel.SelectedIndex}
+
+
+ Loading map
+
+
+ MVVM mode click: {obj}
+
+
+ NuGet returned no WPFDevelopers package statistics
+
+
+ Incorrect OTP. Please try again!
+
+
+ OTP verified!
+
+
+ Let us build our new Great Wall with our flesh and blood!
+
+
+ 包龙星
+
+
+ 包有为
+
+
+ This sample uses a NotifyIcon to demonstrate click events, context menus, balloon notifications, and icon flashing.
+
+
+ Edit
+
+
+ Arise, all who refuse to be slaves!
+
+
+ Test bullet comment
+
+
+ 常威
+
+
+ This is a restricted airspace.
+
+
+ Error
+
+
+ Open
+
+
+ The current file does not exist. Continue?
+
+
+ The current file does not exist.
+
+
+ Currently selected: {selection.Text}
+
+
+ Visits
+
+
+ Map
+
+
+ Clicked Circle: radius={featureArgs.ClickedCircle.RadiusMeters:F0}m ({featureArgs.Latitude:F6}, {featureArgs.Longitude:F6})
+
+
+ Clicked Polygon: points={featureArgs.ClickedPolygon.Points.Count} ({featureArgs.Latitude:F6}, {featureArgs.Longitude:F6})
+
+
+ Clicked Polyline: points={featureArgs.ClickedPolyline.Points.Count} ({featureArgs.Latitude:F6}, {featureArgs.Longitude:F6})
+
+
+ Clicked Pushpin: {featureArgs.ClickedPushpin.Title} ({featureArgs.Latitude:F6}, {featureArgs.Longitude:F6})
+
+
+ Clicked Rectangle: [{featureArgs.ClickedRectangle.MinLatitude:F4},{featureArgs.ClickedRectangle.MinLongitude:F4}]~[{featureArgs.ClickedRectangle.MaxLatitude:F4},{featureArgs.ClickedRectangle.MaxLongitude:F4}]
+
+
+ Clicked: {e.OriginalSource.ToString()}
+
+
+ Clicked: {menuItem.Tag}
+
+
+ Clicked {item.Text}
+
+
+ Clicked {menuItemModel.Text}
+
+
+ Clicked “{MyBubbleSelection.SelectedText} Developer”.
+
+
+ Click complete.
+
+
+ Clicked coordinates: Latitude={clickArgs.Latitude:F6}, Longitude={clickArgs.Longitude:F6}
+
+
+ East business point
+
+
+ Dynamic point
+
+
+ Two
+
+
+ 方唐镜
+
+
+ Unselected
+
+
+ Wind
+
+
+ 风云大陆
+
+
+ Copy failed. Please try again later.
+
+
+ Alert layer
+
+
+ Updated
+
+
+ Disable grayscale
+
+
+ About the NotifyIcon sample
+
+
+ Hard to be happy
+
+
+ Shanghai A
+
+
+ Flower
+
+
+ 花雨
+
+
+ Verification code received:
+
+
+ Get dates
+
+
+ 纪
+
+
+ 纪春庆
+
+
+ Failed to load
+
+
+ Node: {transform.Id} pressed
+
+
+ Node: {transform.Id}, status: {status}
+
+
+ Screenshot path: {text}
+
+
+ Warning
+
+
+ Start date: {MyDateRangePicker.StartDate} End date: {MyDateRangePicker.EndDate}
+
+
+ 来福
+
+
+ 狼行
+
+
+ 雷豹
+
+
+ Advance through the enemy’s fire!
+
+
+ Everyone is forced to make one last cry.
+
+
+ Ability score
+
+
+ Running layer
+
+
+ Ping An Bank
+
+
+ SPD Bank
+
+
+ Arise!
+
+
+ Advance!
+
+
+ Advance! Forward!
+
+
+ Enter your Tianditu token
+
+
+ Enter valid longitude/latitude values
+
+
+ Enter a notification title and message first.
+
+
+ Please select an image
+
+
+ 蛐蛐
+
+
+ Three
+
+
+ SSE Composite Index
+
+
+ Shenzhen A
+
+
+ 圣枪哥
+
+
+ Time:
+
+
+ The sample icon and flashing timer have been disposed; the main window’s tray icon is unaffected.
+
+
+ Sample icon created (1)
+
+
+ Sample icon removed
+
+
+ Video files (.MP4)|*.mp4;
+
+
+ Exit the current application?
+
+
+ Received tray icon double-click event (the first click is counted too).
+
+
+ Received tray icon left-click event.
+
+
+ Incorrect pattern. Please try again!
+
+
+ Incorrect pattern. Use at least 4 nodes!
+
+
+ Correct pattern!
+
+
+ Move the mouse to draw shapes
+
+
+ Left mouse button pressed
+
+
+ Left mouse button released
+
+
+ Count:
+
+
+ Four
+
+
+ Notice
+
+
+ Failed to load statistics:
+
+
+ Statistics response contains no valid count
+
+
+ Statistics response is empty
+
+
+ Image must be no larger than 1 MB
+
+
+ Image files (*.jpg;*.jpeg;*.png;)|*.jpg;*.jpeg;*.png;
+
+
+ 王
+
+
+ 王羲之
+
+
+ File deleted successfully.
+
+
+ I
+
+
+ With one heart, we advance through the enemy’s fire!
+
+
+ 我是骗人布010
+
+
+ Unable to open link:
+
+
+ West business point
+
+
+ Message
+
+
+ Close account
+
+
+ Thanks for participating
+
+
+ The new array must be smaller than the original!
+
+
+ Updated successfully
+
+
+ Rotate
+
+
+ Selected: {e.NewValue}
+
+
+ Selected
+
+
+ Selected items
+
+
+ Question
+
+
+ 闫驚鏵/WPFDevelopers
+
+
+ Verification code
+
+
+ One
+
+
+ Remove sample icon
+
+
+ Sample icon created. Click, double-click, or right-click it in the system tray.
+
+
+ About dialog opened.
+
+
+ Copied to clipboard
+
+
+ Restored default z-order: Circle={DefaultCircleZIndex}, Rectangle={DefaultRectangleZIndex}
+
+
+ Icon flashing enabled.
+
+
+ Flashing stopped and icon restored.
+
+
+ Notification sent to Windows. If it does not appear, check notification settings and Do Not Disturb.
+
+
+ Mail
+
+
+ Right-click the sample icon to show the standard menu.
+
+
+ Right-click the sample icon to show the custom panel.
+
+
+ This is a very long message
+
+
+ Loading GitHub stars and cumulative NuGet downloads...
+
+
+ This action may make the file impossible to open!
+
+
+ Index
+
+
+ The Chinese nation faces its greatest peril,
+
+
+ Home
+
+
+ Total selected: {MyMultiSelectComboBox.SelectedItems.Count}
+
+
+ Lyrics: 田汉
+
+
+ Music: 聂耳
+
+
+ Apply
+
+
+ Cancel
+
+
+ IP Address Input
+
+
+ Markdown Viewer
+
+
+ SVG Viewer
+
+
+ Welcome to WPFDevelopers
+
+
+ Button
+
+
+ Edge Glow
+
+
+ Transform Layout
+
+
+ Ruler
+
+
+ Label
+
+
+ Pie Chart
+
+
+ Dial
+
+
+ Layout Spacing
+
+
+ Step Indicator
+
+
+ Rainbow Button
+
+
+ Menu
+
+
+ More updates coming
+
+
+ Prize Draw
+
+
+ Drawer
+
+
+ Drawer Menu
+
+
+ Window
+
+
+ Radio Button
+
+
+ Bullet Comments
+
+
+ Navigation Scroll Panel
+
+
+ Countdown
+
+
+ Login Window
+
+
+ Loading Placeholder
+
+
+ Animated Grid
+
+
+ Shake
+
+
+ Searchable Multi-Select Combo Box
+
+
+ Segmented Pie Chart
+
+
+ Segmented Control
+
+
+ Split Button
+
+
+ Pagination
+
+
+ Group Box
+
+
+ Check Box
+
+
+ Lyrics
+
+
+ Scroll Navigation
+
+
+ Scroll Loading
+
+
+ Scroll Viewer
+
+
+ Transition Panel
+
+
+ Breathing Light
+
+
+ Slider
+
+
+ Ring Loading Animation
+
+
+ Grayscale Effect
+
+
+ Badge
+
+
+ Drawing
+
+
+ Activity Feed (Sample Control)
+
+
+ Rocket Animation
+
+
+ Flame
+
+
+ Basic Loading Animation
+
+
+ Basic Controls
+
+
+ Loading Animation
+
+
+ Progress Bar
+
+
+ Spotlight
+
+
+ Focus Carousel
+
+
+ Card Carousel
+
+
+ Radar Chart
+
+
+ Chat Emoji
+
+
+ List Locator
+
+
+ List Box
+
+
+ List View
+
+
+ Shimmer Loading Animation
+
+
+ Six-Grid View
+
+
+ Path Icon
+
+
+ Password Box
+
+
+ Breadcrumb Navigation
+
+
+ Skeuomorphic Volume Control
+
+
+ Panning List
+
+
+ Screen Capture
+
+
+ Masonry Layout
+
+
+ Bubble Selection
+
+
+ Toggle Button
+
+
+ Sphere Loading Animation
+
+
+ Taskbar Thumbnail
+
+
+ Taskbar Item Info
+
+
+ Calendar
+
+
+ Date Range Picker
+
+
+ Date-Time Picker
+
+
+ Date Picker
+
+
+ 3D Navigation Menu
+
+
+ Color Guide
+
+
+ Time Picker
+
+
+ Timeline
+
+
+ Usage Guide
+
+
+ Sample Multi-Select Combo Box
+
+
+ Sample-specific implementation or composition, not a built-in WD control; see the sample source.
+
+
+ Gesture Unlock
+
+
+ Handwriting Canvas
+
+
+ Tree View
+
+
+ Data Grid
+
+
+ Data Grid Filtering
+
+
+ Number Card
+
+
+ Numeric Input
+
+
+ Search Controls
+
+
+ Avatar Cropper
+
+
+ Icon Library
+
+
+ Image Cropper
+
+
+ System Tray Icon
+
+
+ Drag and Drop
+
+
+ Grid Splitter
+
+
+ Thermometer
+
+
+ Text Box
+
+
+ Combo Box
+
+
+ Message Box
+
+
+ Toast Notification
+
+
+ Starry Sky
+
+
+ Virtualizing Wrap Panel
+
+
+ Tab Control
+
+
+ Snowflake Canvas
+
+
+ Looping Loader
+
+
+ Acrylic Effect
+
+
+ Color Picker
+
+
+ One-Time Password Input
+
+
+ Gauge
+
+
+ Dashboard
+
+
+ Audio Animation
+
+
+ Circle Menu
+
+
+ Circular Progress Bar
+
+
+ Round Picker
+
+
+ Control and Window Masks
+
+
+ Expander
+
+
+ Line Chart
+
+
+ Theme
+
+
+ Bar Chart
+
+
+ Desktop Background
+
+
+ Marquee
+
+
+ Dialog
+
+
+ Message
+
+ A
+ ASP.NET
+ Add
+ Add item
+ Install the NuGet package;
+ Add the namespace to App.xaml
+ Add the resources to App.xaml
+ Add loading indicator
+ Address
+ Age
+ All grids
+ Apple!
+ AtomGit
+ B
+ BD09
+ Data binding
+ Binding source
+ Data binding:
+ Blazor
+ Bottom
+ Bus
+ Bus 1
+ Bus 2
+ Busy
+ Button
+ C#
+ C# + XAML / Events
+ Calendar
+ Card
+ Check-in
+ Checkbox
+ City
+ Class
+ Classroom
+ Clear
+ Clear toasts
+ Clock
+ C# code
+ ComboBox
+ Command
+ Submit
+ Complete all existing nodes and append a loading node.
+ Complete pending nodes
+ Contact method
+ Content
+ Content 1
+ Content 2
+ Content 3
+ Content 4
+ Content 5
+ Content 6
+ Copy
+ Copy resource key
+ Copyright © 2022 WPFDevelopers. All rights reserved.
+ Count:
+ Create
+ Create a service site
+ Ctrl + L
+ Ctrl + ←
+ Ctrl + ↑
+ Ctrl + →
+ Ctrl + ↓
+ Cut
+ DEMO
+ Danger
+ Dark
+ DataGrid
+ Date
+ DatePicker
+ Date and time
+ DateTimePicker
+ Default
+ Deploy
+ Desktop
+ Develop
+ Dialog
+ Drawer
+ DrawerMenu - XAML
+ DrawerMenu data binding
+ EN
+ EdgeLight
+ EdgeLight2
+ EdgePage
+ Email
+ EmailPage
+ Emoji
+ Enable
+ English
+ Error
+ Error toast
+ Event
+ Expander
+ Expander1
+ False
+ File
+ Friend
+ GCJ02
+ Geometry:
+ GitHub
+ GitHub stars
+ Gitee
+ Grayscale
+ Grid
+ GridSplitter
+ GroupBox
+ GroupBox1
+ HD
+ HighTitleBar
+ Home
+ HomePage
+ Horizontal
+ Horizontal / Alternate / Labels
+ Horizontal ScrollViewer
+ Horizontal splitter - resize rows
+ Horizontal grid
+ ID
+ IconicThumbnailWindowExample
+ Idle
+ Information
+ Information toast
+ IntPtr window
+ IsLoading
+ IsOpen
+ IsVisible
+ Item 1
+ Item 2
+ Item 3
+ Item 6
+ Jindong region
+ Languages
+ Languages:
+ Large
+ Left
+ Light
+ Light | Dark
+ ListBox
+ ListView
+ Loading
+ Loading activity...
+ Load task
+ Log in
+ Long toast
+ MAP OVERVIEW
+ MAUI
+ MIT
+ MVVM
+ MVVM / Commands
+ MainWindow
+ MainWindow source code
+ Markdown input
+ Markdown preview
+ Mask
+ Mask 0
+ Mask 1
+ Mask 2
+ Maximum
+ Maximum date:
+ Medium
+ Menu
+ Menu 1
+ Menu 2
+ Menu 3
+ Menu item 1
+ Menu item 1.1
+ Menu item 1.1.1
+ Menu item 1.1.1.1
+ Menu item 1.1.1.2
+ Menu item 1.1.2
+ Menu item 1.2
+ Menu item 1.3
+ Menu item 1.4
+ Menu item 1.5
+ Menu item 2
+ Menu item 3
+ Menu item 4
+ Minimum
+ Minimum date:
+ Mode
+ Mode 1
+ Mode 2
+ Mode 3
+ Mode 4
+ Multicolor
+ MultiSelectComboBox
+ MultiSelectionSearchComboBox
+ Multiline content keeps the nodes aligned.
+ NEW
+ Name
+ Resolving network problems
+ Next
+ Next step
+ NoneTitleBarWindow
+ Normal
+ Normal loading indicator
+ NuGet
+ NuGet downloads
+ Close task
+ Offset
+ Open
+ Open MVVM dialog
+ Option 1
+ Option 2
+ Option 3
+ Option 4
+ Option 5
+ Option A
+ Option B
+ Option C
+ Option D
+ Orientation
+ PasswordBox
+ Paste
+ PathIcon:
+ Progress
+ ProgressBar
+ Question
+ RadioButton
+ Regular
+ Remove last
+ Reset
+ Reverse
+ Right
+ Sample
+ Save
+ Screenshot
+ Scroll navigation
+ ScrollViewer
+ Shandong Province
+ Theme: Light / Dark
+ Sichuan Province
+ Single selection
+ Single selection:
+ Slide 1
+ Slide 2
+ Slide 3
+ Slide 4
+ Slide 5
+ Slider
+ Mostly idle
+ Small
+ Solve initial network problems
+ Spacing=4 adds a 4px gap between items and wrapped rows, plus 2px around the panel edges. Existing child margins are added to this gap.
+ StackPanel
+ Star
+ Step 1:
+ Step 2:
+ Step 3:
+ Style 1
+ Style 2
+ Style 3
+ Success
+ Success toast
+ System V1.0
+ TRACKING DATA
+ TabControl
+ Tab 1
+ Tab 2
+ Tab 2LongLongLongLongLongLongLongLong
+ Tab 3
+ Tab 3LongLongLongLongLongLongLongLong
+ Tag 1
+ Tag 2
+ Tag 3
+ Tag 4
+ Tag 5
+ TaskbarItemInfoExample
+ Technical testing
+ Test
+ TextBlock:
+ TextBox
+ Theme
+ Toast position
+ ToggleButton
+ ToolWindow
+ Top
+ TreeView
+ UPDATE
+ UWP
+ UniformGrid
+ Use the mouse wheel or touchpad to scroll horizontally.
+ Vertical
+ Vertical / Start
+ Vertical splitter - resize columns
+ Vertical grid
+ Virtualization (5000 items)
+ Vote
+ WGS84
+ WGS84 -> GCJ02
+ WPF
+ WPFDevelopers
+ WPFDevelopers logo
+ WPFDevelopers.Avalonia
+ Warning
+ Warning toast
+ WebAPI
+ Whiteboard
+ WinForm
+ WinUI
+ Window
+ WrapPanel
+ X
+ XAML
+ XXXYYY
+ Xamarin
+ YanJinHua
+ Yes / No / Cancel
+ Zoom in
+ Zoom out
+ Activity
+ Content...
+ License
+ Select time
+ Tags
+ Version
+ wd:WDScrollViewer
+ 한국어
+ 343DST.com
+ ABCV.wang
+ Added by a C# click event.
+ Alibaba
+ Apple
+ Background
+ Baidu
+ Beijing
+ Bing
+ Black
+ Base border
+ Canceled
+ Car
+ Chart fill
+ Chart X axis
+ Jump-to-page command clicked: {page}
+ Next-page command clicked: {param}
+ Page command clicked: {page}
+ Previous-page command clicked: {param}
+ Completed
+ Confirmed: name: {model.Name} - email: {model.Email}
+ Create a service site.
+ Created
+ Day
+ Dual screen
+ Edge
+ Event {_eventNumber}
+ F2
+ Fax
+ Fri
+ Google
+ In progress
+ Item {i}
+ Jump-to-page clicked: current page={pagination.Current}
+ Lighter
+ MB
+ Markdown files (*.md)|*.md|All files (*.*)|*.*
+ Menu 01
+ Menu 02
+ Menu 03
+ Microsoft
+ Mon
+ Month
+ Mouse over
+ Name{i}
+ Next clicked: current page={pagination.Current}
+ One Microsoft Way, Redmond
+ Open AI
+ Open AI2
+ Open AI3
+ Open AI4
+ OpenAI.com
+ PPOI.xu
+ Page clicked: current page={pagination.Current}
+ Placeholder text
+ Previous clicked: current page={pagination.Current}
+ Primary
+ Primary text
+ Regular text
+ Runner
+ Runoob
+ Sat
+ Save as Excel
+ Save as an image
+ Save as PDF
+ Save as Word
+ Shadow depth
+ Shanghai
+ Single screen
+ Solve initial network problems.
+ Stack Overflow
+ Step 1
+ Step 2
+ Step 3
+ Step 4
+ Sun
+ Technical testing is in progress.
+ Telephone
+ The Shy
+ This is a toast shown using a window handle
+ This is a success toast
+ This is an error toast
+ This is an information toast
+ This is a question toast
+ This is a warning toast
+ Triple screen
+ Thu
+ Tue
+ Updated by a C# click event.
+ WD.BackgroundBrush
+ WD.BaseBrush
+ WD.BaseMoveBrush
+ WD.BlackBrush
+ WD.ChartFillBrush
+ WD.ChartXAxisBrush
+ WD.DangerBrush
+ WD.DangerMouseOverBrush
+ WD.LightBrush
+ WD.LighterBrush
+ WD.PlaceholderTextBrush
+ WD.PrimaryBrush
+ WD.PrimaryMouseOverBrush
+ WD.PrimaryTextBrush
+ WD.RegularTextBrush
+ WD.ShadowDepthColor
+ WD.SuccessBrush
+ WD.SuccessMouseOverBrush
+ WD.WarningBrush
+ WD.WarningMouseOverBrush
+ WPFDevelopers1.1
+ WPFDevelopers1.1.1
+ WPFDevelopers1.2
+ WPFDevelopers1.3
+ WPFDevelopers1.4
+ WPFDevelopers1.5
+ WPFDevelopers1.6
+ Wed
+ Week
+ Xiaomi
+ Year
+ Main button clicked: {btn.Content.ToString()}
+ Image files|*.jpg
+ josh.peng
+ Map
+ {sourceType} -> {targetType} Longitude={converted.Longitude:F6} Latitude={converted.Latitude:F6}
+ Start
+ Alternate
+ End
+ Added by a ViewModel command.
+ Updated through INotifyPropertyChanged.
+ Confirmed: name: {Name} - email: {Email}
+ Command: image clicked - {model.Title}
+ Slide 0
+ Slide 1
+ Slide 2
+ Slide 3
+ Warehouse {(i + 1).ToString()}
+ CheckMark
+ ChevronUp
+ ChevronDown
+ Blackout
+ Previous
+ ChevronLeft
+ ChevronRight
+ SortArrow
+ WindowMaximize
+ WindowRestore
+ WindowClose
+ SmileyOutline
+ BuildingRegular
+ AlarmClock
+ Flag
+ Circular
+ ChatLeft
+ ChatRight
+ Complete
+ MapPin
+ Sector
+ Replace
+ AudioOne
+ AudioTwo
+ AudioThree
+ Rectangle
+ Ellipse
+ UpperTriangle
+ Arrow
+ ArrowRightTop
+ ArrowBranches
+ Text
+ Pencil
+ Mosaic
+ StarSky
+ Return
+ UnfoldMore
+ Time
+ DateRangeRight
+ Undo
+ Filter
+ Confirm
+ Semicircle
+ UpArrow
+ DownArrow
+ Splitter
+ Moon
+ SystemTheme
+ Waterfall image loading failed
+ GitHub statistics failed to load: {error}. Click "Refresh statistics" to try again.
+ NuGet statistics failed to load: {error}. Click "Refresh statistics" to try again.
+ Statistics failed to load: {error}. Click "Refresh statistics" to try again.
+ Updated at {time} · Downloads are cumulative across all NuGet versions
+ Unable to open link: {error}
+ Personalization
+ Theme color
+ Yes
+
\ No newline at end of file
diff --git a/src/WPFDevelopers.Samples.Shared/Languages/SamplesLanguage.ko-KR.resx b/src/WPFDevelopers.Samples.Shared/Languages/SamplesLanguage.ko-KR.resx
new file mode 100644
index 00000000..6e8b1b81
--- /dev/null
+++ b/src/WPFDevelopers.Samples.Shared/Languages/SamplesLanguage.ko-KR.resx
@@ -0,0 +1,2514 @@
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ NuGet 패키지를 설치한 뒤 App.xaml에 테마와 wd:Resources를 추가하고 왼쪽 메뉴에서 컨트롤과 샘플 소스 코드를 살펴보세요.
+
+
+ 버튼 스타일 --
+
+
+ 길게 눌러 가속~ 야옹 (゜-゜)つロ
+
+
+ 저장
+
+
+ 이미지 저장
+
+
+ 배경색 --
+
+
+ 배경 이미지 --
+
+
+ 이 페이지는 기본 창 아이콘과 별도로 샘플 아이콘 하나를 만듭니다. 페이지를 나가면 자동으로 제거되므로 다시 들어와도 중복되지 않습니다.
+
+
+ 식별자 --
+
+
+ 제목 표시줄 --
+
+
+ 제목 표시줄 도구 영역
+
+
+ 표준
+
+
+ 표준 ContextMenu
+
+
+ 일반 지도
+
+
+ 표준 음질
+
+
+ 재생/일시 정지
+
+
+ 재생
+
+
+ 버튼 그룹 숨기기
+
+
+ 자르기 영역 비율:
+
+
+ 작업 피드백
+
+
+ 차량 경로
+
+
+ 서랍이 아래쪽에서 나타납니다. 오버레이를 클릭하면 닫힙니다.
+
+
+ 서랍이 위쪽에서 나타납니다. 오버레이를 클릭하면 닫힙니다.
+
+
+ 서랍이 오른쪽에서 나타납니다. 오버레이를 클릭하면 닫힙니다.
+
+
+ 서랍이 왼쪽에서 나타납니다. 오버레이를 클릭하면 닫힙니다.
+
+
+ 트리거 --
+
+
+ 창 스타일 --
+
+
+ 창 오버레이
+
+
+ 창 흔들기
+
+
+ 샘플 아이콘 만들기
+
+
+ Radius 속성으로 컨트롤 모서리의 둥근 정도를 조절할 수도 있습니다(Windows 11 기본값은 4).
+
+
+ 오류
+
+
+ Avalonia AtomGit 저장소 열기
+
+
+ Avalonia Gitee 저장소 열기
+
+
+ Avalonia GitHub 저장소 열기
+
+
+ Avalonia NuGet 패키지 열기
+
+
+ WPF AtomGit 저장소 열기
+
+
+ WPF Gitee 저장소 열기
+
+
+ WPF GitHub 저장소 열기
+
+
+ WPF NuGet 패키지 열기
+
+
+ 높은 제목 표시줄 창 열기
+
+
+ 도구 창 열기
+
+
+ 기능 데모 열기
+
+
+ 일반 창 열기
+
+
+ 사용자 지정 제목 표시줄 창 열기
+
+
+ 大话西游之大圣娶亲
+
+
+ 코드
+
+
+ 소스 저장소
+
+
+ UI 스레드가 차단된 경우 사용
+
+
+ 현재 실행 중인 컨트롤 라이브러리 버전
+
+
+ 내보내기
+
+
+ 가져오기
+
+
+ 도로
+
+
+ 지도 클릭
+
+
+ 지도 컨트롤
+
+
+ 지도 소스
+
+
+ 지도 개요
+
+
+ 로그인
+
+
+ 로그인
+
+
+ 로그인/가입 버튼 --
+
+
+ 로그인 버튼 --
+
+
+ 작업을 기다리는 중입니다.
+
+
+ 기본 지도 스타일
+
+
+ 두 번째 영역: 클라이언트 영역 --
+
+
+ 첫 번째 영역: 제목 표시줄 --
+
+
+ 점
+
+
+ “가입”을 클릭하면 다음 내용을 읽고 동의한 것으로 간주됩니다:
+
+
+ 레이블을 클릭해 브라우저에서 프로젝트를 여세요.
+
+
+ 지도를 클릭해 좌표 가져오기
+
+
+ 점, 선 또는 다각형을 클릭해 적중 결과 확인
+
+
+ 포인트를 클릭하면 자동 확대/축소
+
+
+ 클릭 이벤트 및 컨텍스트 메뉴
+
+
+ 러닝 포인트 찾기
+
+
+ 행 찾기
+
+
+ 다각형
+
+
+ 실시간 댓글 보내기
+
+
+ 보내기
+
+
+ 트레이 알림 보내기
+
+
+ 반대율
+
+
+ 반응 디스크
+
+
+ 방송체
+
+
+ 돋보기
+
+
+ 비행기.png
+
+
+ 비모달 표시(MaskShow)
+
+
+ 현재 창에 오버레이를 표시하고 모달 및 비모달 방식으로 창을 엽니다.
+
+
+ 섹션 --
+
+
+ 풍부한 컨트롤 테마와 실용적인 구성 요소로 Windows 데스크톱 앱 개발을 더 쉽게 할 수 있습니다.
+
+
+ Amap
+
+
+ 업데이트
+
+
+ 도구 창
+
+
+ 기능
+
+
+ 기능 설정
+
+
+ 기능 데모
+
+
+ 닫기
+
+
+ 닫기 버튼 --
+
+
+ 정보
+
+
+ 이 샘플 정보
+
+
+ 소개
+
+
+ WeChat 공식 계정 팔로우
+
+
+ 팔로잉 및 팔로워
+
+
+ 차단 목록
+
+
+ 가로(Horizontal)
+
+
+ WPFDevelopers에 오신 것을 환영합니다!
+
+
+ WPFDevelopers.Avalonia에 오신 것을 환영합니다. Avalonia로 Windows, macOS 및 Linux용 데스크톱 앱을 만들어 보세요.
+
+
+ 회색조 강도:
+
+
+ 기본 Z 순서 복원
+
+
+ 멤버 전용 음질
+
+
+ 0 → 4 → 2 → 6 패턴을 그려 잠금을 해제하세요.
+
+
+ 가져오기
+
+
+ IP 주소 가져오기
+
+
+ 포커스됨 --
+
+
+ 선택 항목 가져오기
+
+
+ 최고 음질
+
+
+ Microsoft Edge에서 엽니다…
+
+
+ 러닝 계속하기
+
+
+ QQ 그룹 가입: 458041663
+
+
+ 로드 중…
+
+
+ 건물
+
+
+ 높은 음질
+
+
+ 결과
+
+
+ 종료 날짜
+
+
+ 스크린샷
+
+
+ 확장 스크린샷
+
+
+ 스크린샷을 찍는 동안 현재 창 숨기기
+
+
+ 라이브 시작
+
+
+ 사용 안 함 --
+
+
+ 사용하지 않을 때 --
+
+
+ 경도
+
+
+ 간단한 페이지 매김
+
+
+ 경고
+
+
+ 직사각형
+
+
+ 클러스터 반경
+
+
+ 개발자
+
+
+ 개발자 - 아바타 선택기
+
+
+ 비율 유지하여 크기 조정
+
+
+ 회색조 켜기
+
+
+ 가속 켜기[PC 관리자 로켓 가속 방식]
+
+
+ 아이콘 깜박임 켜기(500ms마다 전환)
+
+
+ 러닝 시작
+
+
+ 시작 날짜
+
+
+ 오픈 소스 WPF UI 구성 요소 라이브러리
+
+
+ 오픈 소스 소프트웨어 고지
+
+
+ 클릭 가능한 텍스트 --
+
+
+ TitleBarLayout을 사용해 제목과 창 버튼 사이에 상호작용 콘텐츠를 추가할 수 있습니다.
+
+
+ 클라이언트 영역 --
+
+
+ 스페이스
+
+
+ 컨트롤 오버레이(Mask.IsShow)
+
+
+ 키보드 바로 가기
+
+
+ 빠른 시작
+
+
+ 원본 좌표계
+
+
+ 유형
+
+
+ 예를 들어 Fuchsia 색조로 설정합니다.) -->
+
+
+ 연결 배율:
+
+
+ Gitee 소스 코드
+
+
+ Gitee 소스
+
+
+ 비밀번호
+
+
+ 비밀번호 상자 --
+
+
+ 비밀번호 상자 스타일 --
+
+
+ 비밀번호 입력란 --
+
+
+ 이름
+
+
+ 템플릿 --
+
+
+ 모드:
+
+
+ 모달 표시(MaskShowDialog)
+
+
+ 기본 및 사용자 지정 푸시핀; 99+ 개수 표시가 있는 ClusterTemplate; 폴리라인, 다각형 및 동적 포인트 집합; 축척 막대, 진단 정보 및 클릭 확대
+
+
+ 기본적으로 Theme은 시스템 테마(Windows 10 이상)를 따르며 Light 또는 Dark 모드로 자동 전환됩니다.
+
+
+ 대상 좌표계
+
+
+ 현재 WD 사용자 지정 컨트롤만 다국어로 번역되어 있습니다.
+
+
+ 콘텐츠 --
+
+
+ 레이더 차트
+
+
+ Color=를 사용해 테마 색상을 직접 설정할 수도 있습니다.
+
+
+ 필요에 따라 값을 조정해 모서리를 더 둥글게 만들 수 있습니다. -->
+
+
+ 디스크 1
+
+
+ 디스크 2
+
+
+ 디스크 3
+
+
+ 디스크 4
+
+
+ 디스크 5
+
+
+ 러닝 데모
+
+
+ 부드럽게 처리:
+
+
+ 기본 제목 표시줄
+
+
+ 로딩 애니메이션 시작
+
+
+ 돋보기를 열 때 현재 창 숨기기
+
+
+ 사용
+
+
+ 포인트 클러스터링 사용
+
+
+ 아이콘 깜박임 전환
+
+
+ 텍스트 지우기 버튼 --
+
+
+ 그림판 지우기
+
+
+ 캔버스 지우기
+
+
+ 실시간 댓글 내용
+
+
+ 토큰 입력
+
+
+ IP 주소 입력
+
+
+ 내용 입력
+
+
+ 검색어 입력
+
+
+ 비밀번호 입력
+
+
+ 주식 코드 선택
+
+
+ 항목 선택
+
+
+ 시간 선택
+
+
+ 그룹: 340500857
+
+
+ 그룹: 340500857 | QQ 그룹: 458041663
+
+
+ 그룹: 458041663
+
+
+ 음악이 당신을 더 잘 이해하도록
+
+
+ 날짜 yyyy/MM/dd
+
+
+ 날짜 yyyy-MM-dd HH:mm:ss
+
+
+ Light 모드를 수동으로 설정하려면 Theme=를 사용하세요.
+
+
+ 삼각형
+
+
+ 선택 항목 삭제
+
+
+ 깜박임
+
+
+ 이전 단계
+
+
+ 이전 곡
+
+
+ 새 비밀번호 설정
+
+
+ 인증
+
+
+ 생성
+
+
+ 수명 주기: Loaded에서 인스턴스를 만들고 Unloaded에서 Dispose를 호출합니다. 탭을 전환할 때 아이콘을 제거하지 않습니다. CodeViewer에서 XAML / CSharp 소스를 확인하세요.
+
+
+ MapView의 주요 기능을 실시간으로 전환
+
+
+ 기본 제목 표시줄 높이와 표준 창 버튼을 사용합니다.
+
+
+ 사용자 지정 제목 표시줄을 사용하고 도구 창 스타일 및 크기 조정 불가로 설정합니다.
+
+
+ 사용자 지정 클러스터 템플릿 사용
+
+
+ 샘플
+
+
+ 샘플 구성:
+
+
+ 샘플 아이콘이 생성되지 않았습니다
+
+
+ 시약 보관소
+
+
+ 곡 즐겨찾기
+
+
+ 첫 번째 재생 목록 및 앨범
+
+
+ 홈
+
+
+ 내용 입력
+
+
+ 0~199 사이의 숫자 입력
+
+
+ 마우스를 눌렀을 때 --
+
+
+ 마우스 오버 --
+
+
+ 마우스를 올렸을 때 --
+
+
+ 세로(Vertical)
+
+
+ 데이터 정보
+
+
+ 새로 고침
+
+
+ 통계 새로 고침
+
+
+ 두 번 클릭:
+
+
+ 비공개 계정
+
+
+ 무작위
+
+
+ 제출
+
+
+ 힌트 텍스트 --
+
+
+ 천지도
+
+
+ 천지도 토큰
+
+
+ 계정 입력
+
+
+ TitleBar와 TitleHeight로 제목 표시줄과 창 제어 버튼을 사용자 지정합니다.
+
+
+ 알림 제목
+
+
+ 알림 내용
+
+
+ 아이콘 --
+
+
+ 아이콘 깜박임
+
+
+ 아이콘 및 수명 주기
+
+
+ 이미지 선택기
+
+
+ 종료
+
+
+ 트레이 알림
+
+
+ 드래그하고 휠로 확대/축소한 다음 포인트를 클릭해 결과를 확인하세요.
+
+
+ 모양 --
+
+
+ 완료
+
+
+ 비밀번호 찾기
+
+
+ WPFDevelopers WeChat 공식 계정
+
+
+ WeChat 공식 계정: WPFDevelopers
+
+
+ WeChat 공식 계정 QR 코드
+
+
+ WeChat 공식 계정: WPFDevelopers
+
+
+ QR 코드를 스캔해 팔로우
+
+
+ WeChat으로 스캔해 WPFDevelopers를 팔로우하고 프로젝트 소식과 개발 정보를 확인하세요.
+
+
+ 위도
+
+
+ 위성
+
+
+ 위성 지도
+
+
+ 텍스트 세로 가운데 정렬 --
+
+
+ 텍스트 상자 --
+
+
+ 텍스트 상자 스타일 --
+
+
+ 텍스트 색 --
+
+
+ 마스킹 입력란입니다
+
+
+ 아이콘 없음
+
+
+ 신호 없음
+
+
+ 시스템 트레이 NotifyIcon
+
+
+ 검색 가능한 다중 선택 드롭다운
+
+
+ 다음 단계
+
+
+ 다음 곡
+
+
+ 배지 표시
+
+
+ 축척 막대 표시
+
+
+ 독립 데이터 레이어 표시
+
+
+ 컨트롤 오버레이 표시
+
+
+ 확대/축소 컨트롤 표시
+
+
+ 진단 정보 표시
+
+
+ 선
+
+
+ 프로젝트 개요
+
+
+ 지우개
+
+
+ 메시지는 샘플 아이콘의 ShowBalloonTips 인스턴스 메서드로 전송됩니다. Windows 알림 설정이나 방해 금지 모드로 인해 알림이 표시되지 않을 수 있습니다.
+
+
+ 신호 소스 1
+
+
+ 정보
+
+
+ 별 개수:
+
+
+ wd:Resources는 Theme.xaml 뒤에 와야 합니다. -->
+
+
+ 아이콘 위에 마우스를 올리면 “WPFDevelopers - NotifyIcon 샘플”이라는 설명이 표시됩니다. Windows 트레이의 숨겨진 아이콘 영역에서 찾을 수 있습니다.
+
+
+ 동영상 선택
+
+
+ 이미지 선택
+
+
+ 선택된 인덱스:
+
+
+ 데모
+
+
+ 기본, 높은 및 사용자 지정 제목 표시줄 창을 보여 줍니다. 버튼을 클릭해 창을 열고 각 스타일을 확인하세요.
+
+
+ 피처 클릭
+
+
+ 크로스 플랫폼 앱도 개발하고 싶으신가요?
+
+
+ 제거
+
+
+ 첫 번째 동적 포인트 이동
+
+
+ 볼륨 -
+
+
+ 볼륨 +
+
+
+ 모두 숨기기 --
+
+
+ 개인정보 설정
+
+
+ 개인정보 처리방침
+
+
+ 사용자 이름
+
+
+ 사용자 이름 입력란 --
+
+
+ 이용 약관
+
+
+ 이메일
+
+
+ 이메일 형식이 올바르지 않습니다
+
+
+ 이메일 입력란 --
+
+
+ 컨텍스트 메뉴와 사용자 지정 패널의 “아이콘 깜박임 전환”은 이 설정과 동기화됩니다. 중지하면 원래 아이콘으로 돌아갑니다.
+
+
+ 마우스 오른쪽 버튼을 클릭해 표시:
+
+
+ 120x120 미리 보기
+
+
+ 소스 코드
+
+
+ 소스
+
+
+ 시스템 트레이에서 샘플 아이콘을 한 번 또는 두 번 클릭하면 횟수와 아래 작업 피드백이 업데이트됩니다.
+
+
+ 오디오 스트리밍
+
+
+ 러닝 일시 정지
+
+
+ 추가
+
+
+ 장력:
+
+
+ 계정
+
+
+ 기본 페이지 매김
+
+
+ 라이브 중
+
+
+ 주식 코드:
+
+
+ 값
+
+
+ 항상 위(실행 중 변경)
+
+
+ 중간
+
+
+ 의용군 행진곡
+
+
+ 중국어
+
+
+ 중국어 / 영어
+
+
+ 지도 보기 재설정
+
+
+ 주성치 | 달숙
+
+
+ 주요 도로 이름
+
+
+ 가입
+
+
+ 가입 버튼 --
+
+
+ 계정 만들기
+
+
+ 변환
+
+
+ 바탕 화면 가사
+
+
+ 사용자 지정
+
+
+ 사용자 지정 마커
+
+
+ 사용자 지정 제목 표시줄
+
+
+ 사용자 지정 단계 크기
+
+
+ 사용자 지정 패널 ContextContent
+
+
+ 사용자 지정 트레이 패널
+
+
+ 사용자 지정 컨텍스트 메뉴
+
+
+ 사용자 지정 증가 및 감소 이벤트
+
+
+ 사용자 지정 중심점
+
+
+ 종합 기능
+
+
+ 최대 크기:
+
+
+ 최대 속도:
+
+
+ 최대 회전 속도:
+
+
+ 최소 크기:
+
+
+ 최소 클러스터 크기
+
+
+ 최소 속도:
+
+
+ 최소 회전 속도:
+
+
+ 마우스 왼쪽 버튼 클릭:
+
+
+ 좌표 변환 데모
+
+
+ 언어를 전환하면 샘플과 WPFDevelopers 컨트롤의 번역이 함께 변경됩니다.
+
+
+ Circle을 맨 위로 고정 (동적으로 변경)
+
+
+ GitHub 소스 코드
+
+
+ GitHub 소스 코드
+
+
+ QQ 그룹: 340500857
+
+
+ QQ 그룹: 458041663
+
+
+ QQ 그룹: 340500857 | 458041663
+
+
+ WPFDevelopers
+
+
+ WPFDevelopers - 아바타 선택기
+
+
+ UI 스레드가 차단될 때 LoadingExt 사용
+
+
+ WPFDevelopers - NotifyIcon 샘플
+
+
+ MapView 기능 데모
+
+
+ ShapeZIndex 데모
+
+
+ MapView 기능 종합
+
+
+ XAML 모드:
+
+
+ MVVM 모드:
+
+
+ Normal · 기본 제목 표시줄
+
+
+ TitleBarMode=Normal은 기본 제목 표시줄 높이와 표준 창 버튼을 사용합니다.
+
+
+ High · 제목 표시줄 도구 영역
+
+
+ TitleBarMode=High에서는 TitleBarLayout으로 제목과 창 버튼 사이에 상호작용 콘텐츠를 추가할 수 있습니다.
+
+
+ ToolWindow · 도구 창
+
+
+ None · 사용자 지정 제목 표시줄
+
+
+ TitleBarMode=None은 TitleBar와 TitleHeight로 제목 표시줄과 창 버튼을 사용자 지정합니다.
+
+
+ WPFDevelopers 위챗 공식 계정 QR 코드
+
+
+ {0:0} 값
+
+
+ 을 눌러 “통계 새로 고침”을 다시 시도하세요.
+
+
+ {DateTime.Now} 스크린샷 취소
+
+
+ {i}등 경품
+
+
+ {key} 클립보드에 복사됨
+
+
+ {MyMultiSelectComboBox.Text} 총 선택: {MyMultiSelectComboBox.SelectedItems.Count}개
+
+
+ {MyMultiSelectionSearchComboBox2.Text} 총 선택: {SelectedItems.Count}개
+
+
+ {p.Name} ({(int)p.GetValue(player, null)}점)
+
+
+ · 다운로드 수는 모든 NuGet 패키지 버전의 누적 합계입니다.
+
+
+ Circle이 맨 위에 표시됩니다. 현재 ShapeZIndex={DemoCircle.ShapeZIndex}
+
+
+ Event: {carousel.SelectedIndex}번째 항목을 클릭함
+
+
+ 지도 로딩 중
+
+
+ MVVM 모드 클릭: {obj}
+
+
+ NuGet에서 WPFDevelopers 패키지 통계를 반환하지 않았습니다.
+
+
+ OTP가 올바르지 않습니다. 다시 시도하세요!
+
+
+ OTP가 확인되었습니다!
+
+
+ 우리의 살과 피로 새로운 만리장성을 쌓자!
+
+
+ 包龙星
+
+
+ 包有为
+
+
+ 이 샘플은 NotifyIcon으로 클릭 이벤트, 컨텍스트 메뉴, 풍선 알림 및 아이콘 깜박임을 보여 줍니다.
+
+
+ 편집
+
+
+ 노예 되기를 거부하는 사람들이여!
+
+
+ 실시간 댓글 테스트
+
+
+ 常威
+
+
+ 이곳은 비행 금지 구역입니다.
+
+
+ 오류
+
+
+ 열기
+
+
+ 현재 파일이 없습니다. 계속하시겠습니까?
+
+
+ 현재 파일이 없습니다.
+
+
+ 현재 선택됨: {selection.Text}
+
+
+ 방문 수
+
+
+ 지도
+
+
+ Circle 클릭: 반경={featureArgs.ClickedCircle.RadiusMeters:F0}m ({featureArgs.Latitude:F6}, {featureArgs.Longitude:F6})
+
+
+ Polygon 클릭: 점 수={featureArgs.ClickedPolygon.Points.Count} ({featureArgs.Latitude:F6}, {featureArgs.Longitude:F6})
+
+
+ Polyline 클릭: 점 수={featureArgs.ClickedPolyline.Points.Count} ({featureArgs.Latitude:F6}, {featureArgs.Longitude:F6})
+
+
+ Pushpin 클릭: {featureArgs.ClickedPushpin.Title} ({featureArgs.Latitude:F6}, {featureArgs.Longitude:F6})
+
+
+ Rectangle 클릭: [{featureArgs.ClickedRectangle.MinLatitude:F4},{featureArgs.ClickedRectangle.MinLongitude:F4}]~[{featureArgs.ClickedRectangle.MaxLatitude:F4},{featureArgs.ClickedRectangle.MaxLongitude:F4}]
+
+
+ 클릭: {e.OriginalSource.ToString()}
+
+
+ 클릭함: {menuItem.Tag}
+
+
+ {item.Text} 클릭함
+
+
+ {menuItemModel.Text} 클릭함
+
+
+ “{MyBubbleSelection.SelectedText} 개발자”를 클릭했습니다.
+
+
+ 클릭 완료.
+
+
+ 클릭 좌표: 위도={clickArgs.Latitude:F6}, 경도={clickArgs.Longitude:F6}
+
+
+ 동쪽 업무 지점
+
+
+ 동적 포인트
+
+
+ 둘
+
+
+ 方唐镜
+
+
+ 선택 안 됨
+
+
+ 바람
+
+
+ 风云大陆
+
+
+ 복사하지 못했습니다. 나중에 다시 시도하세요.
+
+
+ 경보 레이어
+
+
+ 업데이트 날짜
+
+
+ 회색조 끄기
+
+
+ NotifyIcon 샘플 정보
+
+
+ 행복하기란 참 어렵다
+
+
+ 상하이 A
+
+
+ 꽃
+
+
+ 花雨
+
+
+ 받은 인증 코드:
+
+
+ 날짜 가져오기
+
+
+ 纪
+
+
+ 纪春庆
+
+
+ 로드 실패
+
+
+ 노드: {transform.Id} 누름
+
+
+ 노드: {transform.Id}, 상태: {status}
+
+
+ 스크린샷 경로: {text}
+
+
+ 경고
+
+
+ 시작 날짜: {MyDateRangePicker.StartDate} 종료 날짜: {MyDateRangePicker.EndDate}
+
+
+ 来福
+
+
+ 狼行
+
+
+ 雷豹
+
+
+ 적의 포화를 뚫고 전진하라!
+
+
+ 모든 이가 마지막 외침을 터뜨리도록 강요받았다.
+
+
+ 능력치
+
+
+ 러닝 레이어
+
+
+ 핑안 은행
+
+
+ 푸동개발은행
+
+
+ 일어나라!
+
+
+ 전진!
+
+
+ 전진하라! 나아가라!
+
+
+ 천지도 토큰을 입력하세요
+
+
+ 올바른 경도/위도를 입력하세요
+
+
+ 먼저 알림 제목과 내용을 입력하세요.
+
+
+ 이미지를 선택하세요
+
+
+ 蛐蛐
+
+
+ 셋
+
+
+ 상하이 종합 지수
+
+
+ 선전 A
+
+
+ 圣枪哥
+
+
+ 시간:
+
+
+ 샘플 아이콘과 깜박임 타이머가 해제되었습니다. 기본 창의 트레이 아이콘에는 영향이 없습니다.
+
+
+ 샘플 아이콘 생성됨(1개)
+
+
+ 샘플 아이콘 제거됨
+
+
+ 동영상 파일(.MP4)|*.mp4;
+
+
+ 현재 애플리케이션을 종료하시겠습니까?
+
+
+ 트레이 아이콘 더블 클릭 이벤트를 받았습니다(더블 클릭 전 첫 클릭도 횟수에 포함됩니다).
+
+
+ 트레이 아이콘 왼쪽 클릭 이벤트를 받았습니다.
+
+
+ 패턴이 올바르지 않습니다. 다시 시도하세요!
+
+
+ 패턴이 올바르지 않습니다. 노드를 4개 이상 사용하세요!
+
+
+ 패턴이 올바릅니다!
+
+
+ 마우스를 움직여 도형 그리기
+
+
+ 마우스 왼쪽 버튼 누름
+
+
+ 마우스 왼쪽 버튼 놓음
+
+
+ 개수:
+
+
+ 넷
+
+
+ 알림
+
+
+ 통계를 불러오지 못했습니다:
+
+
+ 통계 응답에 유효한 개수가 없습니다.
+
+
+ 통계 응답이 비어 있습니다.
+
+
+ 이미지는 1MB를 초과할 수 없습니다.
+
+
+ 이미지 파일(*.jpg;*.jpeg;*.png;)|*.jpg;*.jpeg;*.png;
+
+
+ 王
+
+
+ 왕희지
+
+
+ 파일을 삭제했습니다.
+
+
+ 나
+
+
+ 우리 모두 한마음으로 적의 포화를 뚫고 전진하자!
+
+
+ 我是骗人布010
+
+
+ 링크를 열 수 없습니다:
+
+
+ 서쪽 업무 지점
+
+
+ 메시지
+
+
+ 계정 해지
+
+
+ 참여해 주셔서 감사합니다
+
+
+ 새 배열은 기존 배열보다 작아야 합니다!
+
+
+ 수정했습니다.
+
+
+ 회전
+
+
+ 선택됨: {e.NewValue}
+
+
+ 선택됨
+
+
+ 선택 항목
+
+
+ 질문
+
+
+ 闫驚鏵/WPFDevelopers
+
+
+ 인증 코드
+
+
+ 하나
+
+
+ 샘플 아이콘 제거
+
+
+ 샘플 아이콘을 만들었습니다. 시스템 트레이에서 한 번 클릭, 두 번 클릭 또는 오른쪽 클릭해 보세요.
+
+
+ 정보 대화 상자를 열었습니다.
+
+
+ 클립보드에 복사됨
+
+
+ 기본 Z 순서를 복원했습니다: Circle={DefaultCircleZIndex}, Rectangle={DefaultRectangleZIndex}
+
+
+ 아이콘 깜박임을 켰습니다.
+
+
+ 깜박임을 중지하고 아이콘을 복원했습니다.
+
+
+ Windows에 알림을 보냈습니다. 표시되지 않으면 시스템 알림 설정과 방해 금지 모드를 확인하세요.
+
+
+ 메일
+
+
+ 샘플 아이콘을 오른쪽 클릭하면 표준 메뉴가 표시됩니다.
+
+
+ 샘플 아이콘을 오른쪽 클릭하면 사용자 지정 패널이 표시됩니다.
+
+
+ 매우 긴 메시지입니다
+
+
+ GitHub 스타와 NuGet 누적 다운로드 수를 불러오는 중...
+
+
+ 이 작업으로 파일을 열지 못할 수 있습니다!
+
+
+ 지수
+
+
+ 중화민족은 가장 위태로운 순간에 놓였고,
+
+
+ 홈
+
+
+ 총 선택: {MyMultiSelectComboBox.SelectedItems.Count}개
+
+
+ 작사: 田汉
+
+
+ 작곡: 聂耳
+
+
+ 적용
+
+
+ 취소
+
+
+ IP 주소 입력란
+
+
+ Markdown 뷰어
+
+
+ SVG 뷰어
+
+
+ WPFDevelopers에 오신 것을 환영합니다
+
+
+ 버튼
+
+
+ 가장자리 광 효과
+
+
+ 변환 레이아웃
+
+
+ 눈금자
+
+
+ 레이블
+
+
+ 원형 차트
+
+
+ 다이얼
+
+
+ 레이아웃 간격
+
+
+ 단계 표시기
+
+
+ 레인보우 버튼
+
+
+ 메뉴
+
+
+ 계속 업데이트 중
+
+
+ 추첨
+
+
+ 서랍
+
+
+ 서랍 메뉴
+
+
+ 창
+
+
+ 라디오 버튼
+
+
+ 실시간 댓글
+
+
+ 탐색 스크롤 패널
+
+
+ 카운트다운
+
+
+ 로그인 창
+
+
+ 로딩 대기
+
+
+ 애니메이션 그리드
+
+
+ 흔들기
+
+
+ 검색 가능한 다중 선택 콤보 상자
+
+
+ 분할 원형 차트
+
+
+ 분할 선택 컨트롤
+
+
+ 분할 버튼
+
+
+ 페이지 매김
+
+
+ 그룹 상자
+
+
+ 체크 상자
+
+
+ 가사
+
+
+ 스크롤 탐색
+
+
+ 스크롤 로딩
+
+
+ 스크롤 뷰
+
+
+ 전환 패널
+
+
+ 브리딩 라이트
+
+
+ 슬라이더
+
+
+ 링 로딩 애니메이션
+
+
+ 회색조 효과
+
+
+ 배지
+
+
+ 그리기
+
+
+ 활동 피드(샘플 컨트롤)
+
+
+ 로켓 애니메이션
+
+
+ 불꽃
+
+
+ 기본 로딩 애니메이션
+
+
+ 기본 컨트롤
+
+
+ 로딩 애니메이션
+
+
+ 진행 표시줄
+
+
+ 스포트라이트
+
+
+ 포커스 캐러셀
+
+
+ 카드 캐러셀
+
+
+ 레이더 차트
+
+
+ 채팅 이모지
+
+
+ 목록 위치 지정
+
+
+ 목록 상자
+
+
+ 목록 보기
+
+
+ 쉬머 로딩 애니메이션
+
+
+ 6분할 보기
+
+
+ 경로 아이콘
+
+
+ 비밀번호 상자
+
+
+ 이동 경로 탐색
+
+
+ 스큐어모픽 볼륨 조절
+
+
+ 이동 목록
+
+
+ 화면 캡처
+
+
+ 벽돌형 레이아웃
+
+
+ 말풍선 선택
+
+
+ 토글 버튼
+
+
+ 구형 로딩 애니메이션
+
+
+ 작업 표시줄 미리 보기
+
+
+ 작업 표시줄 항목 정보
+
+
+ 달력
+
+
+ 날짜 범위 선택기
+
+
+ 날짜/시간 선택기
+
+
+ 날짜 선택기
+
+
+ 3D 탐색 메뉴
+
+
+ 색상 안내
+
+
+ 시간 선택기
+
+
+ 타임라인
+
+
+ 사용 안내
+
+
+ 샘플 다중 선택 콤보 상자
+
+
+ 샘플 전용 구현 또는 조합 효과이며 WD 기본 컨트롤이 아닙니다. 샘플 소스 코드를 참조하세요.
+
+
+ 제스처 잠금 해제
+
+
+ 손글씨 캔버스
+
+
+ 트리 보기
+
+
+ 데이터 그리드
+
+
+ 데이터 그리드 필터링
+
+
+ 숫자 카드
+
+
+ 숫자 입력란
+
+
+ 검색 컨트롤
+
+
+ 아바타 자르기
+
+
+ 아이콘 라이브러리
+
+
+ 이미지 자르기
+
+
+ 시스템 트레이 아이콘
+
+
+ 끌어서 놓기
+
+
+ 그리드 분할 막대
+
+
+ 온도계
+
+
+ 텍스트 상자
+
+
+ 콤보 상자
+
+
+ 메시지 상자
+
+
+ 토스트 알림
+
+
+ 별이 빛나는 밤하늘
+
+
+ 가상화 줄 바꿈 패널
+
+
+ 탭 컨트롤
+
+
+ 눈송이 캔버스
+
+
+ 반복 로더
+
+
+ 아크릴 효과
+
+
+ 색상 선택기
+
+
+ 일회용 인증 코드 입력란
+
+
+ 게이지
+
+
+ 대시보드
+
+
+ 오디오 애니메이션
+
+
+ 원형 메뉴
+
+
+ 원형 진행 표시줄
+
+
+ 원형 선택기
+
+
+ 컨트롤 및 창 마스크
+
+
+ 확장 패널
+
+
+ 선 그래프
+
+
+ 테마
+
+
+ 막대 차트
+
+
+ 바탕 화면 배경
+
+
+ 마키
+
+
+ 대화 상자
+
+
+ 메시지
+
+ A
+ ASP.NET
+ 추가
+ 항목 추가
+ NuGet 패키지 설치;
+ App.xaml에 네임스페이스 추가
+ App.xaml에 리소스 추가
+ 로딩 표시 추가
+ 주소
+ 나이
+ 모든 그리드
+ Apple!
+ AtomGit
+ B
+ BD09
+ 데이터 바인딩
+ 바인딩 소스
+ 데이터 바인딩:
+ Blazor
+ Bottom
+ 버스
+ 버스 1
+ 버스 2
+ 사용 중
+ Button
+ C#
+ C# + XAML / 이벤트
+ Calendar
+ 카드
+ 출석 확인
+ 체크박스
+ 도시
+ 학급
+ 교실
+ 지우기
+ 토스트 알림 지우기
+ 시계
+ C# 코드
+ ComboBox
+ 명령
+ 제출
+ 기존 노드를 모두 완료하고 로딩 중인 노드를 추가합니다.
+ 대기 중인 노드 완료
+ 연락 방법
+ 내용
+ 내용 1
+ 내용 2
+ 내용 3
+ 내용 4
+ 내용 5
+ 내용 6
+ 복사
+ 리소스 키 복사
+ 저작권 © 2022 WPFDevelopers. 모든 권리 보유.
+ 개수:
+ 생성
+ 서비스 사이트 생성
+ Ctrl + L
+ Ctrl + ←
+ Ctrl + ↑
+ Ctrl + →
+ Ctrl + ↓
+ 잘라내기
+ 데모
+ 위험
+ 어둡게
+ DataGrid
+ 날짜
+ DatePicker
+ 날짜 및 시간
+ DateTimePicker
+ 기본값
+ 배포
+ 데스크톱
+ 개발
+ 대화 상자
+ 드로어
+ DrawerMenu - XAML
+ DrawerMenu 데이터 바인딩
+ EN
+ EdgeLight
+ EdgeLight2
+ EdgePage
+ 이메일
+ EmailPage
+ 이모지
+ 사용
+ English
+ 오류
+ 오류 토스트 알림
+ 이벤트
+ Expander
+ Expander1
+ False
+ 파일
+ 친구
+ GCJ02
+ Geometry:
+ GitHub
+ GitHub 스타 수
+ Gitee
+ 회색조 효과
+ Grid
+ GridSplitter
+ GroupBox
+ GroupBox1
+ 고화질
+ HighTitleBar
+ 홈
+ HomePage
+ Horizontal
+ 가로 / 교차 배치 / 레이블
+ 가로 ScrollViewer
+ 가로 분할선 - 행 높이 조절
+ 가로 그리드
+ ID
+ IconicThumbnailWindowExample
+ 유휴 상태
+ 정보
+ 정보 토스트 알림
+ IntPtr 창
+ IsLoading
+ IsOpen
+ IsVisible
+ 항목 1
+ 항목 2
+ 항목 3
+ 항목 6
+ 진둥 지역
+ 언어
+ 언어:
+ 큼
+ Left
+ 밝게
+ 밝게 | 어둡게
+ ListBox
+ ListView
+ 로딩 중
+ 활동 내용을 불러오는 중...
+ 작업 로딩
+ 로그인
+ 긴 토스트 알림
+ 지도 개요
+ MAUI
+ MIT
+ MVVM
+ MVVM / 명령
+ MainWindow
+ MainWindow 소스 코드
+ Markdown 입력
+ Markdown 미리 보기
+ 마스크
+ 마스크 0
+ 마스크 1
+ 마스크 2
+ 최댓값
+ 최대 날짜:
+ 중간
+ 메뉴
+ 메뉴 1
+ 메뉴 2
+ 메뉴 3
+ 메뉴 항목 1
+ 메뉴 항목 1.1
+ 메뉴 항목 1.1.1
+ 메뉴 항목 1.1.1.1
+ 메뉴 항목 1.1.1.2
+ 메뉴 항목 1.1.2
+ 메뉴 항목 1.2
+ 메뉴 항목 1.3
+ 메뉴 항목 1.4
+ 메뉴 항목 1.5
+ 메뉴 항목 2
+ 메뉴 항목 3
+ 메뉴 항목 4
+ 최솟값
+ 최소 날짜:
+ 모드
+ 모드 1
+ 모드 2
+ 모드 3
+ 모드 4
+ 다중 색상
+ MultiSelectComboBox
+ MultiSelectionSearchComboBox
+ 여러 줄의 내용에서도 노드 정렬이 유지됩니다.
+ 신규
+ 이름
+ 네트워크 문제 해결 중
+ 다음
+ 다음 단계
+ NoneTitleBarWindow
+ 일반
+ 일반 로딩 표시
+ NuGet
+ NuGet 다운로드 수
+ 작업 닫기
+ 오프셋
+ 열기
+ MVVM 대화 상자 열기
+ 옵션 1
+ 옵션 2
+ 옵션 3
+ 옵션 4
+ 옵션 5
+ 옵션 A
+ 옵션 B
+ 옵션 C
+ 옵션 D
+ 방향
+ PasswordBox
+ 붙여넣기
+ PathIcon:
+ 진행률
+ ProgressBar
+ 질문
+ RadioButton
+ 일반
+ 마지막 항목 제거
+ 초기화
+ 역순 정렬
+ Right
+ 예제
+ 저장
+ 화면 캡처
+ 스크롤 탐색
+ ScrollViewer
+ 산둥성
+ 테마: 밝게 / 어둡게
+ 쓰촨성
+ 단일 선택
+ 단일 선택:
+ 슬라이드 1
+ 슬라이드 2
+ 슬라이드 3
+ 슬라이드 4
+ 슬라이드 5
+ Slider
+ 비교적 한가함
+ 작음
+ 초기 네트워크 문제 해결
+ Spacing=4는 항목 사이와 줄바꿈된 행 사이에 4px 간격을, 패널 가장자리에는 2px 간격을 추가합니다. 자식 요소의 기존 여백은 이 간격에 더해집니다.
+ StackPanel
+ 스타
+ 1단계:
+ 2단계:
+ 3단계:
+ 스타일 1
+ 스타일 2
+ 스타일 3
+ 성공
+ 성공 토스트 알림
+ 시스템 V1.0
+ 추적 데이터
+ TabControl
+ 탭 1
+ 탭 2
+ 탭 2긴긴긴긴긴긴긴긴제목
+ 탭 3
+ 탭 3긴긴긴긴긴긴긴긴제목
+ 태그 1
+ 태그 2
+ 태그 3
+ 태그 4
+ 태그 5
+ TaskbarItemInfoExample
+ 기술 테스트
+ 테스트
+ TextBlock:
+ TextBox
+ 테마
+ 토스트 알림 위치
+ ToggleButton
+ ToolWindow
+ Top
+ TreeView
+ 업데이트
+ UWP
+ UniformGrid
+ 마우스 휠이나 터치패드로 가로 스크롤하세요.
+ Vertical
+ 세로 / 시작 쪽
+ 세로 분할선 - 열 너비 조절
+ 세로 그리드
+ 가상화 (5000개 항목)
+ 투표
+ WGS84
+ WGS84 -> GCJ02
+ WPF
+ WPFDevelopers
+ WPFDevelopers 로고
+ WPFDevelopers.Avalonia
+ 경고
+ 경고 토스트 알림
+ WebAPI
+ 화이트보드
+ WinForm
+ WinUI
+ Window
+ WrapPanel
+ X
+ XAML
+ XXXYYY
+ Xamarin
+ YanJinHua
+ 예 / 아니요 / 취소
+ 확대
+ 축소
+ 활동
+ 내용...
+ 라이선스
+ 시간 선택
+ 태그
+ 버전
+ wd:WDScrollViewer
+ 한국어
+ 343DST.com
+ ABCV.wang
+ C# 클릭 이벤트로 추가되었습니다.
+ 알리바바
+ Apple
+ 배경
+ 바이두
+ 베이징
+ Bing
+ 검정
+ 기본 테두리
+ 취소됨
+ 차량
+ 차트 채우기
+ 차트 X축
+ 페이지 이동 명령 클릭: {page}
+ 다음 페이지 명령 클릭: {param}
+ 페이지 명령 클릭: {page}
+ 이전 페이지 명령 클릭: {param}
+ 완료됨
+ 확인됨: 이름: {model.Name} - 이메일: {model.Email}
+ 서비스 사이트를 생성합니다.
+ 생성됨
+ 일
+ 듀얼 화면
+ Edge
+ 이벤트 {_eventNumber}
+ F2
+ 팩스
+ 금
+ Google
+ 진행 중
+ 항목 {i}
+ 페이지 이동 클릭: 현재 페이지={pagination.Current}
+ 더 밝게
+ MB
+ Markdown 파일 (*.md)|*.md|모든 파일 (*.*)|*.*
+ 메뉴 01
+ 메뉴 02
+ 메뉴 03
+ Microsoft
+ 월
+ 월
+ 마우스 오버
+ 이름{i}
+ 다음 클릭: 현재 페이지={pagination.Current}
+ 레드먼드 마이크로소프트 웨이 1번지
+ Open AI
+ Open AI2
+ Open AI3
+ Open AI4
+ OpenAI.com
+ PPOI.xu
+ 페이지 클릭: 현재 페이지={pagination.Current}
+ 자리 표시자 텍스트
+ 이전 클릭: 현재 페이지={pagination.Current}
+ 기본 색상
+ 주요 텍스트
+ 일반 텍스트
+ 달리는 사람
+ Runoob
+ 토
+ Excel로 저장
+ 이미지로 저장
+ PDF로 저장
+ Word로 저장
+ 그림자 깊이
+ 상하이
+ 단일 화면
+ 초기 네트워크 문제를 해결합니다.
+ Stack Overflow
+ 1단계
+ 2단계
+ 3단계
+ 4단계
+ 일
+ 기술 테스트가 진행 중입니다.
+ 전화
+ The Shy
+ 창 핸들로 표시한 토스트 알림입니다
+ 성공 토스트 알림입니다
+ 오류 토스트 알림입니다
+ 정보 토스트 알림입니다
+ 질문 토스트 알림입니다
+ 경고 토스트 알림입니다
+ 삼중 화면
+ 목
+ 화
+ C# 클릭 이벤트로 업데이트되었습니다.
+ WD.BackgroundBrush
+ WD.BaseBrush
+ WD.BaseMoveBrush
+ WD.BlackBrush
+ WD.ChartFillBrush
+ WD.ChartXAxisBrush
+ WD.DangerBrush
+ WD.DangerMouseOverBrush
+ WD.LightBrush
+ WD.LighterBrush
+ WD.PlaceholderTextBrush
+ WD.PrimaryBrush
+ WD.PrimaryMouseOverBrush
+ WD.PrimaryTextBrush
+ WD.RegularTextBrush
+ WD.ShadowDepthColor
+ WD.SuccessBrush
+ WD.SuccessMouseOverBrush
+ WD.WarningBrush
+ WD.WarningMouseOverBrush
+ WPFDevelopers1.1
+ WPFDevelopers1.1.1
+ WPFDevelopers1.2
+ WPFDevelopers1.3
+ WPFDevelopers1.4
+ WPFDevelopers1.5
+ WPFDevelopers1.6
+ 수
+ 주
+ 샤오미
+ 년
+ 기본 버튼 클릭: {btn.Content.ToString()}
+ 이미지 파일|*.jpg
+ josh.peng
+ 지도
+ {sourceType} -> {targetType} 경도={converted.Longitude:F6} 위도={converted.Latitude:F6}
+ Start
+ Alternate
+ End
+ ViewModel 명령으로 추가되었습니다.
+ INotifyPropertyChanged를 통해 업데이트되었습니다.
+ 확인됨: 이름: {Name} - 이메일: {Email}
+ 명령: 이미지 클릭 - {model.Title}
+ 슬라이드 0
+ 슬라이드 1
+ 슬라이드 2
+ 슬라이드 3
+ 창고 {(i + 1).ToString()}
+ CheckMark
+ ChevronUp
+ ChevronDown
+ Blackout
+ Previous
+ ChevronLeft
+ ChevronRight
+ SortArrow
+ WindowMaximize
+ WindowRestore
+ WindowClose
+ SmileyOutline
+ BuildingRegular
+ AlarmClock
+ Flag
+ Circular
+ ChatLeft
+ ChatRight
+ Complete
+ MapPin
+ Sector
+ Replace
+ AudioOne
+ AudioTwo
+ AudioThree
+ Rectangle
+ Ellipse
+ UpperTriangle
+ Arrow
+ ArrowRightTop
+ ArrowBranches
+ Text
+ Pencil
+ Mosaic
+ StarSky
+ Return
+ UnfoldMore
+ Time
+ DateRangeRight
+ Undo
+ Filter
+ Confirm
+ Semicircle
+ UpArrow
+ DownArrow
+ Splitter
+ Moon
+ SystemTheme
+ 워터폴 이미지 로딩 실패
+ GitHub 통계를 불러오지 못했습니다: {error}. "통계 새로 고침"을 클릭해 다시 시도하세요.
+ NuGet 통계를 불러오지 못했습니다: {error}. "통계 새로 고침"을 클릭해 다시 시도하세요.
+ 통계를 불러오지 못했습니다: {error}. "통계 새로 고침"을 클릭해 다시 시도하세요.
+ 업데이트: {time} · NuGet 전체 버전의 누적 다운로드 수
+ 링크를 열 수 없습니다: {error}
+ 개인 설정
+ 테마 색상
+ 예
+
\ No newline at end of file
diff --git a/src/WPFDevelopers.Samples.Shared/Languages/SamplesLanguage.resx b/src/WPFDevelopers.Samples.Shared/Languages/SamplesLanguage.resx
new file mode 100644
index 00000000..8c632ea2
--- /dev/null
+++ b/src/WPFDevelopers.Samples.Shared/Languages/SamplesLanguage.resx
@@ -0,0 +1,2514 @@
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ 安装 NuGet 包后,在 App.xaml 中引入主题和 wd:Resources;从左侧菜单浏览控件和示例源码。
+
+
+ 按钮样式 --
+
+
+ 按下加速~喵 (゜-゜)つロ
+
+
+ 保存
+
+
+ 保存图片
+
+
+ 背景色 --
+
+
+ 背景图 --
+
+
+ 本页只创建一个示例图标,与主窗口图标独立。离开页面会自动移除,重新进入不会累积。
+
+
+ 标识 --
+
+
+ 标题栏 --
+
+
+ 标题栏工具区
+
+
+ 标准
+
+
+ 标准菜单 ContextMenu
+
+
+ 标准地图
+
+
+ 标准音质
+
+
+ 播放/暂停
+
+
+ 播放相关
+
+
+ 不显示按钮组
+
+
+ 裁剪区域比例:
+
+
+ 操作反馈
+
+
+ 车辆轨迹
+
+
+ 抽屉从底部滑出,点击遮罩区关闭。
+
+
+ 抽屉从顶部置滑出,点击遮罩区关闭。
+
+
+ 抽屉从右侧滑出,点击遮罩区关闭。
+
+
+ 抽屉从左侧滑出,点击遮罩区关闭。
+
+
+ 触发器 --
+
+
+ 窗口样式 --
+
+
+ 窗口遮罩
+
+
+ 窗体抖动
+
+
+ 创建示例图标
+
+
+ 此外,通过 Radius 属性可控制控件的圆角大小(Windows 11 默认为 4),
+
+
+ 错误 Error
+
+
+ 打开 Avalonia 版本 AtomGit 仓库
+
+
+ 打开 Avalonia 版本 Gitee 仓库
+
+
+ 打开 Avalonia 版本 GitHub 仓库
+
+
+ 打开 Avalonia 版本 NuGet 包
+
+
+ 打开 WPF 版本 AtomGit 仓库
+
+
+ 打开 WPF 版本 Gitee 仓库
+
+
+ 打开 WPF 版本 GitHub 仓库
+
+
+ 打开 WPF 版本 NuGet 包
+
+
+ 打开高标题栏窗口
+
+
+ 打开工具窗口
+
+
+ 打开功能演示
+
+
+ 打开普通窗口
+
+
+ 打开自定义标题栏窗口
+
+
+ 大话西游之大圣娶亲
+
+
+ 代码
+
+
+ 代码仓库
+
+
+ 当UI线程阻塞时使用
+
+
+ 当前运行的控件库版本
+
+
+ 导出
+
+
+ 导入
+
+
+ 道路
+
+
+ 地图点击
+
+
+ 地图控制
+
+
+ 地图源
+
+
+ 地图总览
+
+
+ 登 录
+
+
+ 登录
+
+
+ 登录/注册按钮 --
+
+
+ 登录按钮 --
+
+
+ 等待操作。
+
+
+ 底图样式
+
+
+ 第二块:客户区 --
+
+
+ 第一块:标题栏 --
+
+
+ 点
+
+
+ 点击「注册」即表示您已阅读并同意
+
+
+ 点击标签,在浏览器中打开项目。
+
+
+ 点击地图获取坐标
+
+
+ 点击点、线、面查看命中结果
+
+
+ 点击点位时自动缩放
+
+
+ 点击事件与右键菜单
+
+
+ 定位跑步点
+
+
+ 定位行
+
+
+ 多边形
+
+
+ 发射弹幕
+
+
+ 发送
+
+
+ 发送托盘消息
+
+
+ 反对率
+
+
+ 反应盘
+
+
+ 仿宋
+
+
+ 放大镜
+
+
+ 飞机.png
+
+
+ 非模态显示(MaskShow)
+
+
+ 分别以模态和非模态方式打开窗口,并在当前窗口上显示遮罩。
+
+
+ 分区 --
+
+
+ 丰富的控件主题与实用组件,让 Windows 桌面应用开发更简单。
+
+
+ 高德
+
+
+ 更新
+
+
+ 工具窗口
+
+
+ 功能
+
+
+ 功能设置
+
+
+ 功能演示
+
+
+ 关闭
+
+
+ 关闭按钮 --
+
+
+ 关于
+
+
+ 关于本示例
+
+
+ 关于我们
+
+
+ 关注公众号
+
+
+ 关注和粉丝列表
+
+
+ 黑名单
+
+
+ 横向 (Horizontal)
+
+
+ 欢迎使用 WPFDevelopers!
+
+
+ 欢迎体验 WPFDevelopers.Avalonia,使用 Avalonia 为 Windows、macOS 和 Linux 构建桌面应用。
+
+
+ 灰度强度:
+
+
+ 恢复默认层级
+
+
+ 会员专属音质
+
+
+ 绘制图案0→ 4 → 2 → 6 解锁。
+
+
+ 获取
+
+
+ 获取IP地址
+
+
+ 获取焦点 --
+
+
+ 获取选中
+
+
+ 极高音质
+
+
+ 即将跳转至Edge浏览器
+
+
+ 继续跑步
+
+
+ 加入QQ群:458041663
+
+
+ 加载中
+
+
+ 建筑
+
+
+ 较高音质
+
+
+ 结果
+
+
+ 结束日期
+
+
+ 截屏
+
+
+ 截屏Ext
+
+
+ 截图时隐藏当前窗口
+
+
+ 进入直播
+
+
+ 禁用 --
+
+
+ 禁用时 --
+
+
+ 经度
+
+
+ 精简模式分页
+
+
+ 警告 Warning
+
+
+ 矩形
+
+
+ 聚合半径
+
+
+ 开发者
+
+
+ 开发者-头像选择器
+
+
+ 开启等比缩放
+
+
+ 开启灰度
+
+
+ 开启加速[仿电脑管家火箭加速]
+
+
+ 开启图标闪烁(每 500 毫秒切换)
+
+
+ 开始跑步
+
+
+ 开始日期
+
+
+ 开源的 WPF UI 组件库
+
+
+ 开源软件声明
+
+
+ 可点击文本 --
+
+
+ 可通过 TitleBarLayout 在标题与窗口按钮之间添加交互内容。
+
+
+ 客户区 --
+
+
+ 空格
+
+
+ 控件遮罩(Mask.IsShow)
+
+
+ 快捷键
+
+
+ 快速开始
+
+
+ 来源坐标系
+
+
+ 类型
+
+
+ 例如设置为 Fuchsia 色调)-->
+
+
+ 连线倍率:
+
+
+ 码云源代码
+
+
+ 码云源码
+
+
+ 密码
+
+
+ 密码框 --
+
+
+ 密码框样式 --
+
+
+ 密码输入框 --
+
+
+ 名称
+
+
+ 模板 --
+
+
+ 模式:
+
+
+ 模态显示(MaskShowDialog)
+
+
+ 默认 Pushpin与自定义 Pushpin ClusterTemplate 与 99+ 数量显示 折线、多边形与动态点集合 比例尺、诊断信息与点击缩放
+
+
+ 默认情况下,Theme 会跟随系统主题(适用于 Windows 10 及以上版本),自动切换为 Light 或 Dark 模式。
+
+
+ 目标坐标系
+
+
+ 目前翻译只是针对WD的自定义控件进行了多语言翻译
+
+
+ 内容 --
+
+
+ 能力图
+
+
+ 你还可以自定义主题色,使用 Color=
+
+
+ 您可以根据需要调整该值, 以获得更大的圆角。-->
+
+
+ 盘1
+
+
+ 盘2
+
+
+ 盘3
+
+
+ 盘4
+
+
+ 盘5
+
+
+ 跑步演示
+
+
+ 平滑采样:
+
+
+ 普通标题栏
+
+
+ 启动 Loading 动画
+
+
+ 启动放大镜时隐藏当前窗口
+
+
+ 启用
+
+
+ 启用点位聚合
+
+
+ 切换图标闪烁
+
+
+ 清除文本按钮 --
+
+
+ 清空画板
+
+
+ 清空画布
+
+
+ 请弹幕内容
+
+
+ 请输入 token
+
+
+ 请输入IP地址
+
+
+ 请输入内容
+
+
+ 请输入搜索内容
+
+
+ 请输入用户密码
+
+
+ 请选择股票代码
+
+
+ 请选择内容
+
+
+ 请选择任意时间
+
+
+ 群:340500857
+
+
+ 群:340500857 | QQ群:458041663
+
+
+ 群:458041663
+
+
+ 让音乐更懂你
+
+
+ 日期 yyyy/MM/dd
+
+
+ 日期 yyyy-MM-dd HH:mm:ss
+
+
+ 若要手动设置为 Light 模式,可以使用 Theme=
+
+
+ 三角形
+
+
+ 删除选中
+
+
+ 闪烁
+
+
+ 上一步
+
+
+ 上一首
+
+
+ 设置新密码
+
+
+ 身份验证
+
+
+ 生成
+
+
+ 生命周期:Loaded 创建实例,Unloaded 调用 Dispose;不在切换选项卡时销毁图标。源码见 CodeViewer 中的 XAML / CSharp。
+
+
+ 实时切换 MapView 常用能力
+
+
+ 使用默认标题栏高度和标准窗口按钮。
+
+
+ 使用自定义标题栏,并设置为工具窗口样式和不可调整大小。
+
+
+ 使用自定义聚合模板
+
+
+ 示例
+
+
+ 示例包含
+
+
+ 示例图标未创建
+
+
+ 试剂仓
+
+
+ 收藏歌曲
+
+
+ 首次的歌单和专辑
+
+
+ 首页 / Home
+
+
+ 输入内容
+
+
+ 输入数字0~199
+
+
+ 鼠标按下时 --
+
+
+ 鼠标悬停 --
+
+
+ 鼠标悬停时 --
+
+
+ 竖向 (Vertical)
+
+
+ 数据信息
+
+
+ 刷新
+
+
+ 刷新统计
+
+
+ 双击:
+
+
+ 私密账号
+
+
+ 随机
+
+
+ 提交
+
+
+ 提示文本 --
+
+
+ 天地图
+
+
+ 天地图 Token
+
+
+ 填写账号
+
+
+ 通过 TitleBar 和 TitleHeight 自定义标题栏及窗口操作按钮。
+
+
+ 通知标题
+
+
+ 通知内容
+
+
+ 图标 --
+
+
+ 图标闪烁
+
+
+ 图标与生命周期
+
+
+ 图像选择器
+
+
+ 退出
+
+
+ 托盘消息
+
+
+ 拖动、滚轮缩放并点击点位查看效果
+
+
+ 外观 --
+
+
+ 完成
+
+
+ 忘记密码
+
+
+ 微信公众号 WPFDevelopers
+
+
+ 微信公众号:WPFDevelopers
+
+
+ 微信公众号二维码
+
+
+ 微信号公众号:WPFDevelopers
+
+
+ 微信扫码关注
+
+
+ 微信扫一扫,关注 WPFDevelopers,获取项目动态与开发分享。
+
+
+ 纬度
+
+
+ 卫星
+
+
+ 卫星地图
+
+
+ 文本垂直居中 --
+
+
+ 文本框 --
+
+
+ 文本框样式 --
+
+
+ 文本色 --
+
+
+ 我是蒙板输入框
+
+
+ 无图标 None
+
+
+ 无信号
+
+
+ 系统托盘 NotifyIcon
+
+
+ 下拉多选搜索
+
+
+ 下一步
+
+
+ 下一首
+
+
+ 显示Badge
+
+
+ 显示比例尺
+
+
+ 显示独立业务图层
+
+
+ 显示控件遮罩
+
+
+ 显示缩放控制
+
+
+ 显示诊断信息
+
+
+ 线
+
+
+ 项目概览
+
+
+ 橡皮擦
+
+
+ 消息由当前示例图标的 ShowBalloonTips 实例方法发送。Windows 通知设置或勿扰模式可能阻止通知显示。
+
+
+ 信号源1
+
+
+ 信息 Info
+
+
+ 星星个数:
+
+
+ 需要注意 wd:Resources 必须在Theme.xaml后 -->
+
+
+ 悬停图标时提示为“WPFDevelopers - NotifyIcon 示例”。可在 Windows 托盘折叠区中找到它。
+
+
+ 选择视频
+
+
+ 选择图片
+
+
+ 选中索引:
+
+
+ 演示
+
+
+ 演示普通标题栏、高标题栏以及自定义标题栏窗口。点击按钮打开窗口,可查看对应标题栏样式。
+
+
+ 要素点击
+
+
+ 也想开发跨平台应用?
+
+
+ 移除
+
+
+ 移动首个动态点位
+
+
+ 音量 -
+
+
+ 音量 +
+
+
+ 隐藏所有--
+
+
+ 隐私设置
+
+
+ 隐私政策
+
+
+ 用户名
+
+
+ 用户名输入框 --
+
+
+ 用户协议
+
+
+ 邮箱
+
+
+ 邮箱格式错误
+
+
+ 邮箱输入框 --
+
+
+ 右键菜单和自定义面板中的“切换图标闪烁”与这里同步。停止后恢复原图标。
+
+
+ 右键显示:
+
+
+ 预览120x120
+
+
+ 源代码
+
+
+ 源码
+
+
+ 在系统托盘中单击或双击示例图标,计数和下方操作反馈会更新。
+
+
+ 在线播放音频
+
+
+ 暂停跑步
+
+
+ 增加
+
+
+ 张力:
+
+
+ 账户
+
+
+ 正常模式分页
+
+
+ 正在直播
+
+
+ 证券代码:
+
+
+ 值
+
+
+ 置顶(动态修改)
+
+
+ 中
+
+
+ 中华人民共和国国歌
+
+
+ 中文
+
+
+ 中文 / English
+
+
+ 重置地图视图
+
+
+ 周星星|达叔
+
+
+ 主道路名称
+
+
+ 注册
+
+
+ 注册按钮 --
+
+
+ 注册账号
+
+
+ 转换
+
+
+ 桌面歌词
+
+
+ 自定义
+
+
+ 自定义 Marker
+
+
+ 自定义标题栏
+
+
+ 自定义步长
+
+
+ 自定义面板 ContextContent
+
+
+ 自定义托盘面板
+
+
+ 自定义右键菜单
+
+
+ 自定义增加和减少事件
+
+
+ 自定义中心点
+
+
+ 综合功能
+
+
+ 最大尺寸:
+
+
+ 最大速度:
+
+
+ 最大转速:
+
+
+ 最小尺寸:
+
+
+ 最小聚合数量
+
+
+ 最小速度:
+
+
+ 最小转速:
+
+
+ 左键单击:
+
+
+ 坐标转换演示
+
+
+ 切换语言会同时更新示例界面与 WD 控件的翻译
+
+
+ Circle 置顶(动态修改)
+
+
+ Github 源代码
+
+
+ Github 源码
+
+
+ QQ群:340500857
+
+
+ QQ群:458041663
+
+
+ QQ群:340500857 | QQ群:458041663
+
+
+ WPF开发者
+
+
+ WPF 开发者-头像选择器
+
+
+ LoadingExt 当UI线程阻塞时使用
+
+
+ WPFDevelopers - NotifyIcon 示例
+
+
+ MapView 功能演示
+
+
+ ShapeZIndex 演示
+
+
+ MapView 综合功能
+
+
+ XAML 模式:
+
+
+ MVVM 模式:
+
+
+ Normal · 普通标题栏
+
+
+ TitleBarMode=Normal,使用默认标题栏高度和标准窗口按钮。
+
+
+ High · 标题栏工具区
+
+
+ TitleBarMode=High,可通过 TitleBarLayout 在标题与窗口按钮之间添加交互内容。
+
+
+ ToolWindow · 工具窗口
+
+
+ None · 自定义标题栏
+
+
+ TitleBarMode=None,通过 TitleBar 和 TitleHeight 自定义标题栏及窗口操作按钮。
+
+
+ WPFDevelopers 微信公众号二维码
+
+
+ {0:0}值
+
+
+ 。请点击“刷新统计”重试。
+
+
+ {DateTime.Now} 取消截图
+
+
+ {i}等奖
+
+
+ {key} 已复制到剪贴板
+
+
+ {MyMultiSelectComboBox.Text} 总共选中:{MyMultiSelectComboBox.SelectedItems.Count} 条
+
+
+ {MyMultiSelectionSearchComboBox2.Text} 总共选中:{SelectedItems.Count} 条
+
+
+ {p.Name}({(int)p.GetValue(player, null)}分)
+
+
+ · 下载量为 NuGet 所有版本累计下载量
+
+
+ Circle 已置顶,当前 ShapeZIndex={DemoCircle.ShapeZIndex}
+
+
+ Event: 点击了第 {carousel.SelectedIndex} 个
+
+
+ map加载
+
+
+ MVVM 模式点击: {obj}
+
+
+ NuGet 未返回 WPFDevelopers 包统计
+
+
+ OTP错误,请重试!
+
+
+ OTP正确!
+
+
+ 把我们的血肉,筑成我们新的长城!
+
+
+ 包龙星
+
+
+ 包有为
+
+
+ 本示例使用一个 NotifyIcon 演示点击事件、右键菜单、气泡消息和图标闪烁。
+
+
+ 编辑
+
+
+ 不愿做奴隶的人们!!
+
+
+ 测试弹幕
+
+
+ 常威
+
+
+ 此为空域管制区
+
+
+ 错误
+
+
+ 打开
+
+
+ 当前文件不存在,是否继续?
+
+
+ 当前文件不存在。
+
+
+ 当前选中{selection.Text}
+
+
+ 到访数
+
+
+ 地图
+
+
+ 点击 Circle: 半径={featureArgs.ClickedCircle.RadiusMeters:F0}m ({featureArgs.Latitude:F6}, {featureArgs.Longitude:F6})
+
+
+ 点击 Polygon: 点数={featureArgs.ClickedPolygon.Points.Count} ({featureArgs.Latitude:F6}, {featureArgs.Longitude:F6})
+
+
+ 点击 Polyline: 点数={featureArgs.ClickedPolyline.Points.Count} ({featureArgs.Latitude:F6}, {featureArgs.Longitude:F6})
+
+
+ 点击 Pushpin: {featureArgs.ClickedPushpin.Title} ({featureArgs.Latitude:F6}, {featureArgs.Longitude:F6})
+
+
+ 点击 Rectangle: [{featureArgs.ClickedRectangle.MinLatitude:F4},{featureArgs.ClickedRectangle.MinLongitude:F4}]~[{featureArgs.ClickedRectangle.MaxLatitude:F4},{featureArgs.ClickedRectangle.MaxLongitude:F4}]
+
+
+ 点击: {e.OriginalSource.ToString()}
+
+
+ 点击了:{menuItem.Tag}
+
+
+ 点击了{item.Text}
+
+
+ 点击了{menuItemModel.Text}
+
+
+ 点击了“ {MyBubbleSelection.SelectedText}开发者 ”.
+
+
+ 点击完成。
+
+
+ 点击坐标: Latitude={clickArgs.Latitude:F6}, Longitude={clickArgs.Longitude:F6}
+
+
+ 东侧业务点
+
+
+ 动态点位
+
+
+ 二
+
+
+ 方唐镜
+
+
+ 非选中
+
+
+ 风
+
+
+ 风云大陆
+
+
+ 复制失败,请稍后重试
+
+
+ 告警图层
+
+
+ 更新于
+
+
+ 关闭灰度
+
+
+ 关于 NotifyIcon 示例
+
+
+ 很难开心
+
+
+ 沪A
+
+
+ 花
+
+
+ 花雨
+
+
+ 获取到验证码如下:
+
+
+ 获取日期
+
+
+ 纪
+
+
+ 纪春庆
+
+
+ 加载失败
+
+
+ 节点:{transform.Id} 节点按下
+
+
+ 节点:{transform.Id} 节点状态:{status}
+
+
+ 截图路径:{text}
+
+
+ 警告
+
+
+ 开始时间:{MyDateRangePicker.StartDate} 结束时间:{MyDateRangePicker.EndDate}
+
+
+ 来福
+
+
+ 狼行
+
+
+ 雷豹
+
+
+ 冒着敌人的炮火前进!
+
+
+ 每个人被迫着发出最后的吼声。
+
+
+ 能力值
+
+
+ 跑步图层
+
+
+ 平安银行
+
+
+ 浦发银行
+
+
+ 起来!
+
+
+ 前进!
+
+
+ 前进!进!
+
+
+ 请输入天地图 token
+
+
+ 请输入有效的经度/纬度
+
+
+ 请先填写通知标题和内容。
+
+
+ 请选择图片
+
+
+ 蛐蛐
+
+
+ 三
+
+
+ 上证指数
+
+
+ 深A
+
+
+ 圣枪哥
+
+
+ 时间:
+
+
+ 示例图标和闪烁计时器已释放,主窗口托盘图标不受影响。
+
+
+ 示例图标已创建(1 个)
+
+
+ 示例图标已移除
+
+
+ 视频文件(.MP4)|*.mp4;
+
+
+ 是否退出当前系统?
+
+
+ 收到托盘图标双击事件(双击前的第一次单击也会计数)。
+
+
+ 收到托盘图标左键单击事件。
+
+
+ 手势错误,请重新解锁!
+
+
+ 手势错误,最少 4 个节点!
+
+
+ 手势正确!
+
+
+ 鼠标移动绘制几何
+
+
+ 鼠标左键按下
+
+
+ 鼠标左键键起
+
+
+ 数量:
+
+
+ 四
+
+
+ 提示
+
+
+ 统计加载失败:
+
+
+ 统计响应缺少有效的计数
+
+
+ 统计响应为空
+
+
+ 图片不能大于 1M
+
+
+ 图像文件(*.jpg;*.jpeg;*.png;)|*.jpg;*.jpeg;*.png;
+
+
+ 王
+
+
+ 王羲之
+
+
+ 文件删除成功。
+
+
+ 我
+
+
+ 我们万众一心,冒着敌人的炮火前进!
+
+
+ 我是骗人布010
+
+
+ 无法打开链接:
+
+
+ 西侧业务点
+
+
+ 消息
+
+
+ 销户
+
+
+ 谢谢参与
+
+
+ 新的数组必须比原有的要小!
+
+
+ 修改成功
+
+
+ 旋转
+
+
+ 选择了: {e.NewValue}
+
+
+ 选中
+
+
+ 选中内容
+
+
+ 询问
+
+
+ 闫驚鏵/WPFDevelopers
+
+
+ 验证码
+
+
+ 一
+
+
+ 移除示例图标
+
+
+ 已创建示例图标,可在系统托盘中单击、双击或右键操作。
+
+
+ 已打开关于对话框。
+
+
+ 已复制到剪贴板
+
+
+ 已恢复默认层级:Circle={DefaultCircleZIndex}, Rectangle={DefaultRectangleZIndex}
+
+
+ 已开启图标闪烁。
+
+
+ 已停止闪烁并恢复图标。
+
+
+ 已向 Windows 提交通知;若未显示,请检查系统通知设置和勿扰模式。
+
+
+ 邮件
+
+
+ 右键示例图标将显示标准菜单。
+
+
+ 右键示例图标将显示自定义面板。
+
+
+ 这是一条很长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长消息
+
+
+ 正在读取 GitHub Star 和 NuGet 累计下载量...
+
+
+ 执行此操作可能导致文件无法打开!
+
+
+ 指数
+
+
+ 中华民族到了最危险的时候,
+
+
+ 主页
+
+
+ 总共选中:{MyMultiSelectComboBox.SelectedItems.Count} 条
+
+
+ 作词 : 田汉
+
+
+ 作曲 : 聂耳
+
+
+ 应用
+
+
+ 취소
+
+
+ IP 地址输入框
+
+
+ Markdown 查看器
+
+
+ SVG 查看器
+
+
+ 欢迎使用 WPFDevelopers!
+
+
+ 按钮
+
+
+ 边缘光
+
+
+ 变换布局
+
+
+ 标尺控件
+
+
+ 标签
+
+
+ 饼图
+
+
+ 拨盘
+
+
+ 布局间距
+
+
+ 步骤条
+
+
+ 彩虹按钮
+
+
+ 菜单
+
+
+ 持续更新中
+
+
+ 抽奖
+
+
+ 抽屉
+
+
+ 抽屉菜单
+
+
+ 窗口
+
+
+ 单选按钮
+
+
+ 弹幕
+
+
+ 导航滚动面板
+
+
+ 倒计时
+
+
+ 登录窗口
+
+
+ 等待加载
+
+
+ 动画网格
+
+
+ 抖动
+
+
+ 多选下拉框(带搜索)
+
+
+ 分段饼图
+
+
+ 分段选择器
+
+
+ 分割按钮
+
+
+ 分页
+
+
+ 分组框
+
+
+ 复选框
+
+
+ 歌词
+
+
+ 滚动导航
+
+
+ 滚动加载
+
+
+ 滚动视图
+
+
+ 过渡面板
+
+
+ 呼吸灯
+
+
+ 滑块
+
+
+ 环形加载动画
+
+
+ 灰度效果
+
+
+ 徽标
+
+
+ 绘图
+
+
+ 活动记录(示例控件)
+
+
+ 火箭动画
+
+
+ 火苗
+
+
+ 基础加载动画
+
+
+ 基础控件
+
+
+ 加载动画
+
+
+ 进度条
+
+
+ 聚光灯
+
+
+ 聚焦轮播
+
+
+ 卡片轮播
+
+
+ 雷达图
+
+
+ 聊天表情
+
+
+ 列表定位
+
+
+ 列表框
+
+
+ 列表视图
+
+
+ 流光加载动画
+
+
+ 六宫格
+
+
+ 路径图标
+
+
+ 密码框
+
+
+ 面包屑导航
+
+
+ 拟物音量调节
+
+
+ 平移列表
+
+
+ 屏幕截图
+
+
+ 瀑布流
+
+
+ 气泡选择
+
+
+ 切换按钮
+
+
+ 球形加载动画
+
+
+ 任务栏缩略图
+
+
+ 任务栏信息
+
+
+ 日历
+
+
+ 日期范围选择器
+
+
+ 日期时间选择器
+
+
+ 日期选择器
+
+
+ 三维导航菜单
+
+
+ 色彩指南
+
+
+ 时间选择器
+
+
+ 时间轴
+
+
+ 使用指南
+
+
+ 示例多选下拉框
+
+
+ 示例专属实现或组合效果,非 WD 内置控件;请参考示例源码。
+
+
+ 手势解锁
+
+
+ 手写画布
+
+
+ 树视图
+
+
+ 数据表格
+
+
+ 数据表格筛选
+
+
+ 数字卡片
+
+
+ 数字输入框
+
+
+ 搜索控件
+
+
+ 头像裁剪
+
+
+ 图标库
+
+
+ 图片裁剪
+
+
+ 托盘图标
+
+
+ 拖拽
+
+
+ 网格分隔条
+
+
+ 温度计
+
+
+ 文本框
+
+
+ 下拉框
+
+
+ 消息框
+
+
+ 消息提示
+
+
+ 星空
+
+
+ 虚拟化换行面板
+
+
+ 选项卡
+
+
+ 雪花画布
+
+
+ 循环加载
+
+
+ 亚克力效果
+
+
+ 颜色选择器
+
+
+ 一次性验证码输入框
+
+
+ 仪表
+
+
+ 仪表盘
+
+
+ 音频动画
+
+
+ 圆形菜单
+
+
+ 圆形进度条
+
+
+ 圆形选择器
+
+
+ 遮罩与窗口遮罩
+
+
+ 折叠面板
+
+
+ 折线图
+
+
+ 主题
+
+
+ 柱状图
+
+
+ 桌面背景
+
+
+ 走马灯
+
+
+ 对话框
+
+
+ 消息
+
+ A
+ ASP.NET
+ 添加
+ 添加项目
+ 安装 NuGet 包;
+ 在 App.xaml 中添加命名空间
+ 在 App.xaml 中添加资源
+ 添加加载效果
+ 地址
+ 年龄
+ 全部网格
+ Apple!
+ AtomGit
+ B
+ BD09
+ 数据绑定
+ 绑定数据源
+ 数据绑定:
+ Blazor
+ Bottom
+ 公交车
+ 公交车 1
+ 公交车 2
+ 繁忙
+ Button
+ C#
+ C# + XAML / 事件
+ Calendar
+ 卡片
+ 签到
+ 复选框
+ 城市
+ 班级
+ 教室
+ 清空
+ 清空消息提示
+ 时钟
+ C# 代码
+ ComboBox
+ 命令
+ 提交
+ 完成所有现有节点,并追加一个加载中的节点。
+ 完成待处理节点
+ 联系方式
+ 内容
+ 内容 1
+ 内容 2
+ 内容 3
+ 内容 4
+ 内容 5
+ 内容 6
+ 复制
+ 复制资源键
+ 版权所有 © 2022 WPFDevelopers。保留所有权利。
+ 数量:
+ 创建
+ 创建服务站点
+ Ctrl + L
+ Ctrl + ←
+ Ctrl + ↑
+ Ctrl + →
+ Ctrl + ↓
+ 剪切
+ 演示
+ 危险
+ 深色
+ DataGrid
+ 日期
+ DatePicker
+ 日期时间
+ DateTimePicker
+ 默认
+ 部署
+ 桌面
+ 开发
+ 对话框
+ 抽屉
+ DrawerMenu - XAML
+ DrawerMenu 数据绑定
+ EN
+ EdgeLight
+ EdgeLight2
+ EdgePage
+ 电子邮箱
+ EmailPage
+ 表情
+ 启用
+ English
+ 错误
+ 错误消息提示
+ 事件
+ Expander
+ Expander1
+ False
+ 文件
+ 好友
+ GCJ02
+ Geometry:
+ GitHub
+ GitHub 星标数
+ Gitee
+ 灰度效果
+ Grid
+ GridSplitter
+ GroupBox
+ GroupBox1
+ 高清
+ HighTitleBar
+ 主页
+ HomePage
+ Horizontal
+ 水平 / 交替排列 / 标签
+ 水平 ScrollViewer
+ 水平分隔条 - 调整行高
+ 水平网格
+ ID
+ IconicThumbnailWindowExample
+ 空闲
+ 信息
+ 信息消息提示
+ IntPtr 窗口
+ IsLoading
+ IsOpen
+ IsVisible
+ 项目 1
+ 项目 2
+ 项目 3
+ 项目 6
+ 金东地区
+ 语言
+ 语言:
+ 大
+ Left
+ 浅色
+ 浅色 | 深色
+ ListBox
+ ListView
+ 加载中
+ 正在加载活动内容...
+ 加载任务
+ 登录
+ 长消息提示
+ 地图概览
+ MAUI
+ MIT
+ MVVM
+ MVVM / 命令
+ MainWindow
+ MainWindow 源码
+ Markdown 输入
+ Markdown 预览
+ 遮罩
+ 遮罩 0
+ 遮罩 1
+ 遮罩 2
+ 最大值
+ 最大日期:
+ 中
+ 菜单
+ 菜单 1
+ 菜单 2
+ 菜单 3
+ 菜单项 1
+ 菜单项 1.1
+ 菜单项 1.1.1
+ 菜单项 1.1.1.1
+ 菜单项 1.1.1.2
+ 菜单项 1.1.2
+ 菜单项 1.2
+ 菜单项 1.3
+ 菜单项 1.4
+ 菜单项 1.5
+ 菜单项 2
+ 菜单项 3
+ 菜单项 4
+ 最小值
+ 最小日期:
+ 模式
+ 模式 1
+ 模式 2
+ 模式 3
+ 模式 4
+ 多色
+ MultiSelectComboBox
+ MultiSelectionSearchComboBox
+ 多行内容仍能保持节点对齐。
+ 新增
+ 姓名
+ 正在解决网络问题
+ 下一步
+ 下一步
+ NoneTitleBarWindow
+ 普通
+ 普通加载效果
+ NuGet
+ NuGet 下载量
+ 关闭任务
+ 偏移量
+ 打开
+ 打开 MVVM 对话框
+ 选项 1
+ 选项 2
+ 选项 3
+ 选项 4
+ 选项 5
+ 选项 A
+ 选项 B
+ 选项 C
+ 选项 D
+ 方向
+ PasswordBox
+ 粘贴
+ PathIcon:
+ 进度
+ ProgressBar
+ 询问
+ RadioButton
+ 常规
+ 移除最后一个
+ 重置
+ 反向排列
+ Right
+ 示例
+ 保存
+ 截图
+ 滚动导航
+ ScrollViewer
+ 山东省
+ 显示主题:浅色 / 深色
+ 四川省
+ 单选
+ 单选:
+ 幻灯片 1
+ 幻灯片 2
+ 幻灯片 3
+ 幻灯片 4
+ 幻灯片 5
+ Slider
+ 较空闲
+ 小
+ 解决初始网络问题
+ Spacing=4 会在项目之间及换行后的行之间添加 4px 间距,并在面板边缘保留 2px 间距。子元素已有的外边距会叠加到此间距上。
+ StackPanel
+ 星标
+ 步骤 1:
+ 步骤 2:
+ 步骤 3:
+ 样式 1
+ 样式 2
+ 样式 3
+ 成功
+ 成功消息提示
+ 系统 V1.0
+ 轨迹数据
+ TabControl
+ 标签页 1
+ 标签页 2
+ 标签页 2长长长长长长长长
+ 标签页 3
+ 标签页 3长长长长长长长长
+ 标签 1
+ 标签 2
+ 标签 3
+ 标签 4
+ 标签 5
+ TaskbarItemInfoExample
+ 技术测试
+ 测试
+ TextBlock:
+ TextBox
+ 主题
+ 消息提示位置
+ ToggleButton
+ ToolWindow
+ Top
+ TreeView
+ 更新
+ UWP
+ UniformGrid
+ 使用鼠标滚轮或触摸板水平滚动。
+ Vertical
+ 垂直 / 起始侧
+ 垂直分隔条 - 调整列宽
+ 垂直网格
+ 虚拟化(5000 项)
+ 投票
+ WGS84
+ WGS84 -> GCJ02
+ WPF
+ WPFDevelopers
+ WPFDevelopers 标志
+ WPFDevelopers.Avalonia
+ 警告
+ 警告消息提示
+ WebAPI
+ 白板
+ WinForm
+ WinUI
+ Window
+ WrapPanel
+ X
+ XAML
+ XXXYYY
+ Xamarin
+ YanJinHua
+ 是 / 否 / 取消
+ 放大
+ 缩小
+ 活动
+ 内容...
+ 许可证
+ 选择时间
+ 标签
+ 版本
+ wd:WDScrollViewer
+ 한국어
+ 343DST.com
+ ABCV.wang
+ 由 C# 点击事件添加。
+ 阿里巴巴
+ Apple
+ 背景
+ 百度
+ 北京
+ Bing
+ 黑色
+ 基础边框
+ 已取消
+ 车辆
+ 图表填充
+ 图表 X 轴
+ 命令跳页点击:{page}
+ 命令下一页点击:{param}
+ 命令页码点击:{page}
+ 命令上一页点击:{param}
+ 已完成
+ 已确认:姓名:{model.Name} - 邮箱:{model.Email}
+ 创建服务站点。
+ 已创建
+ 日
+ 双屏
+ Edge
+ 事件 {_eventNumber}
+ F2
+ 传真
+ 周五
+ Google
+ 进行中
+ 项目 {i}
+ 跳页点击:当前页={pagination.Current}
+ 更浅色
+ MB
+ Markdown 文件 (*.md)|*.md|所有文件 (*.*)|*.*
+ 菜单 01
+ 菜单 02
+ 菜单 03
+ Microsoft
+ 周一
+ 月
+ 鼠标悬停
+ 姓名{i}
+ 下一页点击:当前页={pagination.Current}
+ 雷德蒙德市微软路一号
+ Open AI
+ Open AI2
+ Open AI3
+ Open AI4
+ OpenAI.com
+ PPOI.xu
+ 页码点击:当前页={pagination.Current}
+ 占位文本
+ 上一页点击:当前页={pagination.Current}
+ 主色
+ 主要文本
+ 常规文本
+ 跑步者
+ 菜鸟教程
+ 周六
+ 保存为 Excel
+ 保存为图片
+ 保存为 PDF
+ 保存为 Word
+ 阴影深度
+ 上海
+ 单屏
+ 解决初始网络问题。
+ Stack Overflow
+ 步骤 1
+ 步骤 2
+ 步骤 3
+ 步骤 4
+ 周日
+ 技术测试正在进行中。
+ 电话
+ The Shy
+ 这是一条通过窗口句柄显示的消息提示
+ 这是一条成功消息提示
+ 这是一条错误消息提示
+ 这是一条信息消息提示
+ 这是一条询问消息提示
+ 这是一条警告消息提示
+ 三屏
+ 周四
+ 周二
+ 由 C# 点击事件更新。
+ WD.BackgroundBrush
+ WD.BaseBrush
+ WD.BaseMoveBrush
+ WD.BlackBrush
+ WD.ChartFillBrush
+ WD.ChartXAxisBrush
+ WD.DangerBrush
+ WD.DangerMouseOverBrush
+ WD.LightBrush
+ WD.LighterBrush
+ WD.PlaceholderTextBrush
+ WD.PrimaryBrush
+ WD.PrimaryMouseOverBrush
+ WD.PrimaryTextBrush
+ WD.RegularTextBrush
+ WD.ShadowDepthColor
+ WD.SuccessBrush
+ WD.SuccessMouseOverBrush
+ WD.WarningBrush
+ WD.WarningMouseOverBrush
+ WPFDevelopers1.1
+ WPFDevelopers1.1.1
+ WPFDevelopers1.2
+ WPFDevelopers1.3
+ WPFDevelopers1.4
+ WPFDevelopers1.5
+ WPFDevelopers1.6
+ 周三
+ 周
+ 小米
+ 年
+ 点击主按钮 {btn.Content.ToString()}
+ 图片文件|*.jpg
+ josh.peng
+ 地图
+ {sourceType} -> {targetType} 经度={converted.Longitude:F6} 纬度={converted.Latitude:F6}
+ Start
+ Alternate
+ End
+ 由 ViewModel 命令添加。
+ 通过 INotifyPropertyChanged 更新。
+ 已确认:姓名:{Name} - 邮箱:{Email}
+ 命令:点击了图片 - {model.Title}
+ 幻灯片 0
+ 幻灯片 1
+ 幻灯片 2
+ 幻灯片 3
+ 仓{(i + 1).ToString()}
+ CheckMark
+ ChevronUp
+ ChevronDown
+ Blackout
+ Previous
+ ChevronLeft
+ ChevronRight
+ SortArrow
+ WindowMaximize
+ WindowRestore
+ WindowClose
+ SmileyOutline
+ BuildingRegular
+ AlarmClock
+ Flag
+ Circular
+ ChatLeft
+ ChatRight
+ Complete
+ MapPin
+ Sector
+ Replace
+ AudioOne
+ AudioTwo
+ AudioThree
+ Rectangle
+ Ellipse
+ UpperTriangle
+ Arrow
+ ArrowRightTop
+ ArrowBranches
+ Text
+ Pencil
+ Mosaic
+ StarSky
+ Return
+ UnfoldMore
+ Time
+ DateRangeRight
+ Undo
+ Filter
+ Confirm
+ Semicircle
+ UpArrow
+ DownArrow
+ Splitter
+ Moon
+ SystemTheme
+ 瀑布流图片加载失败
+ GitHub 统计加载失败:{error}。请点击“刷新统计”重试。
+ NuGet 统计加载失败:{error}。请点击“刷新统计”重试。
+ 统计加载失败:{error}。请点击“刷新统计”重试。
+ 更新于 {time} · 下载量为 NuGet 所有版本累计下载量
+ 无法打开链接:{error}
+ 个性化
+ 主题色
+ 是
+
\ No newline at end of file
diff --git a/src/WPFDevelopers.Samples.Shared/SampleLanguageManager.cs b/src/WPFDevelopers.Samples.Shared/SampleLanguageManager.cs
new file mode 100644
index 00000000..6fadfb21
--- /dev/null
+++ b/src/WPFDevelopers.Samples.Shared/SampleLanguageManager.cs
@@ -0,0 +1,611 @@
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Globalization;
+using System.Resources;
+using System.Runtime.CompilerServices;
+using System.Text;
+using System.Text.RegularExpressions;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Controls.Primitives;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Media;
+using System.Windows.Media.Media3D;
+using System.Windows.Threading;
+using WPFDevelopers;
+
+namespace WPFDevelopers.Samples
+{
+ public sealed class SampleLanguageManager
+ {
+ private static readonly Lazy LazyInstance =
+ new Lazy(() => new SampleLanguageManager());
+ private readonly ResourceManager _resourceManager;
+ private readonly Dictionary _resourceKeys =
+ new Dictionary(StringComparer.OrdinalIgnoreCase);
+ private readonly List _translationPatterns = new List();
+ private readonly ConditionalWeakTable> _localizedValues =
+ new ConditionalWeakTable>();
+ private readonly List _exampleViews = new List();
+ private bool _initialized;
+
+ private SampleLanguageManager()
+ {
+ _resourceManager = new ResourceManager(
+ "WPFDevelopers.Samples.Languages.SamplesLanguage",
+ typeof(SampleLanguageManager).Assembly);
+ LoadTranslationPatterns();
+ }
+
+ public static SampleLanguageManager Instance => LazyInstance.Value;
+
+ public string TranslateText(string text)
+ {
+ if (string.IsNullOrEmpty(text))
+ {
+ return text;
+ }
+
+ var key = Regex.Replace(text, @"\s+", " ").Trim();
+ return GetTranslation(key, LanguageManager.Instance.CurrentCulture) ?? text;
+ }
+
+ public void SetLocalizedText(DependencyObject element, DependencyProperty property, string text)
+ {
+ if (element == null)
+ throw new ArgumentNullException(nameof(element));
+ if (property == null)
+ throw new ArgumentNullException(nameof(property));
+ if (text == null)
+ throw new ArgumentNullException(nameof(text));
+
+ var values = _localizedValues.GetOrCreateValue(element);
+ if (!values.TryGetValue(property, out var value))
+ {
+ value = new LocalizedValue(text);
+ values.Add(property, value);
+ }
+
+ value.OriginalValue = text;
+ ApplyTranslation(element, property, value);
+ }
+
+ public void RegisterExampleView(FrameworkElement element)
+ {
+ if (element == null)
+ {
+ throw new ArgumentNullException(nameof(element));
+ }
+
+ if (_exampleViews.Exists(reference => ReferenceEquals(reference.Target, element)))
+ {
+ LocalizeTree(element);
+ return;
+ }
+
+ _exampleViews.Add(new WeakReference(element));
+ LocalizeTree(element);
+ }
+
+ public void Initialize()
+ {
+ if (_initialized)
+ {
+ return;
+ }
+
+ _initialized = true;
+ LanguageManager.Instance.PropertyChanged += LanguageManager_PropertyChanged;
+ EventManager.RegisterClassHandler(
+ typeof(FrameworkElement),
+ FrameworkElement.LoadedEvent,
+ new RoutedEventHandler(FrameworkElement_Loaded),
+ true);
+ }
+
+ private void FrameworkElement_Loaded(object sender, RoutedEventArgs e)
+ {
+ if (!(sender is FrameworkElement element))
+ {
+ return;
+ }
+
+ if (IsExampleView(element.GetType()))
+ {
+ RegisterExampleView(element);
+ return;
+ }
+
+ if (!ReferenceEquals(sender, e.OriginalSource))
+ {
+ return;
+ }
+
+ if (!IsWithinExampleView(element))
+ {
+ return;
+ }
+
+ if (element is TextBlock)
+ {
+ LocalizeTree(element);
+ }
+ else
+ {
+ LocalizeElement(element);
+ }
+ }
+
+ private static bool IsWithinExampleView(DependencyObject element)
+ {
+ var current = GetParent(element);
+ while (current != null)
+ {
+ if (IsExampleView(current.GetType()))
+ {
+ return true;
+ }
+
+ current = GetParent(current);
+ }
+
+ return false;
+ }
+
+ private static DependencyObject GetParent(DependencyObject element)
+ {
+ if (element is ContextMenu contextMenu && contextMenu.PlacementTarget != null)
+ {
+ return contextMenu.PlacementTarget;
+ }
+
+ if (element is ToolTip toolTip && toolTip.PlacementTarget != null)
+ {
+ return toolTip.PlacementTarget;
+ }
+
+ var parent = LogicalTreeHelper.GetParent(element);
+ if (parent != null)
+ {
+ return parent;
+ }
+
+ return element is Visual || element is Visual3D
+ ? VisualTreeHelper.GetParent(element)
+ : null;
+ }
+
+ private void LanguageManager_PropertyChanged(object sender, PropertyChangedEventArgs e)
+ {
+ if (e.PropertyName != nameof(LanguageManager.CurrentCulture))
+ {
+ return;
+ }
+
+ var dispatcher = Application.Current?.Dispatcher;
+ if (dispatcher == null)
+ {
+ return;
+ }
+
+ if (dispatcher.CheckAccess())
+ {
+ LocalizeExampleViews();
+ }
+ else
+ {
+ dispatcher.BeginInvoke(new Action(LocalizeExampleViews), DispatcherPriority.DataBind);
+ }
+ }
+
+ private void LocalizeExampleViews()
+ {
+ for (var index = _exampleViews.Count - 1; index >= 0; index--)
+ {
+ var reference = _exampleViews[index];
+ var element = reference.Target as DependencyObject;
+ if (element == null)
+ {
+ _exampleViews.RemoveAt(index);
+ continue;
+ }
+
+ if (element is FrameworkElement frameworkElement && !frameworkElement.IsLoaded)
+ {
+ continue;
+ }
+
+ LocalizeTree(element);
+ }
+ }
+
+ public void LocalizeTree(DependencyObject root)
+ {
+ if (root == null)
+ {
+ throw new ArgumentNullException(nameof(root));
+ }
+
+ var visited = new HashSet();
+ var pending = new Stack();
+ pending.Push(root);
+
+ while (pending.Count > 0)
+ {
+ var element = pending.Pop();
+ if (!visited.Add(element))
+ {
+ continue;
+ }
+
+ LocalizeElement(element);
+
+ if (element is FrameworkElement frameworkElement && frameworkElement.ContextMenu != null)
+ {
+ pending.Push(frameworkElement.ContextMenu);
+ }
+
+ if (element is DataGrid dataGrid)
+ {
+ foreach (var column in dataGrid.Columns)
+ {
+ LocalizeElement(column);
+ }
+ }
+
+ if (element is ListView listView && listView.View is GridView gridView)
+ {
+ foreach (var column in gridView.Columns)
+ {
+ LocalizeElement(column);
+ }
+ }
+
+ // Plain TextBlock.Text owns its generated Run; translating both overwrites the cached source.
+ if (element is TextBlock plainTextBlock &&
+ (plainTextBlock.ReadLocalValue(TextBlock.TextProperty) is string ||
+ BindingOperations.IsDataBound(plainTextBlock, TextBlock.TextProperty)))
+ {
+ continue;
+ }
+
+ foreach (var child in LogicalTreeHelper.GetChildren(element))
+ {
+ if (child is DependencyObject dependencyObject)
+ {
+ pending.Push(dependencyObject);
+ }
+ }
+
+ if (element is Visual || element is Visual3D)
+ {
+ var childCount = VisualTreeHelper.GetChildrenCount(element);
+ for (var index = 0; index < childCount; index++)
+ {
+ pending.Push(VisualTreeHelper.GetChild(element, index));
+ }
+ }
+
+ if (element is TextBlock textBlock)
+ {
+ foreach (Inline inline in textBlock.Inlines)
+ {
+ pending.Push(inline);
+ }
+ }
+
+ if (element is Span span)
+ {
+ foreach (Inline inline in span.Inlines)
+ {
+ pending.Push(inline);
+ }
+ }
+ }
+ }
+
+ private void LocalizeElement(DependencyObject element)
+ {
+ var ancestor = element;
+ while (ancestor != null)
+ {
+ if (ancestor is ComboBoxItem languageItem &&
+ (string.Equals(languageItem.Tag as string, "zh-cn", StringComparison.OrdinalIgnoreCase) ||
+ string.Equals(languageItem.Tag as string, "en-US", StringComparison.OrdinalIgnoreCase) ||
+ string.Equals(languageItem.Tag as string, "ko-KR", StringComparison.OrdinalIgnoreCase)))
+ {
+ return;
+ }
+
+ ancestor = GetParent(ancestor);
+ }
+
+ var localValues = element.GetLocalValueEnumerator();
+ while (localValues.MoveNext())
+ {
+ var entry = localValues.Current;
+ if ((entry.Value is string || BindingOperations.IsDataBound(element, entry.Property)) &&
+ IsTextProperty(entry.Property.Name) &&
+ !(entry.Property.Name == "Text" &&
+ (element is TextBoxBase || element is ComboBox)))
+ {
+ LocalizeProperty(element, entry.Property);
+ }
+ }
+ }
+
+ private static bool IsTextProperty(string propertyName)
+ {
+ switch (propertyName)
+ {
+ case "Content":
+ case "Description":
+ case "Format":
+ case "Header":
+ case "HelpText":
+ case "Hint":
+ case "Label":
+ case "Message":
+ case "Name":
+ case "Placeholder":
+ case "Prompt":
+ case "Text":
+ case "Title":
+ case "ToolTip":
+ case "Watermark":
+ return true;
+ default:
+ return false;
+ }
+ }
+
+ private void LocalizeProperty(DependencyObject element, DependencyProperty property)
+ {
+ var localValue = element.ReadLocalValue(property);
+ var isDataBound = BindingOperations.IsDataBound(element, property);
+ var source = localValue as string;
+ if (source == null && isDataBound)
+ {
+ source = element.GetValue(property) as string;
+ }
+
+ if (source == null)
+ {
+ return;
+ }
+
+ var localizedValues = _localizedValues.GetOrCreateValue(element);
+ if (!localizedValues.TryGetValue(property, out var localizedValue))
+ {
+ localizedValue = new LocalizedValue(source);
+ localizedValues.Add(property, localizedValue);
+ }
+ else if (!string.Equals(source, localizedValue.AppliedValue, StringComparison.Ordinal))
+ {
+ localizedValue.OriginalValue = source;
+ }
+
+ ApplyTranslation(element, property, localizedValue);
+ }
+
+ private void ApplyTranslation(
+ DependencyObject element,
+ DependencyProperty property,
+ LocalizedValue localizedValue)
+ {
+ if (localizedValue.PropertyDescriptor == null)
+ {
+ AttachValueChanged(element, property, localizedValue);
+ }
+
+ var key = Regex.Replace(localizedValue.OriginalValue, @"\s+", " ").Trim();
+ var translation = GetTranslation(key, LanguageManager.Instance.CurrentCulture);
+ localizedValue.AppliedValue = translation ?? localizedValue.OriginalValue;
+ localizedValue.IsApplyingTranslation = true;
+ try
+ {
+ if (BindingOperations.IsDataBound(element, property))
+ {
+ element.SetCurrentValue(property, localizedValue.AppliedValue);
+ }
+ else
+ {
+ element.SetValue(property, localizedValue.AppliedValue);
+ }
+ }
+ finally
+ {
+ localizedValue.IsApplyingTranslation = false;
+ }
+ }
+
+ private void AttachValueChanged(
+ DependencyObject element,
+ DependencyProperty property,
+ LocalizedValue localizedValue)
+ {
+ var descriptor = DependencyPropertyDescriptor.FromProperty(property, element.GetType());
+ if (descriptor == null)
+ {
+ return;
+ }
+
+ EventHandler handler = (sender, args) =>
+ {
+ if (!localizedValue.IsApplyingTranslation &&
+ !string.Equals(
+ element.GetValue(property) as string,
+ localizedValue.AppliedValue,
+ StringComparison.Ordinal))
+ {
+ LocalizeProperty(element, property);
+ }
+ };
+
+ descriptor.AddValueChanged(element, handler);
+ localizedValue.PropertyDescriptor = descriptor;
+ localizedValue.ValueChangedHandler = handler;
+ if (element is FrameworkElement frameworkElement)
+ {
+ RoutedEventHandler unloadedHandler = null;
+ unloadedHandler = (sender, args) =>
+ {
+ frameworkElement.Unloaded -= unloadedHandler;
+ DetachValueChanged(element, localizedValue);
+ };
+ frameworkElement.Unloaded += unloadedHandler;
+ }
+ }
+
+ private static void DetachValueChanged(
+ DependencyObject element,
+ LocalizedValue localizedValue)
+ {
+ if (localizedValue.PropertyDescriptor != null && localizedValue.ValueChangedHandler != null)
+ {
+ localizedValue.PropertyDescriptor.RemoveValueChanged(element, localizedValue.ValueChangedHandler);
+ localizedValue.PropertyDescriptor = null;
+ localizedValue.ValueChangedHandler = null;
+ }
+ }
+
+ private void LoadTranslationPatterns()
+ {
+ var resources = _resourceManager.GetResourceSet(CultureInfo.InvariantCulture, true, false);
+ if (resources == null)
+ {
+ throw new MissingManifestResourceException(
+ "The neutral sample-language resource was not embedded.");
+ }
+
+ foreach (DictionaryEntry entry in resources)
+ {
+ if (!(entry.Key is string key))
+ {
+ continue;
+ }
+
+ _resourceKeys.Add(key, key);
+
+ var placeholders = Regex.Matches(key, @"\{[^{}]+\}");
+ if (placeholders.Count == 0)
+ {
+ continue;
+ }
+
+ var pattern = new StringBuilder("^");
+ var offset = 0;
+ foreach (Match placeholder in placeholders)
+ {
+ pattern.Append(Regex.Escape(key.Substring(offset, placeholder.Index - offset)));
+ pattern.Append("(.*?)");
+ offset = placeholder.Index + placeholder.Length;
+ }
+
+ pattern.Append(Regex.Escape(key.Substring(offset)));
+ pattern.Append("$");
+ _translationPatterns.Add(new TranslationPattern(
+ key,
+ new Regex(pattern.ToString(), RegexOptions.CultureInvariant)));
+ }
+
+ _translationPatterns.Sort((left, right) => right.Key.Length.CompareTo(left.Key.Length));
+ }
+
+ private string GetTranslation(string key, CultureInfo culture)
+ {
+ var resourceKey = _resourceKeys.TryGetValue(key, out var canonicalKey)
+ ? canonicalKey
+ : key;
+ var translation = _resourceManager.GetString(resourceKey, culture);
+ if (string.Equals(key, "new", StringComparison.Ordinal) &&
+ culture.TwoLetterISOLanguageName == "en" &&
+ string.Equals(translation, "NEW", StringComparison.Ordinal))
+ {
+ translation = "New";
+ }
+
+ if (translation != null)
+ {
+ return translation;
+ }
+
+ foreach (var pattern in _translationPatterns)
+ {
+ var match = pattern.Regex.Match(key);
+ if (!match.Success)
+ {
+ continue;
+ }
+
+ translation = _resourceManager.GetString(pattern.Key, culture);
+ if (translation == null)
+ {
+ continue;
+ }
+
+ var placeholders = Regex.Matches(translation, @"\{[^{}]+\}");
+ if (placeholders.Count != match.Groups.Count - 1)
+ {
+ continue;
+ }
+
+ for (var index = placeholders.Count - 1; index >= 0; index--)
+ {
+ var placeholder = placeholders[index];
+ translation = translation.Remove(placeholder.Index, placeholder.Length)
+ .Insert(placeholder.Index, match.Groups[index + 1].Value);
+ }
+
+ return translation;
+ }
+
+ return null;
+ }
+
+ private static bool IsExampleView(Type type)
+ {
+ var typeNamespace = type.Namespace;
+ return IsInExampleNamespace(typeNamespace, "WPFDevelopers.Samples.ExampleViews") ||
+ IsInExampleNamespace(typeNamespace, "WPFDevelopers.Sample.ExampleViews");
+ }
+
+ private static bool IsInExampleNamespace(string typeNamespace, string exampleNamespace)
+ {
+ return typeNamespace == exampleNamespace ||
+ (typeNamespace != null && typeNamespace.StartsWith(
+ exampleNamespace + ".",
+ StringComparison.Ordinal));
+ }
+
+ private sealed class LocalizedValue
+ {
+ public LocalizedValue(string originalValue)
+ {
+ OriginalValue = originalValue;
+ AppliedValue = originalValue;
+ }
+
+ public string OriginalValue { get; set; }
+ public string AppliedValue { get; set; }
+ public bool IsApplyingTranslation { get; set; }
+ public DependencyPropertyDescriptor PropertyDescriptor { get; set; }
+ public EventHandler ValueChangedHandler { get; set; }
+ }
+
+ private sealed class TranslationPattern
+ {
+ public TranslationPattern(string key, Regex regex)
+ {
+ Key = key;
+ Regex = regex;
+ }
+
+ public string Key { get; }
+ public Regex Regex { get; }
+ }
+ }
+}
diff --git a/src/WPFDevelopers.Samples.Shared/ViewModels/DialogExampleVM.cs b/src/WPFDevelopers.Samples.Shared/ViewModels/DialogExampleVM.cs
new file mode 100644
index 00000000..8af3a232
--- /dev/null
+++ b/src/WPFDevelopers.Samples.Shared/ViewModels/DialogExampleVM.cs
@@ -0,0 +1,94 @@
+using System;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Data;
+using System.Windows.Input;
+using WPFDevelopers.Controls;
+using WPFDevelopers.Samples.ExampleViews;
+using WPFDevelopers.Samples.Helpers;
+
+namespace WPFDevelopers.Samples.ViewModels
+{
+ public class DialogExampleVM : ViewModelBase
+ {
+ private string _name;
+ private string _email;
+ private bool _isEnable;
+ private string _resultText;
+
+ public DialogExampleVM()
+ {
+ OpenDialogCommand = new RelayCommand(parameter =>
+ {
+ if (!(parameter is DependencyObject view))
+ throw new ArgumentException("The command parameter must be the dialog's owner view.", nameof(parameter));
+
+ Name = string.Empty;
+ Email = string.Empty;
+ IsEnable = false;
+ var diaUser = new DialogUserControl();
+ diaUser.DataContext = this;
+ var dialog = new Dialog
+ {
+ Title = "编辑",
+ Content = diaUser,
+ Owner = Window.GetWindow(view),
+ DialogWidth = 440
+ };
+ dialog.SetBinding(Dialog.IsConfirmEnabledProperty, new Binding("CanConfirm")
+ {
+ Source = this
+ });
+ dialog.Closing += diaUser.OnDialogClosing;
+ dialog.ClosedCommand = DialogClosedCommand;
+ dialog.ShowAsync();
+ });
+ DialogClosedCommand = new RelayCommand(parameter =>
+ {
+ var result = (DialogResult)parameter == DialogResult.Confirmed;
+ ResultText = result ? "Confirmed: " + $"name:{Name} - email:{Email}" : "Canceled";
+ if (result)
+ Toast.Push("修改成功", ToastImage.Success);
+ });
+ }
+
+ public string Name
+ {
+ get => _name;
+ set
+ {
+ if (SetProperty(ref _name, value, nameof(Name)))
+ NotifyPropertyChange(nameof(CanConfirm));
+ }
+ }
+ public string Email
+ {
+ get => _email;
+ set
+ {
+ if (SetProperty(ref _email, value, nameof(Email)))
+ NotifyPropertyChange(nameof(CanConfirm));
+ }
+ }
+ public bool IsEnable
+ {
+ get => _isEnable;
+ set
+ {
+ if (SetProperty(ref _isEnable, value, nameof(IsEnable)))
+ NotifyPropertyChange(nameof(CanConfirm));
+ }
+ }
+
+ public bool CanConfirm => !string.IsNullOrWhiteSpace(Name) && !string.IsNullOrWhiteSpace(Email);
+
+ public string ResultText
+ {
+ get => _resultText;
+ private set => SetProperty(ref _resultText, value, nameof(ResultText));
+ }
+
+ public ICommand OpenDialogCommand { get; private set; }
+ public ICommand DialogClosedCommand { get; private set; }
+ }
+}
diff --git a/src/WPFDevelopers.Samples.Shared/ViewModels/MainVM.cs b/src/WPFDevelopers.Samples.Shared/ViewModels/MainVM.cs
index d182cda0..16c5de22 100644
--- a/src/WPFDevelopers.Samples.Shared/ViewModels/MainVM.cs
+++ b/src/WPFDevelopers.Samples.Shared/ViewModels/MainVM.cs
@@ -1,4 +1,4 @@
-using Microsoft.Expression.Drawing.Core;
+using Microsoft.Expression.Drawing.Core;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
@@ -51,6 +51,7 @@ public class MainVM : ViewModelBase
nameof(MenuEnum.Expander),
nameof(MenuEnum.GroupBox),
nameof(MenuEnum.TabControl),
+ nameof(MenuEnum.ScrollViewer),
nameof(MenuEnum.TaskbarInfo),
};
@@ -89,6 +90,7 @@ public class MainVM : ViewModelBase
private static readonly HashSet NewMenuItems = new HashSet
{
+ MenuEnum.Dialog,
MenuEnum.ScrollNavigation,
MenuEnum.Timeline,
MenuEnum.Carousel,
@@ -208,12 +210,12 @@ public int SegmentedSelectedIndex
get { return _segmentedSelectedIndex; }
set
{
+ if (_segmentedSelectedIndex == value) return;
_segmentedSelectedIndex = value;
NotifyPropertyChange("SegmentedSelectedIndex");
+ ShowHome();
NavigateMenuModelList = value == 1 ? _basicMenuModelList : _customMenuModelList;
ApplySearchFilter();
- if (NavigateMenuModelList.Count > 0)
- NavigateMenuItem = NavigateMenuModelList.FirstOrDefault(y => y.IsVisible);
}
}
@@ -285,6 +287,7 @@ private static string GetMenuIconSource(MenuEnum menuEnum)
iconName = "Palette";
break;
case MenuEnum.MessageBox:
+ case MenuEnum.Dialog:
case MenuEnum.Toast:
case MenuEnum.ChatEmoji:
case MenuEnum.Barrage:
@@ -545,18 +548,15 @@ private void LanguageManager_PropertyChanged(object sender, PropertyChangedEvent
private void UpdateMenuDisplayNames()
{
- var culture = LanguageManager.Instance.CurrentCulture;
- var isChinese = culture.TwoLetterISOLanguageName == "zh";
+ var localizer = SampleLanguageManager.Instance;
NotifyPropertyChange(nameof(IsChineseLanguage));
- SearchWatermark = isChinese ? "搜索控件" : "Search Control";
- CustomMenuLabel = isChinese ? "自定义" : "Custom";
- BasicMenuLabel = isChinese ? "基础控件" : "Basic";
- DemoBadgeToolTip = isChinese
- ? "示例专属实现或组合效果,非 WD 内置控件;请参考示例源码。"
- : "Sample-only implementation or composition, not a built-in WD control. See the sample source.";
+ SearchWatermark = localizer.TranslateText("搜索控件");
+ CustomMenuLabel = localizer.TranslateText("自定义");
+ BasicMenuLabel = localizer.TranslateText("基础控件");
+ DemoBadgeToolTip = localizer.TranslateText("示例专属实现或组合效果,非 WD 内置控件;请参考示例源码。");
foreach (var item in _customMenuModelList.Concat(_basicMenuModelList))
- item.DisplayName = MenuNameLocalizer.GetDisplayName(item.Name, culture);
+ item.DisplayName = MenuNameLocalizer.GetDisplayName(item.Name);
ApplySearchFilter();
}
@@ -705,6 +705,7 @@ void MenuItemSelection(string _menuName)
case MenuEnum.MessageBox:
ControlPanel = new MessageBoxExample();
break;
+
case MenuEnum.NotifyIcon:
ControlPanel = new NotifyIconExample();
break;
@@ -1004,6 +1005,9 @@ void MenuItemSelection(string _menuName)
case MenuEnum.Timeline:
ControlPanel = new TimelineExample();
break;
+ case MenuEnum.Dialog:
+ ControlPanel = new DialogExample();
+ break;
//新的添加到上方
case MenuEnum.VirtualizingWrapPanel:
ControlPanel = new VirtualizingWrapPanel();
diff --git a/src/WPFDevelopers.Samples.Shared/WPFDevelopers.Samples.Shared.projitems b/src/WPFDevelopers.Samples.Shared/WPFDevelopers.Samples.Shared.projitems
index 778eddc2..2b8e7eb0 100644
--- a/src/WPFDevelopers.Samples.Shared/WPFDevelopers.Samples.Shared.projitems
+++ b/src/WPFDevelopers.Samples.Shared/WPFDevelopers.Samples.Shared.projitems
@@ -1,4 +1,4 @@
-
+
$(MSBuildAllProjects);$(MSBuildThisFileFullPath)
@@ -12,6 +12,7 @@
$(MSBuildThisFileDirectory)app.manifest
+
HomeExample.xaml
@@ -46,6 +47,13 @@
+
+ ThemeSettings.xaml
+
+
+ MSBuild:Compile
+ Designer
+
@@ -111,6 +119,13 @@
MessageBoxExample.xaml
+
+ DialogExample.xaml
+
+
+ DialogUserControl.xaml
+
+
Code
NavMenu3DExample.xaml
@@ -798,6 +813,14 @@
MSBuild:Compile
Designer
+
+ Designer
+ MSBuild:Compile
+
+
+ MSBuild:Compile
+ Designer
+
MSBuild:Compile
Designer
@@ -1416,6 +1439,11 @@
Designer
+
+
+
+
+
Designer
diff --git a/src/WPFDevelopers.SamplesCode/WPFDevelopers.SamplesCode.csproj b/src/WPFDevelopers.SamplesCode/WPFDevelopers.SamplesCode.csproj
index 18af66d1..17f068b3 100644
--- a/src/WPFDevelopers.SamplesCode/WPFDevelopers.SamplesCode.csproj
+++ b/src/WPFDevelopers.SamplesCode/WPFDevelopers.SamplesCode.csproj
@@ -9,15 +9,15 @@
Debug;Release
-
+
+
+
+
+
@@ -172,6 +172,8 @@
+
+
diff --git a/src/WPFDevelopers.Shared/Controls/Dialog/Dialog.cs b/src/WPFDevelopers.Shared/Controls/Dialog/Dialog.cs
new file mode 100644
index 00000000..7847afd3
--- /dev/null
+++ b/src/WPFDevelopers.Shared/Controls/Dialog/Dialog.cs
@@ -0,0 +1,594 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Controls.Primitives;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Navigation;
+using System.Windows.Threading;
+using WPFDevelopers.Helpers;
+
+namespace WPFDevelopers.Controls
+{
+ public class Dialog : ContentControl
+ {
+ public static readonly DependencyProperty IsOpenProperty =
+ DependencyProperty.Register("IsOpen", typeof(bool), typeof(Dialog),
+ new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnIsOpenChanged));
+
+ public static readonly DependencyProperty ClosedCommandProperty =
+ DependencyProperty.Register("ClosedCommand", typeof(ICommand), typeof(Dialog), new PropertyMetadata(null));
+
+ public static readonly DependencyProperty CornerRadiusProperty =
+ Border.CornerRadiusProperty.AddOwner(typeof(Dialog),
+ new FrameworkPropertyMetadata(new CornerRadius(10), (d, e) => ((Dialog)d).UpdateCornerClip()));
+
+ public static readonly DependencyProperty TitleProperty =
+ DependencyProperty.Register("Title", typeof(string), typeof(Dialog), new PropertyMetadata("Dialog"));
+
+ public static readonly DependencyProperty OwnerProperty =
+ DependencyProperty.Register("Owner", typeof(System.Windows.Window), typeof(Dialog), new PropertyMetadata(null));
+
+ public static readonly DependencyProperty DialogWidthProperty =
+ DependencyProperty.Register("DialogWidth", typeof(double), typeof(Dialog),
+ new PropertyMetadata(440d), IsValidDimension);
+
+ public static readonly DependencyProperty DialogHeightProperty =
+ DependencyProperty.Register("DialogHeight", typeof(double), typeof(Dialog),
+ new PropertyMetadata(double.NaN), IsValidDimension);
+
+ public static readonly DependencyProperty ShowFooterProperty =
+ DependencyProperty.Register("ShowFooter", typeof(bool), typeof(Dialog), new PropertyMetadata(true));
+
+ public static readonly DependencyProperty ConfirmTextProperty =
+ DependencyProperty.Register("ConfirmText", typeof(string), typeof(Dialog), new PropertyMetadata(null));
+
+ public static readonly DependencyProperty CancelTextProperty =
+ DependencyProperty.Register("CancelText", typeof(string), typeof(Dialog), new PropertyMetadata(null));
+
+ public static readonly DependencyProperty IsConfirmEnabledProperty =
+ DependencyProperty.Register("IsConfirmEnabled", typeof(bool), typeof(Dialog), new PropertyMetadata(true));
+
+ private static readonly DependencyPropertyKey DisplayContentPropertyKey =
+ DependencyProperty.RegisterReadOnly("DisplayContent", typeof(object), typeof(Dialog), new PropertyMetadata(null));
+
+ public static readonly DependencyProperty DisplayContentProperty = DisplayContentPropertyKey.DependencyProperty;
+
+ public static readonly RoutedUICommand OpenCommand = new RoutedUICommand("Open", "Open", typeof(Dialog));
+ public static readonly RoutedUICommand ConfirmCommand = new RoutedUICommand("Confirm", "Confirm", typeof(Dialog));
+ public static readonly RoutedUICommand CancelCommand = new RoutedUICommand("Cancel", "Cancel", typeof(Dialog));
+ public static readonly RoutedUICommand CloseCommand = new RoutedUICommand("Close", "Close", typeof(Dialog));
+
+ public event EventHandler Closing;
+ public event EventHandler Closed;
+
+ private static readonly Dictionary OpenDialogs = new Dictionary();
+ private DialogAdorner _adorner;
+ private AdornerLayer _layer;
+ private Window _owner;
+ private UIElement _background;
+ private bool _backgroundEnabled;
+ private IInputElement _previousFocus;
+ private Frame _frame;
+ private TaskCompletionSource _completion;
+ private bool _closing;
+
+ static Dialog()
+ {
+ DefaultStyleKeyProperty.OverrideMetadata(typeof(Dialog), new FrameworkPropertyMetadata(typeof(Dialog)));
+ ContentProperty.OverrideMetadata(typeof(Dialog), new FrameworkPropertyMetadata(null, null, CoerceContent));
+ }
+
+ public Dialog()
+ {
+ CommandBindings.Add(new CommandBinding(OpenCommand,
+ (sender, e) => SetCurrentValue(IsOpenProperty, true),
+ (sender, e) => e.CanExecute = _adorner == null));
+ CommandBindings.Add(new CommandBinding(ConfirmCommand,
+ (sender, e) => Close(DialogCloseReason.Confirm),
+ (sender, e) => e.CanExecute = _adorner != null && IsConfirmEnabled));
+ CommandBindings.Add(new CommandBinding(CancelCommand,
+ (sender, e) => Close(DialogCloseReason.Cancel),
+ (sender, e) => e.CanExecute = _adorner != null));
+ CommandBindings.Add(new CommandBinding(CloseCommand,
+ (sender, e) => Close(DialogCloseReason.CloseButton),
+ (sender, e) => e.CanExecute = _adorner != null));
+ KeyboardNavigation.SetTabNavigation(this, KeyboardNavigationMode.Cycle);
+ KeyboardNavigation.SetControlTabNavigation(this, KeyboardNavigationMode.Cycle);
+ FocusManager.SetIsFocusScope(this, true);
+ }
+
+ public bool IsOpen
+ {
+ get => (bool)GetValue(IsOpenProperty);
+ set => SetValue(IsOpenProperty, value);
+ }
+
+ public ICommand ClosedCommand
+ {
+ get => (ICommand)GetValue(ClosedCommandProperty);
+ set => SetValue(ClosedCommandProperty, value);
+ }
+
+ public CornerRadius CornerRadius
+ {
+ get => (CornerRadius)GetValue(CornerRadiusProperty);
+ set => SetValue(CornerRadiusProperty, value);
+ }
+
+ public string Title
+ {
+ get => (string)GetValue(TitleProperty);
+ set => SetValue(TitleProperty, value);
+ }
+
+ public Window Owner
+ {
+ get => (Window)GetValue(OwnerProperty);
+ set => SetValue(OwnerProperty, value);
+ }
+
+ public double DialogWidth
+ {
+ get => (double)GetValue(DialogWidthProperty);
+ set => SetValue(DialogWidthProperty, value);
+ }
+
+ public double DialogHeight
+ {
+ get => (double)GetValue(DialogHeightProperty);
+ set => SetValue(DialogHeightProperty, value);
+ }
+
+ public bool ShowFooter
+ {
+ get => (bool)GetValue(ShowFooterProperty);
+ set => SetValue(ShowFooterProperty, value);
+ }
+
+ public string ConfirmText
+ {
+ get => (string)GetValue(ConfirmTextProperty);
+ set => SetValue(ConfirmTextProperty, value);
+ }
+
+ public string CancelText
+ {
+ get => (string)GetValue(CancelTextProperty);
+ set => SetValue(CancelTextProperty, value);
+ }
+
+ public bool IsConfirmEnabled
+ {
+ get => (bool)GetValue(IsConfirmEnabledProperty);
+ set => SetValue(IsConfirmEnabledProperty, value);
+ }
+
+ public object DisplayContent => GetValue(DisplayContentProperty);
+
+ private static void OnIsOpenChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
+ {
+ var dialog = (Dialog)d;
+ if ((bool)e.NewValue)
+ {
+ if (dialog._adorner == null)
+ {
+ try { dialog.ShowAsync(); }
+ catch
+ {
+ dialog.SetCurrentValue(IsOpenProperty, false);
+ throw;
+ }
+ }
+ }
+ else if (dialog._adorner != null)
+ {
+ try { dialog.Close(); }
+ finally
+ {
+ if (dialog._adorner != null)
+ {
+ dialog.SetCurrentValue(IsOpenProperty, true);
+ var adorner = dialog._adorner;
+ dialog.Dispatcher.BeginInvoke(DispatcherPriority.DataBind, new Action(() =>
+ {
+ if (dialog._adorner == adorner)
+ {
+ dialog.SetCurrentValue(IsOpenProperty, true);
+ BindingOperations.GetBindingExpression(dialog, IsOpenProperty)?.UpdateSource();
+ }
+ }));
+ }
+ }
+ }
+ }
+
+ private static bool IsValidDimension(object value)
+ {
+ var dimension = (double)value;
+ return double.IsNaN(dimension) || (dimension > 0 && !double.IsInfinity(dimension));
+ }
+
+ private static object CoerceContent(DependencyObject d, object value)
+ {
+ var host = (Dialog)d;
+ if (host._adorner != null && !ReferenceEquals(host.Content, value))
+ throw new InvalidOperationException("Dialog.Content cannot be changed while the dialog is open.");
+ if (value != null && !(value is UserControl) && !(value is Page))
+ throw new ArgumentException("Dialog.Content must be a UserControl or Page.");
+ if (value != null)
+ {
+ var element = (FrameworkElement)value;
+ var parent = LogicalTreeHelper.GetParent(element);
+ if ((parent != null && parent != host) || VisualTreeHelper.GetParent(element) != null)
+ throw new InvalidOperationException("Dialog.Content is already attached to another container.");
+ }
+ return value;
+ }
+
+ protected override void OnContentChanged(object oldContent, object newContent)
+ {
+ base.OnContentChanged(oldContent is Page ? null : oldContent, newContent is Page ? null : newContent);
+ }
+
+ public Task ShowAsync(Window owner = null)
+ {
+ VerifyAccess();
+ if (_adorner != null)
+ throw new InvalidOperationException("This Dialog is already open.");
+ if (Content == null)
+ throw new InvalidOperationException("Dialog.Content is required.");
+ if (Parent != null || VisualTreeHelper.GetParent(this) != null)
+ throw new InvalidOperationException("Dialog must not be attached to another container. Declare it in Resources or create it in code.");
+
+ var content = (FrameworkElement)Content;
+ var parent = LogicalTreeHelper.GetParent(content);
+ if ((parent != null && parent != this) || VisualTreeHelper.GetParent(content) != null)
+ throw new InvalidOperationException("Dialog.Content is already attached to another container.");
+
+ owner = owner ?? Owner ?? ControlsHelper.GetDefaultWindow();
+ if (owner == null || !owner.IsLoaded || !owner.IsVisible)
+ throw new InvalidOperationException("Dialog requires a visible, loaded owner Window.");
+ owner.ApplyTemplate();
+ var decorator = FindDecorator(owner);
+ if (decorator == null || decorator.Child == null)
+ throw new InvalidOperationException("The owner Window requires an AdornerDecorator around its client content.");
+ if (OpenDialogs.ContainsKey(owner))
+ throw new InvalidOperationException("The owner Window already has an open Dialog.");
+
+ _owner = owner;
+ _layer = decorator.AdornerLayer;
+ _background = decorator.Child;
+ _backgroundEnabled = _background.IsEnabled;
+ _previousFocus = Keyboard.FocusedElement;
+ _completion = new TaskCompletionSource();
+ var task = _completion.Task;
+ _adorner = new DialogAdorner(_background, this);
+ OpenDialogs.Add(owner, this);
+ try
+ {
+ if (content is Page)
+ {
+ _frame = new Frame
+ {
+ NavigationUIVisibility = NavigationUIVisibility.Hidden,
+ JournalOwnership = JournalOwnership.OwnsJournal
+ };
+ _frame.Content = content;
+ }
+ SetValue(DisplayContentPropertyKey, (object)_frame ?? content);
+ _background.IsEnabledChanged += OnBackgroundIsEnabledChanged;
+ if (_background is FrameworkElement backgroundElement)
+ backgroundElement.Unloaded += OnBackgroundUnloaded;
+ _background.SetCurrentValue(IsEnabledProperty, false);
+ _owner.Closed += OnOwnerClosed;
+ _owner.PreviewGotKeyboardFocus += OnOwnerPreviewGotKeyboardFocus;
+ _owner.AddHandler(CommandManager.PreviewExecutedEvent, new ExecutedRoutedEventHandler(OnOwnerPreviewExecuted), true);
+ _owner.AddHandler(Keyboard.KeyDownEvent, new KeyEventHandler(OnOwnerKeyDown), true);
+ Loaded += OnDialogLoaded;
+ _layer.Add(_adorner);
+ SetCurrentValue(IsOpenProperty, true);
+ CommandManager.InvalidateRequerySuggested();
+ return task;
+ }
+ catch
+ {
+ Cleanup();
+ throw;
+ }
+ }
+
+ public void Close(DialogCloseReason reason = DialogCloseReason.Cancel)
+ {
+ VerifyAccess();
+ if (!Enum.IsDefined(typeof(DialogCloseReason), reason))
+ throw new ArgumentOutOfRangeException(nameof(reason));
+ if (_adorner == null)
+ throw new InvalidOperationException("This Dialog is not open.");
+ if (reason == DialogCloseReason.Confirm && !IsConfirmEnabled)
+ throw new InvalidOperationException("Confirmation is disabled.");
+ if (_closing)
+ throw new InvalidOperationException("A dialog close operation is already in progress.");
+ _closing = true;
+ bool canClose;
+ try
+ {
+ canClose = CanClose(reason);
+ }
+ finally { _closing = false; }
+ if (canClose && _adorner != null)
+ Complete(reason == DialogCloseReason.Confirm ? DialogResult.Confirmed : DialogResult.Canceled);
+ }
+
+ internal bool CanClose(DialogCloseReason reason)
+ {
+ var valid = reason != DialogCloseReason.Confirm || UpdateSources(this);
+ var args = new DialogClosingEventArgs(reason) { Cancel = !valid };
+ Closing?.Invoke(this, args);
+ return valid && !args.Cancel;
+ }
+
+ private static AdornerDecorator FindDecorator(DependencyObject element)
+ {
+ var decorator = element as AdornerDecorator;
+ if (decorator != null)
+ return decorator;
+ for (var i = 0; i < VisualTreeHelper.GetChildrenCount(element); i++)
+ {
+ decorator = FindDecorator(VisualTreeHelper.GetChild(element, i));
+ if (decorator != null)
+ return decorator;
+ }
+ return null;
+ }
+
+ private void OnDialogLoaded(object sender, RoutedEventArgs e)
+ {
+ Dispatcher.BeginInvoke(DispatcherPriority.Input, new Action(() =>
+ {
+ if (_adorner != null)
+ FocusDialog();
+ }));
+ }
+
+ private void FocusDialog()
+ {
+ MoveFocus(new TraversalRequest(FocusNavigationDirection.First));
+ if (!IsKeyboardFocusWithin)
+ Keyboard.Focus(this);
+ }
+
+ private void OnOwnerPreviewGotKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e)
+ {
+ if (e.NewFocus is DependencyObject target && !IsDialogElement(target))
+ {
+ e.Handled = true;
+ Dispatcher.BeginInvoke(DispatcherPriority.Input, new Action(() =>
+ {
+ if (_adorner != null && !IsKeyboardFocusWithin)
+ FocusDialog();
+ }));
+ }
+ }
+
+ private bool IsDialogElement(DependencyObject element)
+ {
+ var pending = new Stack();
+ var visited = new HashSet();
+ pending.Push(element);
+ while (pending.Count > 0)
+ {
+ element = pending.Pop();
+ if (element == null || !visited.Add(element))
+ continue;
+ if (element == this)
+ return true;
+ pending.Push(LogicalTreeHelper.GetParent(element));
+ if (element is Visual || element is System.Windows.Media.Media3D.Visual3D)
+ pending.Push(VisualTreeHelper.GetParent(element));
+ if (element is FrameworkElement frameworkElement)
+ pending.Push(frameworkElement.TemplatedParent);
+ if (element is Popup popup)
+ pending.Push(popup.PlacementTarget);
+ if (element is ContextMenu menu)
+ pending.Push(menu.PlacementTarget);
+ }
+ return false;
+ }
+
+ private void OnBackgroundIsEnabledChanged(object sender, DependencyPropertyChangedEventArgs e)
+ {
+ if ((bool)e.NewValue)
+ _background.SetCurrentValue(IsEnabledProperty, false);
+ }
+
+ private void OnBackgroundUnloaded(object sender, RoutedEventArgs e)
+ {
+ if (_adorner != null)
+ Complete(DialogResult.Canceled);
+ }
+
+ private void OnOwnerPreviewExecuted(object sender, ExecutedRoutedEventArgs e)
+ {
+ if (!(e.OriginalSource is DependencyObject source) || !IsDialogElement(source))
+ e.Handled = true;
+ }
+
+ private void OnOwnerKeyDown(object sender, KeyEventArgs e)
+ {
+ if (!e.Handled && e.Key == Key.Escape)
+ {
+ Close(DialogCloseReason.Escape);
+ e.Handled = true;
+ }
+ }
+
+ protected override void OnKeyDown(KeyEventArgs e)
+ {
+ base.OnKeyDown(e);
+ if (e.Handled || _owner == null)
+ return;
+ foreach (InputBinding binding in _owner.InputBindings)
+ {
+ if (binding.Gesture != null && binding.Gesture.Matches(_owner, e))
+ {
+ e.Handled = true;
+ break;
+ }
+ }
+ }
+
+ private void OnOwnerClosed(object sender, EventArgs e)
+ {
+ Complete(DialogResult.Canceled);
+ }
+
+ private void Complete(DialogResult result)
+ {
+ var completion = _completion;
+ Cleanup();
+ try
+ {
+ Closed?.Invoke(this, EventArgs.Empty);
+ var command = ClosedCommand;
+ if (command != null && command.CanExecute(result))
+ command.Execute(result);
+ }
+ finally { completion.SetResult(result); }
+ }
+
+ private void Cleanup()
+ {
+ Loaded -= OnDialogLoaded;
+ _owner.Closed -= OnOwnerClosed;
+ _owner.PreviewGotKeyboardFocus -= OnOwnerPreviewGotKeyboardFocus;
+ _owner.RemoveHandler(CommandManager.PreviewExecutedEvent, new ExecutedRoutedEventHandler(OnOwnerPreviewExecuted));
+ _owner.RemoveHandler(Keyboard.KeyDownEvent, new KeyEventHandler(OnOwnerKeyDown));
+ _background.IsEnabledChanged -= OnBackgroundIsEnabledChanged;
+ if (_background is FrameworkElement backgroundElement)
+ backgroundElement.Unloaded -= OnBackgroundUnloaded;
+ _layer.Remove(_adorner);
+ _adorner.Detach();
+ SetValue(DisplayContentPropertyKey, null);
+ var presenter = GetTemplateChild("PART_ContentPresenter") as ContentPresenter;
+ if (presenter != null)
+ {
+ presenter.Content = null;
+ presenter.ClearValue(ContentPresenter.ContentProperty);
+ }
+ if (_frame != null)
+ {
+ _frame.Content = null;
+ var pagePresenter = VisualTreeHelper.GetParent((DependencyObject)Content) as ContentPresenter;
+ if (pagePresenter != null)
+ pagePresenter.Content = null;
+ _frame = null;
+ }
+ _background.SetCurrentValue(IsEnabledProperty, _backgroundEnabled);
+ BindingOperations.GetBindingExpression(_background, IsEnabledProperty)?.UpdateTarget();
+ OpenDialogs.Remove(_owner);
+ _adorner = null;
+ _completion = null;
+ _layer = null;
+ _background = null;
+ var previousFocus = _previousFocus;
+ _previousFocus = null;
+ var owner = _owner;
+ _owner = null;
+ if (owner.IsVisible && previousFocus is UIElement previousElement && previousElement.IsVisible && previousElement.IsEnabled)
+ Keyboard.Focus(previousFocus);
+ SetCurrentValue(IsOpenProperty, false);
+ CommandManager.InvalidateRequerySuggested();
+ }
+
+ protected override void OnPropertyChanged(DependencyPropertyChangedEventArgs e)
+ {
+ base.OnPropertyChanged(e);
+ if (e.Property == DialogWidthProperty || e.Property == DialogHeightProperty)
+ _adorner?.InvalidateMeasure();
+ }
+
+ protected override void OnRenderSizeChanged(SizeChangedInfo sizeInfo)
+ {
+ base.OnRenderSizeChanged(sizeInfo);
+ UpdateCornerClip();
+ }
+
+ private void UpdateCornerClip()
+ {
+ var width = ActualWidth;
+ var height = ActualHeight;
+ if (width <= 0 || height <= 0)
+ return;
+ var radius = CornerRadius;
+ var scale = 1.0;
+ scale = Math.Min(scale, width / Math.Max(width, radius.TopLeft + radius.TopRight));
+ scale = Math.Min(scale, width / Math.Max(width, radius.BottomLeft + radius.BottomRight));
+ scale = Math.Min(scale, height / Math.Max(height, radius.TopLeft + radius.BottomLeft));
+ scale = Math.Min(scale, height / Math.Max(height, radius.TopRight + radius.BottomRight));
+ var topLeft = radius.TopLeft * scale;
+ var topRight = radius.TopRight * scale;
+ var bottomRight = radius.BottomRight * scale;
+ var bottomLeft = radius.BottomLeft * scale;
+ var geometry = new StreamGeometry();
+ using (var context = geometry.Open())
+ {
+ context.BeginFigure(new Point(topLeft, 0), true, true);
+ context.LineTo(new Point(width - topRight, 0), true, false);
+ AddCorner(context, new Point(width, topRight), topRight);
+ context.LineTo(new Point(width, height - bottomRight), true, false);
+ AddCorner(context, new Point(width - bottomRight, height), bottomRight);
+ context.LineTo(new Point(bottomLeft, height), true, false);
+ AddCorner(context, new Point(0, height - bottomLeft), bottomLeft);
+ context.LineTo(new Point(0, topLeft), true, false);
+ AddCorner(context, new Point(topLeft, 0), topLeft);
+ }
+ geometry.Freeze();
+ Clip = geometry;
+ }
+
+ private static void AddCorner(StreamGeometryContext context, Point point, double radius)
+ {
+ if (radius == 0)
+ context.LineTo(point, true, false);
+ else
+ context.ArcTo(point, new Size(radius, radius), 0, false, SweepDirection.Clockwise, true, false);
+ }
+
+ private static bool UpdateSources(DependencyObject element)
+ {
+ var valid = true;
+ var properties = new HashSet();
+ var values = element.GetLocalValueEnumerator();
+ while (values.MoveNext())
+ properties.Add(values.Current.Property);
+ foreach (PropertyDescriptor property in TypeDescriptor.GetProperties(element))
+ {
+ var descriptor = DependencyPropertyDescriptor.FromProperty(property);
+ if (descriptor != null)
+ properties.Add(descriptor.DependencyProperty);
+ }
+ foreach (var property in properties)
+ {
+ var expression = BindingOperations.GetBindingExpressionBase(element, property);
+ var binding = expression as BindingExpression;
+ binding?.UpdateSource();
+ var multiBinding = expression as MultiBindingExpression;
+ multiBinding?.UpdateSource();
+ var priorityBinding = expression as PriorityBindingExpression;
+ priorityBinding?.ActiveBindingExpression?.UpdateSource();
+ }
+ for (var i = 0; i < VisualTreeHelper.GetChildrenCount(element); i++)
+ valid = UpdateSources(VisualTreeHelper.GetChild(element, i)) && valid;
+ var frameworkElement = element as FrameworkElement;
+ if (frameworkElement?.BindingGroup != null)
+ valid = frameworkElement.BindingGroup.CommitEdit() && valid;
+ return !Validation.GetHasError(element) && valid;
+ }
+ }
+}
diff --git a/src/WPFDevelopers.Shared/Controls/Dialog/DialogAdorner.cs b/src/WPFDevelopers.Shared/Controls/Dialog/DialogAdorner.cs
new file mode 100644
index 00000000..68690775
--- /dev/null
+++ b/src/WPFDevelopers.Shared/Controls/Dialog/DialogAdorner.cs
@@ -0,0 +1,67 @@
+using System;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+
+namespace WPFDevelopers.Controls
+{
+ internal sealed class DialogAdorner : Adorner
+ {
+ private readonly Dialog _host;
+ private readonly MaskControl _background;
+
+ internal DialogAdorner(UIElement element, Dialog host) : base(element)
+ {
+ _host = host;
+ _background = new MaskControl(element) { IsHitTestVisible = false };
+ AddVisualChild(_background);
+ AddVisualChild(host);
+ ClipToBounds = true;
+ KeyboardNavigation.SetTabNavigation(this, KeyboardNavigationMode.Cycle);
+ KeyboardNavigation.SetControlTabNavigation(this, KeyboardNavigationMode.Cycle);
+ }
+
+ protected override int VisualChildrenCount => 2;
+
+ protected override Visual GetVisualChild(int index)
+ {
+ if (index < 0 || index > 1)
+ throw new ArgumentOutOfRangeException(nameof(index));
+ return index == 0 ? (Visual)_background : _host;
+ }
+
+ protected override Size MeasureOverride(Size constraint)
+ {
+ var size = AdornedElement.RenderSize;
+ _background.Measure(size);
+ var width = double.IsNaN(_host.DialogWidth) ? size.Width : Math.Min(size.Width, _host.DialogWidth);
+ var height = double.IsNaN(_host.DialogHeight) ? size.Height : Math.Min(size.Height, _host.DialogHeight);
+ _host.Measure(new Size(width, height));
+ return size;
+ }
+
+ protected override Size ArrangeOverride(Size finalSize)
+ {
+ _background.Arrange(new Rect(finalSize));
+ var width = double.IsNaN(_host.DialogWidth) ? Math.Max(240, _host.DesiredSize.Width) : _host.DialogWidth;
+ var height = double.IsNaN(_host.DialogHeight) ? Math.Max(120, _host.DesiredSize.Height) : _host.DialogHeight;
+ width = Math.Min(width, finalSize.Width);
+ height = Math.Min(height, finalSize.Height);
+ _host.Arrange(new Rect((finalSize.Width - width) / 2, (finalSize.Height - height) / 2, width, height));
+ return finalSize;
+ }
+
+ protected override void OnRender(DrawingContext drawingContext)
+ {
+ drawingContext.DrawRectangle(Brushes.Transparent, null, new Rect(RenderSize));
+ }
+
+ internal void Detach()
+ {
+ RemoveVisualChild(_background);
+ RemoveVisualChild(_host);
+ }
+ }
+}
diff --git a/src/WPFDevelopers.Shared/Controls/Dialog/DialogResult.cs b/src/WPFDevelopers.Shared/Controls/Dialog/DialogResult.cs
new file mode 100644
index 00000000..49d7c5a5
--- /dev/null
+++ b/src/WPFDevelopers.Shared/Controls/Dialog/DialogResult.cs
@@ -0,0 +1,29 @@
+using System.ComponentModel;
+
+namespace WPFDevelopers.Controls
+{
+ public enum DialogResult
+ {
+ Canceled,
+ Confirmed
+ }
+
+ public enum DialogCloseReason
+ {
+ Confirm,
+ Cancel,
+ CloseButton,
+ Escape,
+ WindowClosing
+ }
+
+ public sealed class DialogClosingEventArgs : CancelEventArgs
+ {
+ public DialogClosingEventArgs(DialogCloseReason reason)
+ {
+ Reason = reason;
+ }
+
+ public DialogCloseReason Reason { get; private set; }
+ }
+}
diff --git a/src/WPFDevelopers.Shared/Controls/MessageBox/MessageBox.cs b/src/WPFDevelopers.Shared/Controls/MessageBox/MessageBox.cs
index fe3be4fb..ef4b1e28 100644
--- a/src/WPFDevelopers.Shared/Controls/MessageBox/MessageBox.cs
+++ b/src/WPFDevelopers.Shared/Controls/MessageBox/MessageBox.cs
@@ -48,8 +48,8 @@ private static MessageBoxResult GetWindow(WDMessageBox msg, Window owner = null)
msg.WindowStartupLocation = WindowStartupLocation.CenterOwner;
if (owner != null)
{
- msg.CreateMask();
msg.Owner = owner;
+ msg.CreateMask();
msg.ShowDialog();
}
else
@@ -59,8 +59,8 @@ private static MessageBoxResult GetWindow(WDMessageBox msg, Window owner = null)
{
if (win.WindowState == WindowState.Minimized)
msg.BorderThickness = new Thickness(1);
- msg.CreateMask();
msg.Owner = win;
+ msg.CreateMask();
msg.ShowDialog();
}
else
diff --git a/src/WPFDevelopers.Shared/Controls/MessageBox/WDMessageBox.cs b/src/WPFDevelopers.Shared/Controls/MessageBox/WDMessageBox.cs
index f95fa205..44916a19 100644
--- a/src/WPFDevelopers.Shared/Controls/MessageBox/WDMessageBox.cs
+++ b/src/WPFDevelopers.Shared/Controls/MessageBox/WDMessageBox.cs
@@ -45,7 +45,7 @@ internal sealed class WDMessageBox : Window
private TextBox _message;
private Visibility _okVisibility;
private Path _path;
- private SolidColorBrush _solidColorBrush;
+ private Brush _imageBrush;
private TextBlock _title;
@@ -124,7 +124,7 @@ public override void OnApplyTemplate()
if (_path != null)
{
_path.Data = _geometry;
- _path.Fill = _solidColorBrush;
+ _path.Fill = _imageBrush;
}
_closeButton = GetTemplateChild(CloseButtonTemplateName) as Button;
@@ -261,19 +261,19 @@ private void DisplayImage(MessageBoxImage image)
{
case MessageBoxImage.Warning:
_geometry = ThemeManager.Instance.Resources.TryFindResource("WD.InfoGeometry");
- _solidColorBrush = ThemeManager.Instance.Resources.TryFindResource("WD.WarningBrush");
+ _imageBrush = ThemeManager.Instance.Resources.TryFindResource("WD.WarningBrush");
break;
case MessageBoxImage.Error:
_geometry = ThemeManager.Instance.Resources.TryFindResource("WD.ErrorGeometry");
- _solidColorBrush = ThemeManager.Instance.Resources.TryFindResource("WD.DangerBrush");
+ _imageBrush = ThemeManager.Instance.Resources.TryFindResource("WD.DangerBrush");
break;
case MessageBoxImage.Information:
_geometry = ThemeManager.Instance.Resources.TryFindResource("WD.WarningGeometry");
- _solidColorBrush = ThemeManager.Instance.Resources.TryFindResource("WD.SuccessBrush");
+ _imageBrush = ThemeManager.Instance.Resources.TryFindResource("WD.SuccessBrush");
break;
case MessageBoxImage.Question:
_geometry = ThemeManager.Instance.Resources.TryFindResource("WD.QuestionGeometry");
- _solidColorBrush = ThemeManager.Instance.Resources.TryFindResource("WD.PrimaryBrush");
+ _imageBrush = ThemeManager.Instance.Resources.TryFindResource("WD.PrimaryBrush");
break;
}
}
diff --git a/src/WPFDevelopers.Shared/Controls/NotifyIcon/NotifyIcon.cs b/src/WPFDevelopers.Shared/Controls/NotifyIcon/NotifyIcon.cs
index 82eb9e0a..17739e58 100644
--- a/src/WPFDevelopers.Shared/Controls/NotifyIcon/NotifyIcon.cs
+++ b/src/WPFDevelopers.Shared/Controls/NotifyIcon/NotifyIcon.cs
@@ -1,4 +1,6 @@
using System;
+using System.Collections.Generic;
+using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Reflection;
@@ -23,7 +25,8 @@ namespace WPFDevelopers.Controls
{
public class NotifyIcon : FrameworkElement, IDisposable
{
- private static NotifyIcon NotifyIconCache;
+ private static readonly object NotifyIconsLock = new object();
+ private static readonly List NotifyIcons = new List();
public static readonly DependencyProperty ContextContentProperty = DependencyProperty.Register(
"ContextContent", typeof(object), typeof(NotifyIcon), new PropertyMetadata(default));
@@ -77,6 +80,7 @@ public class NotifyIcon : FrameworkElement, IDisposable
private IntPtr _hIcon = IntPtr.Zero;
private ImageSource _icon;
private IntPtr _iconHandle;
+ private IconHandle _imageIconHandle;
private int _IsShowIn;
@@ -95,7 +99,6 @@ public class NotifyIcon : FrameworkElement, IDisposable
private bool disposedValue;
private readonly uint _trayIconId;
- private IntPtr _tempIconHandle;
//闪烁定时器
private DispatcherTimer _dispatcherTimerTwink;
@@ -112,7 +115,7 @@ public NotifyIcon()
WPFDevelopers.Resources.ThemeChanged += Resources_ThemeChanged;
}
Start();
- NotifyIconCache = this;
+ RegisterNotifyIcon(this);
}
static NotifyIcon()
@@ -212,7 +215,8 @@ private static void OnTwinkIntervalChanged(DependencyObject d, DependencyPropert
if (d is NotifyIcon trayService)
{
var notifyIcon = (NotifyIcon)d;
- notifyIcon._dispatcherTimerTwink.Interval = (TimeSpan)e.NewValue;
+ if (notifyIcon._dispatcherTimerTwink != null)
+ notifyIcon._dispatcherTimerTwink.Interval = (TimeSpan)e.NewValue;
}
}
private static void OnIsTwinkChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
@@ -231,17 +235,17 @@ private static void OnIsTwinkChanged(DependencyObject d, DependencyPropertyChang
};
notifyIcon._dispatcherTimerTwink.Tick += notifyIcon.DispatcherTimerTwinkTick;
}
- notifyIcon._tempIconHandle = notifyIcon._hIcon;
notifyIcon._dispatcherTimerTwink.Start();
}
else
{
- notifyIcon._dispatcherTimerTwink?.Stop();
- notifyIcon._dispatcherTimerTwink.Tick -= notifyIcon.DispatcherTimerTwinkTick;
- notifyIcon._dispatcherTimerTwink = null;
- notifyIcon._iconHandle = notifyIcon._tempIconHandle;
- notifyIcon.ChangeIcon(false, notifyIcon._iconHandle);
- notifyIcon._tempIconHandle = IntPtr.Zero;
+ if (notifyIcon._dispatcherTimerTwink != null)
+ {
+ notifyIcon._dispatcherTimerTwink.Stop();
+ notifyIcon._dispatcherTimerTwink.Tick -= notifyIcon.DispatcherTimerTwinkTick;
+ notifyIcon._dispatcherTimerTwink = null;
+ }
+ notifyIcon.ChangeIcon(notifyIcon._hIcon);
}
}
@@ -277,16 +281,57 @@ public event RoutedEventHandler MouseDoubleClick
private void DispatcherTimerTwinkTick(object sender, EventArgs e)
{
if (Visibility != Visibility.Visible) return;
- _iconHandle = _iconHandle != IntPtr.Zero ? IntPtr.Zero : _tempIconHandle;
- ChangeIcon(false, _iconHandle);
+ ChangeIcon(_iconHandle != IntPtr.Zero ? IntPtr.Zero : _hIcon);
}
private void OnCurrent_Exit(object sender, ExitEventArgs e)
{
s_NotifyIcon?.Dispose();
s_NotifyIcon = default;
- NotifyIconCache?.Dispose();
- NotifyIconCache = null;
+ Dispose();
+ }
+
+ private static void RegisterNotifyIcon(NotifyIcon notifyIcon)
+ {
+ lock (NotifyIconsLock)
+ {
+ NotifyIcons.Add(new WeakReference(notifyIcon));
+ }
+ }
+
+ private static NotifyIcon GetLatestNotifyIcon()
+ {
+ lock (NotifyIconsLock)
+ {
+ for (var i = NotifyIcons.Count - 1; i >= 0; i--)
+ {
+ var notifyIcon = NotifyIcons[i].Target as NotifyIcon;
+ if (notifyIcon == null || notifyIcon.disposedValue)
+ {
+ NotifyIcons.RemoveAt(i);
+ continue;
+ }
+
+ return notifyIcon;
+ }
+ }
+
+ return null;
+ }
+
+ private static void UnregisterNotifyIcon(NotifyIcon notifyIcon)
+ {
+ lock (NotifyIconsLock)
+ {
+ for (var i = NotifyIcons.Count - 1; i >= 0; i--)
+ {
+ var registeredIcon = NotifyIcons[i].Target as NotifyIcon;
+ if (registeredIcon == null || ReferenceEquals(registeredIcon, notifyIcon))
+ {
+ NotifyIcons.RemoveAt(i);
+ }
+ }
+ }
}
@@ -305,6 +350,7 @@ public bool Stop()
if (_dispatcherTimerTwink != null)
{
_dispatcherTimerTwink.Stop();
+ _dispatcherTimerTwink.Tick -= DispatcherTimerTwinkTick;
_dispatcherTimerTwink = null;
}
@@ -313,23 +359,15 @@ public bool Stop()
Hide();
}
- if (_hIcon != IntPtr.Zero)
- {
- User32Interop.DestroyIcon(_hIcon);
- _hIcon = IntPtr.Zero;
- }
-
- if (_tempIconHandle != IntPtr.Zero)
+ ReleaseIcon();
+ if (_contextContent != null)
{
- User32Interop.DestroyIcon(_tempIconHandle);
- _tempIconHandle = IntPtr.Zero;
- }
-
- if (_iconHandle != IntPtr.Zero)
- {
- User32Interop.DestroyIcon(_iconHandle);
- _iconHandle = IntPtr.Zero;
+ _contextContent.IsOpen = false;
+ _contextContent.Child = null;
+ _contextContent = null;
}
+ if (ContextMenu != null)
+ ContextMenu.IsOpen = false;
if (_TrayWindowHandle != IntPtr.Zero)
{
@@ -365,7 +403,7 @@ private bool RegisterClass(string className, WndProc wndproccallback, string mes
var wndClass = new WNDCLASSEX
{
cbSize = Marshal.SizeOf(typeof(WNDCLASSEX)),
- style = 0,
+ style = CS.DBLCLKS,
lpfnWndProc = wndproccallback,
cbClsExtra = 0,
cbWndExtra = 0,
@@ -524,70 +562,98 @@ internal static IconHandle CreateIconCursor(byte[] xor, int width, int height, i
{
var bits = IntPtr.Zero;
- BitmapHandle colorBitmap = null;
var bi = new BITMAPINFO(width, -height, 32)
{
bmiHeader_biCompression = 0
};
- colorBitmap = Gdi32Interop.CreateDIBSection(new HandleRef(null, IntPtr.Zero), ref bi, 0, ref bits, null, 0);
-
- if (colorBitmap.IsInvalid || bits == IntPtr.Zero) return IconHandle.GetInvalidIcon();
- Marshal.Copy(xor, 0, bits, xor.Length);
- var maskArray = GenerateMaskArray(width, height, xor);
- var maskBitmap = Gdi32Interop.CreateBitmap(width, height, 1, 1, maskArray);
- if (maskBitmap.IsInvalid) return IconHandle.GetInvalidIcon();
- var iconInfo = new Gdi32Interop.ICONINFO
+ using (var colorBitmap = Gdi32Interop.CreateDIBSection(new HandleRef(null, IntPtr.Zero), ref bi, 0, ref bits, null, 0))
{
- fIcon = isIcon,
- xHotspot = xHotspot,
- yHotspot = yHotspot,
- hbmMask = maskBitmap,
- hbmColor = colorBitmap
- };
+ if (colorBitmap.IsInvalid || bits == IntPtr.Zero) return IconHandle.GetInvalidIcon();
+ Marshal.Copy(xor, 0, bits, xor.Length);
+ var maskArray = GenerateMaskArray(width, height, xor);
+ using (var maskBitmap = Gdi32Interop.CreateBitmap(width, height, 1, 1, maskArray))
+ {
+ if (maskBitmap.IsInvalid) return IconHandle.GetInvalidIcon();
+ var iconInfo = new Gdi32Interop.ICONINFO
+ {
+ fIcon = isIcon,
+ xHotspot = xHotspot,
+ yHotspot = yHotspot,
+ hbmMask = maskBitmap,
+ hbmColor = colorBitmap
+ };
+ return User32Interop.CreateIconIndirect(iconInfo);
+ }
+ }
+ }
- return User32Interop.CreateIconIndirect(iconInfo);
+ private void ReleaseIcon()
+ {
+ if (_imageIconHandle != null)
+ {
+ _imageIconHandle.Dispose();
+ _imageIconHandle = null;
+ }
+ else if (_hIcon != IntPtr.Zero)
+ {
+ User32Interop.DestroyIcon(_hIcon);
+ }
+ _hIcon = IntPtr.Zero;
+ _iconHandle = IntPtr.Zero;
}
- private bool ChangeIcon(bool destroyOldIcon = false, IntPtr? newIntprt = null)
+ private bool ChangeIcon(IntPtr? iconHandle = null)
{
if (DesignerHelper.IsInDesignMode == true) return false;
- var bitmapFrame = _icon as BitmapFrame;
- if (bitmapFrame != null && bitmapFrame.Decoder != null)
- if (bitmapFrame.Decoder is IconBitmapDecoder)
+ if (!iconHandle.HasValue)
+ {
+ if (_icon != null)
+ {
+ var bitmap = _icon as BitmapSource;
+ if (bitmap == null)
+ {
+ var visual = new DrawingVisual();
+ using (var context = visual.RenderOpen())
+ context.DrawImage(_icon, new Rect(0, 0, 32, 32));
+ var rendered = new RenderTargetBitmap(32, 32, 96, 96, PixelFormats.Pbgra32);
+ rendered.Render(visual);
+ bitmap = rendered;
+ }
+ var converted = new FormatConvertedBitmap(bitmap, PixelFormats.Bgra32, null, 0);
+ var stride = converted.PixelWidth * 4;
+ var pixels = new byte[stride * converted.PixelHeight];
+ converted.CopyPixels(pixels, stride, 0);
+ var newIcon = CreateIconCursor(pixels, converted.PixelWidth, converted.PixelHeight, 0, 0, true);
+ if (newIcon.IsInvalid)
+ {
+ newIcon.Dispose();
+ throw new Win32Exception(Marshal.GetLastWin32Error(), "Unable to create the notification area icon.");
+ }
+ ReleaseIcon();
+ _imageIconHandle = newIcon;
+ _hIcon = newIcon.CriticalGetHandle();
+ }
+ else
{
- var w = bitmapFrame.PixelWidth;
- var h = bitmapFrame.PixelHeight;
- var bpp = bitmapFrame.Format.BitsPerPixel;
- var stride = (bpp * w + 31) / 32 * 4;
- var sizeCopyPixels = stride * h;
- var xor = new byte[sizeCopyPixels];
- bitmapFrame.CopyPixels(xor, stride, 0);
-
- var iconHandle = CreateIconCursor(xor, w, h, 0, 0, true);
- _iconHandle = iconHandle.CriticalGetHandle();
+ var index = IntPtr.Zero;
+ var processPath = Kernel32Interop.GetModuleFileName(new HandleRef());
+ var defaultIcon = Shell32Interop.ExtractAssociatedIcon(IntPtr.Zero, processPath, ref index);
+ if (defaultIcon == IntPtr.Zero)
+ throw new Win32Exception(Marshal.GetLastWin32Error(), "Unable to load the application icon.");
+ ReleaseIcon();
+ _hIcon = defaultIcon;
}
+ iconHandle = _hIcon;
+ }
if (Thread.VolatileRead(ref _IsShowIn) != 1)
return false;
- if (destroyOldIcon && _hIcon != IntPtr.Zero)
- {
- User32Interop.DestroyIcon(_hIcon);
- _hIcon = IntPtr.Zero;
- }
lock (this)
{
- if (_iconHandle != IntPtr.Zero)
- {
- var hIcon = _iconHandle;
- _NOTIFYICONDATA.hIcon = hIcon;
- _hIcon = hIcon;
- }
- else
- {
- _NOTIFYICONDATA.hIcon = IntPtr.Zero;
- }
+ _iconHandle = iconHandle.Value;
+ _NOTIFYICONDATA.hIcon = _iconHandle;
return Shell32Interop.Shell_NotifyIcon(NotifyCommand.NIM_Modify, ref _NOTIFYICONDATA);
}
}
@@ -606,8 +672,7 @@ private bool ChangeTitle(string title)
public static void ShowBalloonTip(string title, string content, NotifyIconInfoType infoType)
{
- if (NotifyIconCache != null)
- NotifyIconCache.ShowBalloonTips(title, content, infoType);
+ GetLatestNotifyIcon()?.ShowBalloonTips(title, content, infoType);
}
public void ShowBalloonTips(string title, string content, NotifyIconInfoType infoType)
@@ -615,6 +680,7 @@ public void ShowBalloonTips(string title, string content, NotifyIconInfoType inf
if (Thread.VolatileRead(ref _IsShowIn) != 1)
return;
var _ShowNOTIFYICONDATA = NOTIFYICONDATA.GetDefaultNotifyData(_TrayWindowHandle);
+ _ShowNOTIFYICONDATA.uTaskbarIconId = _trayIconId;
_ShowNOTIFYICONDATA.uFlags = NIFFlags.NIF_INFO;
_ShowNOTIFYICONDATA.szInfoTitle = title ?? string.Empty;
_ShowNOTIFYICONDATA.szInfo = content ?? string.Empty;
@@ -635,7 +701,8 @@ public void ShowBalloonTips(string title, string content, NotifyIconInfoType inf
break;
}
- Shell32Interop.Shell_NotifyIcon(NotifyCommand.NIM_Modify, ref _ShowNOTIFYICONDATA);
+ if (!Shell32Interop.Shell_NotifyIcon(NotifyCommand.NIM_Modify, ref _ShowNOTIFYICONDATA))
+ throw new Win32Exception(Marshal.GetLastWin32Error(), "Unable to send the notification area message.");
}
private bool Hide()
@@ -742,19 +809,20 @@ private void OpenMenu()
var ownerIsForeground = ownerHandle != IntPtr.Zero && User32Interop.SetForegroundWindow(ownerHandle);
if (ContextContent != null)
{
- _contextContent = new Popup
+ if (_contextContent == null)
{
- Placement = PlacementMode.Mouse,
- AllowsTransparency = true,
- StaysOpen = false,
- UseLayoutRounding = true,
- SnapsToDevicePixels = true
- };
-
- _contextContent.Child = new ContentControl
- {
- Content = ContextContent
- };
+ _contextContent = new Popup
+ {
+ Placement = PlacementMode.Mouse,
+ AllowsTransparency = true,
+ StaysOpen = false,
+ UseLayoutRounding = true,
+ SnapsToDevicePixels = true,
+ Child = new ContentControl()
+ };
+ }
+
+ ((ContentControl)_contextContent.Child).Content = ContextContent;
UpdateDataContext(_contextContent, null, DataContext);
_contextContent.IsOpen = true;
if (!ownerIsForeground)
@@ -796,6 +864,7 @@ protected virtual void Dispose(bool disposing)
if (Application.Current != null)
{
+ Application.Current.Exit -= OnCurrent_Exit;
WPFDevelopers.Resources.ThemeChanged -= Resources_ThemeChanged;
}
@@ -809,29 +878,9 @@ protected virtual void Dispose(bool disposing)
Stop();
}
- if (_hIcon != IntPtr.Zero)
- {
- User32Interop.DestroyIcon(_hIcon);
- _hIcon = IntPtr.Zero;
- }
-
- if (_tempIconHandle != IntPtr.Zero)
- {
- User32Interop.DestroyIcon(_tempIconHandle);
- _tempIconHandle = IntPtr.Zero;
- }
-
- if (_iconHandle != IntPtr.Zero)
- {
- User32Interop.DestroyIcon(_iconHandle);
- _iconHandle = IntPtr.Zero;
- }
-
- if (ReferenceEquals(this, NotifyIconCache))
- {
- NotifyIconCache = null;
- }
+ ReleaseIcon();
+ UnregisterNotifyIcon(this);
disposedValue = true;
}
}
diff --git a/src/WPFDevelopers.Shared/Controls/NotifyIcon/Runtimes/Gdi32Interop.cs b/src/WPFDevelopers.Shared/Controls/NotifyIcon/Runtimes/Gdi32Interop.cs
index eb82edce..b41c12f3 100644
--- a/src/WPFDevelopers.Shared/Controls/NotifyIcon/Runtimes/Gdi32Interop.cs
+++ b/src/WPFDevelopers.Shared/Controls/NotifyIcon/Runtimes/Gdi32Interop.cs
@@ -96,10 +96,10 @@ internal static BitmapHandle CreateDIBSection(HandleRef hdc, ref BITMAPINFO bitm
internal class ICONINFO
{
public bool fIcon = false;
- public BitmapHandle hbmColor = null;
- public BitmapHandle hbmMask = null;
public int xHotspot = 0;
public int yHotspot = 0;
+ public BitmapHandle hbmMask = null;
+ public BitmapHandle hbmColor = null;
}
}
}
diff --git a/src/WPFDevelopers.Shared/Controls/PathIcon/PackIconKind.cs b/src/WPFDevelopers.Shared/Controls/PathIcon/PackIconKind.cs
index dd4e023a..35fad95b 100644
--- a/src/WPFDevelopers.Shared/Controls/PathIcon/PackIconKind.cs
+++ b/src/WPFDevelopers.Shared/Controls/PathIcon/PackIconKind.cs
@@ -66,5 +66,8 @@ public enum PackIconKind
[Description("WD.UpArrowGeometry")] UpArrow,
[Description("WD.DownArrowGeometry")] DownArrow,
[Description("WD.SplitterGeometry")] Splitter,
+ [Description("WD.MoonGeometry")] Moon,
+ [Description("WD.SunGeometry")] Sun,
+ [Description("WD.SystemThemeGeometry")] SystemTheme,
}
}
diff --git a/src/WPFDevelopers.Shared/Controls/PathIcon/PathIcon.cs b/src/WPFDevelopers.Shared/Controls/PathIcon/PathIcon.cs
index 567cf359..f22386b6 100644
--- a/src/WPFDevelopers.Shared/Controls/PathIcon/PathIcon.cs
+++ b/src/WPFDevelopers.Shared/Controls/PathIcon/PathIcon.cs
@@ -13,6 +13,20 @@ public class PathIcon : Control
public static readonly DependencyProperty DataProperty =
DependencyProperty.Register(nameof(Data), typeof(Geometry), typeof(PathIcon));
+ public static readonly DependencyProperty FillProperty =
+ DependencyProperty.Register(nameof(Fill), typeof(Brush), typeof(PathIcon));
+
+ public static readonly DependencyProperty StrokeProperty =
+ DependencyProperty.Register(nameof(Stroke), typeof(Brush), typeof(PathIcon));
+
+ public static readonly DependencyProperty StrokeThicknessProperty =
+ DependencyProperty.Register(nameof(StrokeThickness), typeof(double), typeof(PathIcon),
+ new PropertyMetadata(1d));
+
+ public static readonly DependencyProperty StrokeLineJoinProperty =
+ DependencyProperty.Register(nameof(StrokeLineJoin), typeof(PenLineJoin), typeof(PathIcon),
+ new PropertyMetadata(PenLineJoin.Miter));
+
public PackIconKind? Kind
{
get { return (PackIconKind?)GetValue(KindProperty); }
@@ -25,6 +39,30 @@ public Geometry Data
set { SetValue(DataProperty, value); }
}
+ public Brush Fill
+ {
+ get { return (Brush)GetValue(FillProperty); }
+ set { SetValue(FillProperty, value); }
+ }
+
+ public Brush Stroke
+ {
+ get { return (Brush)GetValue(StrokeProperty); }
+ set { SetValue(StrokeProperty, value); }
+ }
+
+ public double StrokeThickness
+ {
+ get { return (double)GetValue(StrokeThicknessProperty); }
+ set { SetValue(StrokeThicknessProperty, value); }
+ }
+
+ public PenLineJoin StrokeLineJoin
+ {
+ get { return (PenLineJoin)GetValue(StrokeLineJoinProperty); }
+ set { SetValue(StrokeLineJoinProperty, value); }
+ }
+
private static void OnKindChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var pathIcon = (PathIcon)d;
diff --git a/src/WPFDevelopers.Shared/Controls/ScrollViewer/ScrollViewerBehavior.cs b/src/WPFDevelopers.Shared/Controls/ScrollViewer/ScrollViewerBehavior.cs
index f8ddf691..e9c4e933 100644
--- a/src/WPFDevelopers.Shared/Controls/ScrollViewer/ScrollViewerBehavior.cs
+++ b/src/WPFDevelopers.Shared/Controls/ScrollViewer/ScrollViewerBehavior.cs
@@ -27,6 +27,23 @@ public static double GetVerticalOffset(FrameworkElement target)
return (double)target.GetValue(VerticalOffsetProperty);
}
+ public static readonly DependencyProperty IsHorizontalMouseWheelEnabledProperty =
+ DependencyProperty.RegisterAttached(
+ "IsHorizontalMouseWheelEnabled",
+ typeof(bool),
+ typeof(ScrollViewerBehavior),
+ new PropertyMetadata(false, OnIsHorizontalMouseWheelEnabledChanged));
+
+ public static void SetIsHorizontalMouseWheelEnabled(DependencyObject target, bool value)
+ {
+ target.SetValue(IsHorizontalMouseWheelEnabledProperty, value);
+ }
+
+ public static bool GetIsHorizontalMouseWheelEnabled(DependencyObject target)
+ {
+ return (bool)target.GetValue(IsHorizontalMouseWheelEnabledProperty);
+ }
+
public static readonly DependencyProperty IsBackToTopEnabledProperty =
DependencyProperty.RegisterAttached(
"IsBackToTopEnabled",
@@ -73,6 +90,39 @@ private static void OnVerticalOffsetChanged(DependencyObject target, DependencyP
(target as WDScrollViewer)?.ScrollToVerticalOffset((double)e.NewValue);
}
+ private static void OnIsHorizontalMouseWheelEnabledChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
+ {
+ var scrollViewer = d as ScrollViewer;
+ if (scrollViewer == null)
+ return;
+
+ if ((bool)e.NewValue)
+ scrollViewer.PreviewMouseWheel += OnPreviewMouseWheel;
+ else
+ scrollViewer.PreviewMouseWheel -= OnPreviewMouseWheel;
+ }
+
+ private static void OnPreviewMouseWheel(object sender, MouseWheelEventArgs e)
+ {
+ var scrollViewer = sender as ScrollViewer;
+ if (e.Handled || scrollViewer == null || scrollViewer.ScrollableWidth <= 0)
+ return;
+
+ var horizontal = (Keyboard.Modifiers & ModifierKeys.Shift) == ModifierKeys.Shift ||
+ scrollViewer.ScrollableHeight <= 0;
+ if (!horizontal)
+ return;
+
+ var currentOffset = scrollViewer.HorizontalOffset;
+ var newOffset = Math.Max(0, Math.Min(
+ currentOffset - e.Delta, scrollViewer.ScrollableWidth));
+ if (newOffset == currentOffset)
+ return;
+
+ scrollViewer.ScrollToHorizontalOffset(newOffset);
+ e.Handled = true;
+ }
+
private static void OnIsBackToTopEnabledChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
OnScrollNavigationChanged(d, e);
diff --git a/src/WPFDevelopers.Shared/Controls/Timeline/Timeline.cs b/src/WPFDevelopers.Shared/Controls/Timeline/Timeline.cs
index 8220cdb2..5accbf49 100644
--- a/src/WPFDevelopers.Shared/Controls/Timeline/Timeline.cs
+++ b/src/WPFDevelopers.Shared/Controls/Timeline/Timeline.cs
@@ -3,6 +3,7 @@
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
+using System.Windows.Interop;
using System.Windows.Media;
namespace WPFDevelopers.Controls
@@ -25,7 +26,9 @@ public enum TimelineItemPosition
public class Timeline : ItemsControl
{
private const string ScrollViewerPartName = "PART_ScrollViewer";
+ private const int MouseHorizontalWheelMessage = 0x020E;
private ScrollViewer _scrollViewer;
+ private HwndSource _hwndSource;
public static readonly DependencyProperty OrientationProperty =
DependencyProperty.Register("Orientation", typeof(Orientation), typeof(Timeline),
@@ -58,6 +61,12 @@ static Timeline()
DefaultStyleKeyProperty.OverrideMetadata(typeof(Timeline), new FrameworkPropertyMetadata(typeof(Timeline)));
}
+ public Timeline()
+ {
+ Loaded += OnTimelineLoaded;
+ Unloaded += OnTimelineUnloaded;
+ }
+
public Orientation Orientation
{
get { return (Orientation)GetValue(OrientationProperty); }
@@ -106,9 +115,73 @@ public override void OnApplyTemplate()
_scrollViewer.PreviewMouseWheel += OnScrollViewerPreviewMouseWheel;
}
+ private void OnTimelineLoaded(object sender, RoutedEventArgs e)
+ {
+ var hwndSource = PresentationSource.FromVisual(this) as HwndSource;
+ if (ReferenceEquals(_hwndSource, hwndSource))
+ return;
+ if (_hwndSource != null)
+ _hwndSource.RemoveHook(OnWindowMessage);
+ _hwndSource = hwndSource;
+ if (_hwndSource != null)
+ _hwndSource.AddHook(OnWindowMessage);
+ }
+
+ private void OnTimelineUnloaded(object sender, RoutedEventArgs e)
+ {
+ if (_hwndSource != null)
+ {
+ _hwndSource.RemoveHook(OnWindowMessage);
+ _hwndSource = null;
+ }
+ }
+
+ private IntPtr OnWindowMessage(IntPtr hwnd, int message, IntPtr wParam, IntPtr lParam, ref bool handled)
+ {
+ if (message != MouseHorizontalWheelMessage || _scrollViewer == null ||
+ Orientation != Orientation.Horizontal || !_scrollViewer.IsVisible)
+ return IntPtr.Zero;
+
+ var delta = unchecked((short)((long)wParam >> 16));
+ if (delta == 0 || _scrollViewer.ScrollableWidth <= 0)
+ return IntPtr.Zero;
+
+ var screenPoint = new Point(
+ unchecked((short)(long)lParam),
+ unchecked((short)((long)lParam >> 16)));
+ var point = _scrollViewer.PointFromScreen(screenPoint);
+ if (point.X < 0 || point.Y < 0 ||
+ point.X > _scrollViewer.ActualWidth || point.Y > _scrollViewer.ActualHeight)
+ return IntPtr.Zero;
+
+ var currentOffset = _scrollViewer.HorizontalOffset;
+ var targetOffset = Math.Max(0, Math.Min(currentOffset + delta, _scrollViewer.ScrollableWidth));
+ if (targetOffset == currentOffset)
+ return IntPtr.Zero;
+
+ _scrollViewer.ScrollToHorizontalOffset(targetOffset);
+ handled = true;
+ return IntPtr.Zero;
+ }
+
private void OnScrollViewerPreviewMouseWheel(object sender, MouseWheelEventArgs e)
{
if (e.Handled || e.Delta == 0) return;
+ if (Orientation == Orientation.Horizontal &&
+ _scrollViewer.HorizontalScrollBarVisibility != ScrollBarVisibility.Disabled)
+ {
+ var canScrollHorizontally = e.Delta > 0
+ ? _scrollViewer.HorizontalOffset > 0
+ : _scrollViewer.HorizontalOffset < _scrollViewer.ScrollableWidth;
+ if (canScrollHorizontally)
+ {
+ e.Handled = true;
+ _scrollViewer.ScrollToHorizontalOffset(
+ _scrollViewer.HorizontalOffset - e.Delta);
+ return;
+ }
+ }
+
var canScroll = _scrollViewer.VerticalScrollBarVisibility != ScrollBarVisibility.Disabled &&
(e.Delta > 0 ? _scrollViewer.VerticalOffset > 0 :
_scrollViewer.VerticalOffset < _scrollViewer.ScrollableHeight);
diff --git a/src/WPFDevelopers.Shared/Controls/Toast/Toast.cs b/src/WPFDevelopers.Shared/Controls/Toast/Toast.cs
index c68017b0..2e50b165 100644
--- a/src/WPFDevelopers.Shared/Controls/Toast/Toast.cs
+++ b/src/WPFDevelopers.Shared/Controls/Toast/Toast.cs
@@ -111,6 +111,7 @@ public static void Push(IntPtr intPtr, string message, ToastImage type = ToastIm
public static void PushDesktop(string message, ToastImage type = ToastImage.Info, bool center = false, IntPtr intPtr = default)
{
+ var targetArea = ToastExt.GetTargetArea(intPtr);
if (_toastExt == null)
{
_toastExt = new ToastExt();
@@ -120,10 +121,10 @@ public static void PushDesktop(string message, ToastImage type = ToastImage.Info
_toastExt.Show();
if (_toastExt.Position != _position)
{
- _toastExt.IsPosition = false;
_toastExt.Position = _position;
}
- _toastExt.Push(message, type, center, intPtr);
+ _toastExt.IsPosition = false;
+ _toastExt.Push(message, type, center, targetArea);
}
public static void SetPosition(Position position = Position.Top)
diff --git a/src/WPFDevelopers.Shared/Controls/Toast/ToastExt.cs b/src/WPFDevelopers.Shared/Controls/Toast/ToastExt.cs
index e4a0deb5..f493d354 100644
--- a/src/WPFDevelopers.Shared/Controls/Toast/ToastExt.cs
+++ b/src/WPFDevelopers.Shared/Controls/Toast/ToastExt.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Windows;
using System.Windows.Interop;
using System.Windows.Media;
@@ -33,10 +33,8 @@ public ToastExt()
}
- internal void Push(string message, ToastImage type = ToastImage.Info,
- bool center = false, IntPtr intPtr = default)
+ internal void Push(string message, ToastImage type, bool center, Rect targetArea)
{
- Rect targetArea = GetTargetArea(intPtr);
var messageItem = new ToastListBoxItem
{
Content = message,
@@ -51,19 +49,35 @@ internal void Push(string message, ToastImage type = ToastImage.Info,
}
}
- private Rect GetTargetArea(IntPtr windowHandle)
+ internal static Rect GetTargetArea(IntPtr windowHandle)
{
if (windowHandle != IntPtr.Zero)
- {
- IsPosition = false;
return WindowHelpers.GetWindowBounds(windowHandle);
+
+ var application = Application.Current;
+ var mainWindow = application?.MainWindow;
+ if (mainWindow is ToastExt || mainWindow == null)
+ {
+ if (application != null)
+ {
+ foreach (Window window in application.Windows)
+ {
+ if (window != null && !(window is ToastExt))
+ {
+ mainWindow = window;
+ break;
+ }
+ }
+ }
}
- IsPosition = false;
- var mainWindow = Application.Current?.MainWindow;
- if (mainWindow != null && mainWindow.IsLoaded)
+ if (mainWindow != null)
{
- var mainWindowHandle = new WindowInteropHelper(mainWindow).Handle;
+ var interopHelper = new WindowInteropHelper(mainWindow);
+ var mainWindowHandle = interopHelper.Handle;
+ if (mainWindowHandle == IntPtr.Zero)
+ mainWindowHandle = interopHelper.EnsureHandle();
+
if (mainWindowHandle != IntPtr.Zero)
{
var screen = System.Windows.Forms.Screen.FromHandle(mainWindowHandle);
diff --git a/src/WPFDevelopers.Shared/Core/Helpers/ThemePreferenceStore.cs b/src/WPFDevelopers.Shared/Core/Helpers/ThemePreferenceStore.cs
new file mode 100644
index 00000000..118f6b37
--- /dev/null
+++ b/src/WPFDevelopers.Shared/Core/Helpers/ThemePreferenceStore.cs
@@ -0,0 +1,56 @@
+using System;
+using System.IO;
+using System.Linq;
+using System.Reflection;
+
+namespace WPFDevelopers.Helpers
+{
+ internal static class ThemePreferenceStore
+ {
+ private const string PreferenceFileName = "theme-mode.txt";
+
+ internal static ThemeMode Load()
+ {
+ var path = GetPreferencePath();
+ if (!File.Exists(path))
+ return ThemeMode.System;
+
+ switch (File.ReadAllText(path).Trim())
+ {
+ case "System": return ThemeMode.System;
+ case "Light": return ThemeMode.Light;
+ case "Dark": return ThemeMode.Dark;
+ default: throw new InvalidDataException("Invalid theme mode in '" + path + "'.");
+ }
+ }
+
+ internal static void Save(ThemeMode mode)
+ {
+ if (!Enum.IsDefined(typeof(ThemeMode), mode))
+ throw new ArgumentOutOfRangeException(nameof(mode));
+
+ var path = GetPreferencePath();
+ Directory.CreateDirectory(Path.GetDirectoryName(path));
+ File.WriteAllText(path, mode.ToString());
+ }
+
+ private static string GetPreferencePath()
+ {
+ var applicationName = Assembly.GetEntryAssembly()?.GetName().Name
+ ?? AppDomain.CurrentDomain.FriendlyName;
+ var invalidCharacters = Path.GetInvalidFileNameChars();
+ var safeApplicationName = string.Concat(applicationName.Select(character =>
+ invalidCharacters.Contains(character) || character == '/' || character == '\\'
+ ? '_'
+ : character));
+ if (string.IsNullOrWhiteSpace(safeApplicationName))
+ throw new InvalidOperationException("The application name cannot be used for theme preferences.");
+
+ var localApplicationData = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
+ if (string.IsNullOrWhiteSpace(localApplicationData))
+ throw new IOException("The local application data directory is unavailable.");
+
+ return Path.Combine(localApplicationData, "WPFDevelopers", safeApplicationName, PreferenceFileName);
+ }
+ }
+}
diff --git a/src/WPFDevelopers.Shared/Core/Helpers/WindowHelpers.cs b/src/WPFDevelopers.Shared/Core/Helpers/WindowHelpers.cs
index c7a78895..3931c22b 100644
--- a/src/WPFDevelopers.Shared/Core/Helpers/WindowHelpers.cs
+++ b/src/WPFDevelopers.Shared/Core/Helpers/WindowHelpers.cs
@@ -4,6 +4,7 @@
using System.IO;
using System.Runtime.InteropServices;
using System.Windows;
+using System.Windows.Documents;
using System.Windows.Interop;
using System.Windows.Media;
using System.Windows.Threading;
@@ -17,33 +18,92 @@ public static class WindowHelpers
{
public static void MaskShow(this Window outputWindow)
{
- CreateMask(outputWindow);
- outputWindow.Show();
+ var mask = AddMask(outputWindow);
+ try { outputWindow.Show(); }
+ catch
+ {
+ mask.Dispose();
+ throw;
+ }
}
public static bool? MaskShowDialog(this Window outputWindow)
{
- CreateMask(outputWindow);
- return outputWindow.ShowDialog();
+ using (AddMask(outputWindow))
+ return outputWindow.ShowDialog();
}
public static void CreateMask(this Window outputWindow)
{
- Visual parent = ControlsHelper.GetDefaultWindow();
- var _layer = ControlsHelper.GetAdornerLayer(parent);
- if (_layer == null) return;
- var _adornerContainer = new AdornerContainer(_layer)
+ AddMask(outputWindow);
+ }
+
+ private static MaskSession AddMask(Window outputWindow)
+ {
+ if (outputWindow == null)
+ throw new ArgumentNullException(nameof(outputWindow));
+ var owner = outputWindow.Owner ?? ControlsHelper.GetDefaultWindow();
+ if (owner == null || owner == outputWindow || !owner.IsVisible)
+ throw new InvalidOperationException("A mask requires a visible owner Window.");
+ var source = owner.Content as FrameworkElement;
+ var layer = source == null ? null : AdornerLayer.GetAdornerLayer(source);
+ if (layer == null)
+ throw new InvalidOperationException("The owner content requires an AdornerLayer.");
+ var adorner = new MaskAdorner(source) { Child = new MaskControl(owner) };
+ var session = new MaskSession(outputWindow, owner, layer, adorner);
+ try { layer.Add(adorner); }
+ catch
{
- Child = new MaskControl(parent)
- };
- _layer.Add(_adornerContainer);
- if (outputWindow != null)
+ session.Dispose();
+ throw;
+ }
+ return session;
+ }
+
+ private sealed class MaskAdorner : AdornerContainer
+ {
+ internal MaskAdorner(UIElement source) : base(source) { }
+
+ protected override System.Windows.Size MeasureOverride(System.Windows.Size constraint)
{
- outputWindow.Closed += delegate
- {
- if (parent != null)
- _layer.Remove(_adornerContainer);
- };
+ var size = AdornedElement.RenderSize;
+ Child.Measure(size);
+ return size;
+ }
+ }
+
+ private sealed class MaskSession : IDisposable
+ {
+ private readonly Window _window;
+ private readonly Window _owner;
+ private readonly AdornerLayer _layer;
+ private readonly MaskAdorner _adorner;
+ private bool _disposed;
+
+ internal MaskSession(Window window, Window owner, AdornerLayer layer, MaskAdorner adorner)
+ {
+ _window = window;
+ _owner = owner;
+ _layer = layer;
+ _adorner = adorner;
+ window.Closed += OnClosed;
+ owner.Closed += OnClosed;
+ }
+
+ private void OnClosed(object sender, EventArgs e)
+ {
+ Dispose();
+ }
+
+ public void Dispose()
+ {
+ if (_disposed)
+ return;
+ _disposed = true;
+ _window.Closed -= OnClosed;
+ _owner.Closed -= OnClosed;
+ _layer.Remove(_adorner);
+ _adorner.Child = null;
}
}
diff --git a/src/WPFDevelopers.Shared/Languages/Language.en-US.resx b/src/WPFDevelopers.Shared/Languages/Language.en-US.resx
index 71f0e74f..e882782f 100644
--- a/src/WPFDevelopers.Shared/Languages/Language.en-US.resx
+++ b/src/WPFDevelopers.Shared/Languages/Language.en-US.resx
@@ -120,6 +120,18 @@
OK
+
+ Theme
+
+
+ Follow system
+
+
+ Light mode
+
+
+ Dark mode
+
Cancel
diff --git a/src/WPFDevelopers.Shared/Languages/Language.ko-KR.resx b/src/WPFDevelopers.Shared/Languages/Language.ko-KR.resx
index afd986b0..3856d491 100644
--- a/src/WPFDevelopers.Shared/Languages/Language.ko-KR.resx
+++ b/src/WPFDevelopers.Shared/Languages/Language.ko-KR.resx
@@ -120,6 +120,18 @@
확인
+
+ 테마
+
+
+ 시스템 설정 따르기
+
+
+ 밝은 모드
+
+
+ 어두운 모드
+
취소
diff --git a/src/WPFDevelopers.Shared/Languages/Language.resx b/src/WPFDevelopers.Shared/Languages/Language.resx
index 14e17435..c9dd3249 100644
--- a/src/WPFDevelopers.Shared/Languages/Language.resx
+++ b/src/WPFDevelopers.Shared/Languages/Language.resx
@@ -145,6 +145,18 @@
关闭
+
+ 主题
+
+
+ 跟随系统
+
+
+ 浅色模式
+
+
+ 深色模式
+
选择
diff --git a/src/WPFDevelopers.Shared/Resources.cs b/src/WPFDevelopers.Shared/Resources.cs
index 8eb8e831..f0c3cc47 100644
--- a/src/WPFDevelopers.Shared/Resources.cs
+++ b/src/WPFDevelopers.Shared/Resources.cs
@@ -1,4 +1,4 @@
-using Microsoft.Win32;
+using Microsoft.Win32;
using System;
using System.ComponentModel;
using System.Collections.Generic;
@@ -23,8 +23,8 @@ public class Resources : ResourceDictionary, ISupportInitialize
private string[] resourceKeys = { "WindowBorderColor", "PrimaryColor" };
public static event ThemeChangedEvent ThemeChanged;
+ public event Action ThemeModeChanged;
- private static bool _hasRadiusSetByUser;
private static int _publishInProgress;
private int _initCount;
@@ -35,12 +35,54 @@ public ThemeType Theme
get => _theme;
set
{
- if (_theme == value) return;
- _theme = value;
- InitializeTheme(value);
+ switch (value)
+ {
+ case ThemeType.Default: ThemeMode = ThemeMode.System; break;
+ case ThemeType.Light: ThemeMode = ThemeMode.Light; break;
+ case ThemeType.Dark: ThemeMode = ThemeMode.Dark; break;
+ default: throw new ArgumentOutOfRangeException(nameof(value));
+ }
+ }
+ }
+
+ private ThemeMode _themeMode = ThemeMode.Light;
+ public ThemeMode ThemeMode
+ {
+ get => _themeMode;
+ set
+ {
+ if (!Enum.IsDefined(typeof(ThemeMode), value))
+ throw new ArgumentOutOfRangeException(nameof(value));
+ ThemePreferenceStore.Save(value);
+ SetThemeMode(value);
+ }
+ }
+
+ private void SetThemeMode(ThemeMode value)
+ {
+ if (_themeMode == value) return;
+ SystemEvents.UserPreferenceChanged -= OnUserPreferenceChanged;
+ _themeMode = value;
+ if (value == ThemeMode.System && OSVersionHelper.IsWindows10OrLater())
+ SystemEvents.UserPreferenceChanged += OnUserPreferenceChanged;
+ ApplyTheme();
+ ThemeModeChanged?.Invoke(value);
+ }
+
+ internal ThemeType ResolveTheme(ThemeMode mode)
+ {
+ switch (mode)
+ {
+ case ThemeMode.System:
+ return OSVersionHelper.IsWindows10OrLater() && IsDarkMode() ? ThemeType.Dark : ThemeType.Light;
+ case ThemeMode.Light: return ThemeType.Light;
+ case ThemeMode.Dark: return ThemeType.Dark;
+ default: throw new ArgumentOutOfRangeException(nameof(mode));
}
}
+ public bool IsDarkTheme => Theme == ThemeType.Dark;
+
private Color _color;
public Color Color
{
@@ -67,14 +109,15 @@ public double Radius
{
_radius = value;
_radiusSet = true;
- _hasRadiusSetByUser = true;
ElementHelper.OverrideCornerRadius(value);
}
}
public Resources()
{
+ var mode = ThemePreferenceStore.Load();
AddTheme();
+ SetThemeMode(mode);
}
void ISupportInitialize.BeginInit()
@@ -103,18 +146,6 @@ void AddTheme()
protected void InitializeTheme(ThemeType themeType,bool isInit = false)
{
- if(!isInit)
- {
- if (themeType == ThemeType.Default && OSVersionHelper.IsWindows10OrLater())
- {
- SystemEvents.UserPreferenceChanged -= OnUserPreferenceChanged;
- SystemEvents.UserPreferenceChanged += OnUserPreferenceChanged;
- ApplyTheme();
- return;
- }
- if (themeType == ThemeType.Default)
- Theme = ThemeType.Light;
- }
_theme = themeType;
Uri oldUri = themeType == ThemeType.Default || themeType == ThemeType.Light ? GetResourceUri("Dark.Color") : GetResourceUri("Light.Color");
if (oldUri != null)
@@ -153,17 +184,23 @@ bool IsDarkMode()
void ApplyTheme()
{
- var isDarkMode = IsDarkMode();
- var theme = isDarkMode == true ? ThemeType.Dark : ThemeType.Light;
+ var theme = ResolveTheme(ThemeMode);
if (Theme != theme)
- Theme = theme;
+ InitializeTheme(theme);
}
private void OnUserPreferenceChanged(object sender, UserPreferenceChangedEventArgs e)
{
- if (e.Category == UserPreferenceCategory.General)
+ if (ThemeMode == ThemeMode.System && e.Category == UserPreferenceCategory.General)
{
- ApplyTheme();
+ var dispatcher = Application.Current?.Dispatcher;
+ if (dispatcher != null && !dispatcher.CheckAccess())
+ dispatcher.BeginInvoke(new Action(() =>
+ {
+ if (ThemeMode == ThemeMode.System) ApplyTheme();
+ }));
+ else
+ ApplyTheme();
}
}
@@ -380,7 +417,7 @@ void UpdateResourceDictionaryColor(string key = "Primary", Color color = default
&&
TryFindResource(GenerateColorResourceKey("Base")) is Color colorBase
&&
- Theme == ThemeType.Dark)
+ IsDarkTheme)
tempColor = colorBase;
ThemeManager.Instance.ColorCache[newColor][keyTuple] = tempColor;
newColor = tempColor;
@@ -393,10 +430,10 @@ void UpdateResourceDictionaryColor(string key = "Primary", Color color = default
void SetResourceColorAndBrush(string key, Color color)
{
UpdateResource(key, color);
- var newBrush = new SolidColorBrush(color);
+ var brushKey = key.Replace("Color", "Brush");
+ Brush newBrush = new SolidColorBrush(color);
newBrush.Freeze();
- var keyBrush = key.Replace("Color", "Brush");
- UpdateResource(keyBrush, newBrush);
+ UpdateResource(brushKey, newBrush);
}
void UpdateResource(string key, object value)
@@ -408,6 +445,14 @@ void UpdateResource(string key, object value)
}
}
}
+
+ public enum ThemeMode
+ {
+ System,
+ Light,
+ Dark,
+ }
+
public enum ThemeType
{
Default,
diff --git a/src/WPFDevelopers.Shared/Styles/Styles.Buttons.xaml b/src/WPFDevelopers.Shared/Styles/Styles.Buttons.xaml
index 2c64b9b3..eed62244 100644
--- a/src/WPFDevelopers.Shared/Styles/Styles.Buttons.xaml
+++ b/src/WPFDevelopers.Shared/Styles/Styles.Buttons.xaml
@@ -1,9 +1,10 @@
-
@@ -315,49 +316,182 @@
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
Content="{TemplateBinding Content}"
- ContentTemplate="{TemplateBinding ContentTemplate}"
- Opacity="0.7" />
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ ContentTemplate="{TemplateBinding ContentTemplate}" />
+
+
+
+
+
+
+
+
+
-
\ No newline at end of file
+
diff --git a/src/WPFDevelopers.Shared/Styles/Styles.Menu.xaml b/src/WPFDevelopers.Shared/Styles/Styles.Menu.xaml
index 3237c9fb..bc607b3d 100644
--- a/src/WPFDevelopers.Shared/Styles/Styles.Menu.xaml
+++ b/src/WPFDevelopers.Shared/Styles/Styles.Menu.xaml
@@ -25,6 +25,7 @@
Width="{TemplateBinding Width}"
Height="{TemplateBinding Height}"
Background="{TemplateBinding Background}"
+ CornerRadius="{Binding Path=(helpers:ElementHelper.CornerRadius), RelativeSource={RelativeSource TemplatedParent}}"
SnapsToDevicePixels="True">
@@ -54,7 +55,8 @@
Padding="{TemplateBinding Padding}"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
- BorderThickness="1,1,1,0"
+ BorderThickness="1"
+ CornerRadius="{Binding Path=(helpers:ElementHelper.CornerRadius), RelativeSource={RelativeSource TemplatedParent}}"
SnapsToDevicePixels="True">
@@ -80,33 +82,30 @@
RecognizesAccessKey="True" />
-
-
+ PlacementTarget="{Binding ElementName=Border}"
+ VerticalOffset="2">
+
+
+
-
-
-
+
+
@@ -116,7 +115,7 @@
-
+
@@ -135,6 +134,7 @@
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="1,1,1,0"
+ CornerRadius="{Binding Path=(helpers:ElementHelper.CornerRadius), RelativeSource={RelativeSource TemplatedParent}}"
SnapsToDevicePixels="True">
@@ -173,49 +173,55 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -235,81 +241,93 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/WPFDevelopers.Shared/Styles/Styles.MessageBox.xaml b/src/WPFDevelopers.Shared/Styles/Styles.MessageBox.xaml
index 34a86b1e..a74c09bd 100644
--- a/src/WPFDevelopers.Shared/Styles/Styles.MessageBox.xaml
+++ b/src/WPFDevelopers.Shared/Styles/Styles.MessageBox.xaml
@@ -44,18 +44,19 @@
Foreground="{DynamicResource WD.PrimaryTextBrush}" />
@@ -75,6 +76,7 @@
MaxWidth="500"
Padding="10,0"
VerticalAlignment="Center"
+ Background="{DynamicResource WD.BackgroundBrush}"
BorderThickness="0"
FontSize="{DynamicResource WD.PrimaryFontSize}"
Foreground="{DynamicResource WD.RegularTextBrush}"
@@ -122,4 +124,4 @@
-
\ No newline at end of file
+
diff --git a/src/WPFDevelopers.Shared/Styles/Styles.ScrollBar.xaml b/src/WPFDevelopers.Shared/Styles/Styles.ScrollBar.xaml
index 0d10c88a..02efcd77 100644
--- a/src/WPFDevelopers.Shared/Styles/Styles.ScrollBar.xaml
+++ b/src/WPFDevelopers.Shared/Styles/Styles.ScrollBar.xaml
@@ -189,8 +189,7 @@
Height="2"
Margin="0,0,0,1"
VerticalAlignment="Bottom"
- IsEnabled="{TemplateBinding IsMouseOver}"
- Visibility="Hidden">
+ IsEnabled="{TemplateBinding IsMouseOver}">
@@ -348,6 +347,8 @@
x:Key="WD.DefaultScrollViewer"
BasedOn="{StaticResource WD.ControlBasicStyle}"
TargetType="{x:Type ScrollViewer}">
+
+
diff --git a/src/WPFDevelopers.Shared/ThemeManager.cs b/src/WPFDevelopers.Shared/ThemeManager.cs
index 48754bf5..3b73485a 100644
--- a/src/WPFDevelopers.Shared/ThemeManager.cs
+++ b/src/WPFDevelopers.Shared/ThemeManager.cs
@@ -69,11 +69,26 @@ public void SetColor(Color color)
private bool _themeAnimating;
public void SwitchTheme(FrameworkElement source, ThemeType targetTheme)
+ {
+ SwitchThemeCore(source, targetTheme, () => SetTheme(targetTheme));
+ }
+
+ public void SwitchThemeMode(FrameworkElement source, ThemeMode mode)
+ {
+ var targetTheme = Resources.ResolveTheme(mode);
+ SwitchThemeCore(source, targetTheme, () => Resources.ThemeMode = mode);
+ }
+
+ private void SwitchThemeCore(FrameworkElement source, ThemeType targetTheme, Action applyTheme)
{
if (_themeAnimating) return;
+ if (Resources.Theme == targetTheme)
+ {
+ applyTheme();
+ return;
+ }
_themeAnimating = true;
-
- var window = Application.Current.MainWindow;
+ var window = Window.GetWindow(source);
if (window == null) { _themeAnimating = false; return; }
var layoutRoot = ControlsHelper.FindVisualChild(window);
@@ -117,7 +132,7 @@ public void SwitchTheme(FrameworkElement source, ThemeType targetTheme)
layoutRoot.Children.Add(overlay);
- SetTheme(targetTheme);
+ applyTheme();
double duration = 400;
var easing = new CubicEase { EasingMode = EasingMode.EaseOut };
diff --git a/src/WPFDevelopers.Shared/Themes/Basic/Geometrys.xaml b/src/WPFDevelopers.Shared/Themes/Basic/Geometrys.xaml
index 0b555c7f..fbae08e1 100644
--- a/src/WPFDevelopers.Shared/Themes/Basic/Geometrys.xaml
+++ b/src/WPFDevelopers.Shared/Themes/Basic/Geometrys.xaml
@@ -3,6 +3,9 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:po="http://schemas.microsoft.com/winfx/2006/xaml/presentation/options">
M384 690l452-452 60 60-512 512-238-238 60-60z
+ M12 2a10 10 0 1 0 10 10A7 7 0 0 1 12 2Z
+ M2 5H7 M11 5H22 M2 12H13 M17 12H22 M2 19H5 M9 19H22 M9 3A2 2 0 1 1 9 7A2 2 0 1 1 9 3 M15 10A2 2 0 1 1 15 14A2 2 0 1 1 15 10 M7 17A2 2 0 1 1 7 21A2 2 0 1 1 7 17
+ M12 19a7 7 0 1 1 0-14 7 7 0 0 1 0 14Zm0-1.5a5.5 5.5 0 1 0 0-11 5.5 5.5 0 1 0 0 11Zm-5.657.157a.75.75 0 0 1 0 1.06l-1.768 1.768a.749.749 0 0 1-1.275-.326.749.749 0 0 1 .215-.734l1.767-1.768a.75.75 0 0 1 1.061 0ZM3.515 3.515a.75.75 0 0 1 1.06 0l1.768 1.768a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215L3.515 4.575a.75.75 0 0 1 0-1.06ZM12 0a.75.75 0 0 1 .75.75v2.5a.75.75 0 0 1-1.5 0V.75A.75.75 0 0 1 12 0ZM4 12a.75.75 0 0 1-.75.75H.75a.75.75 0 0 1 0-1.5h2.5A.75.75 0 0 1 4 12Zm8 8a.75.75 0 0 1 .75.75v2.5a.75.75 0 0 1-1.5 0v-2.5A.75.75 0 0 1 12 20Zm12-8a.75.75 0 0 1-.75.75h-2.5a.75.75 0 0 1 0-1.5h2.5A.75.75 0 0 1 24 12Zm-6.343 5.657a.75.75 0 0 1 1.06 0l1.768 1.768a.751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018l-1.768-1.767a.75.75 0 0 1 0-1.061Zm2.828-14.142a.75.75 0 0 1 0 1.06l-1.768 1.768a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l1.767-1.768a.75.75 0 0 1 1.061 0Z
M 998 352 C 998 344 994 335 988 329 L 938 279 C 932 273 924 269 915 269 C 907 269 898 273 892 279 L 499 672 L 106 279 C 100 273 91 269 83 269 C 75 269 66 273 60 279 L 10 329 C 4 335 0 344 0 352 C 0 360 4 369 10 375 L 476 841 C 482 847 491 851 499 851 C 507 851 516 847 522 841 L 988 375 C 994 369 998 360 998 352 Z
M8.1772461,11.029181 L10.433105,
diff --git a/src/WPFDevelopers.Shared/Themes/Dialog.xaml b/src/WPFDevelopers.Shared/Themes/Dialog.xaml
new file mode 100644
index 00000000..3cf22b77
--- /dev/null
+++ b/src/WPFDevelopers.Shared/Themes/Dialog.xaml
@@ -0,0 +1,107 @@
+
+
+
+
+
diff --git a/src/WPFDevelopers.Shared/Themes/NumericBox.xaml b/src/WPFDevelopers.Shared/Themes/NumericBox.xaml
index 76be266f..2cdecc9d 100644
--- a/src/WPFDevelopers.Shared/Themes/NumericBox.xaml
+++ b/src/WPFDevelopers.Shared/Themes/NumericBox.xaml
@@ -19,6 +19,15 @@
+
+
+
+
+
+
+
+
+
diff --git a/src/WPFDevelopers.Shared/Themes/PathIcon.xaml b/src/WPFDevelopers.Shared/Themes/PathIcon.xaml
index a9cb4c96..7356b3e1 100644
--- a/src/WPFDevelopers.Shared/Themes/PathIcon.xaml
+++ b/src/WPFDevelopers.Shared/Themes/PathIcon.xaml
@@ -22,6 +22,11 @@
+
+
+
+
+
@@ -34,7 +39,10 @@
@@ -43,6 +51,14 @@
+
+
+
+
+
+
+
+