diff --git a/CONTRIBUTING.en-US.md b/CONTRIBUTING.en-US.md index a8434c4..03f9fdd 100644 --- a/CONTRIBUTING.en-US.md +++ b/CONTRIBUTING.en-US.md @@ -101,7 +101,7 @@ launcher-home/ ### Space between latin and other characters -For some language-specified documents (e.g. Chinese), it's essential to use spaces between [Chinese] and [English/letters/numbers/minor-symbols]. +For some language-specified documents (e.g. Chinese), it's essential to use spaces between [Chinese] and [English/letters/numbers/minor-symbols]. ### Always use English symbols (with exceptions) @@ -113,7 +113,7 @@ For short date, please use `MM/dd/yyyy` format (e.g `05/02/2024`). for long date For time, always follow `HH:mm` or `HH:mm:ss` rule (e.g. `16:20`, `08:06:45`). **The military time** (24-hour clock) will always be used. -The rules above applies to all documents and all locales, no matter what language the document is. +The rules above applies to all documents and all locales, no matter what language the document is. ### Example @@ -121,7 +121,7 @@ For example, avoid writing like this: ```md 2024.5.2 4:08 | 2nd May 2024 | 2024年5月2日下午4点8分 -我买了34个苹果(是红的)和1只鸡【不知道是公鸡 / 还是 / 母鸡】。 +我买了34个苹果 (是红的) 和1只鸡【不知道是公鸡 / 还是 / 母鸡】。 ``` Instead, write like this for better readability: @@ -135,7 +135,7 @@ Instead, write like this for better readability: This guide aims to provide a clear and comprehensive overview of the document structure for (potential) contributors like you. It covers naming conventions, file structure, and specific rules for writing documents. -If you have any questions, you can submit an issue on Github, join our community, or contact us directly via [email](mailto://notyoojun@outlook.com). If there's anything unclear in this article, feel free to tell us or submit a Pull Request. We greatly appreciate your valuable work, which makes the documentation center better! +If you have any questions, you can submit an issue on GitHub, join our community, or contact us directly via [email](mailto://notyoojun@outlook.com). If there's anything unclear in this article, feel free to tell us or submit a Pull Request. We greatly appreciate your valuable work, which makes the documentation center better!
diff --git a/CONTRIBUTING.zh-CN.md b/CONTRIBUTING.zh-CN.md index 38a3c16..1a0c9a9 100644 --- a/CONTRIBUTING.zh-CN.md +++ b/CONTRIBUTING.zh-CN.md @@ -22,13 +22,13 @@ 每篇文章都有其指定的文件夹,由一个两位数的数字表示 + "." (如果你想手动排序),一个 # 号加空格,再加上 kebab 格式的 slug ~~以及烤肉串盒中的蛞蝓~~组成。举个例子,一篇关于按钮设计的文章会嵌套在文件夹中,如下所示:`02.# button-design`。在列举控件和 API 的时候,我们更倾向于让其根据字母自动排序,就可以写:`# button-design`。 -- **文章元数据和内容文件**:在这些文件夹中,`index.meta.yml` 包含以 YAML 格式跨语言共享的元数据。在名为`index.{language_code}.mdx`,每个都包含特定于该语言的前 Front matter 数据。 +- **文章元数据和内容文件**:在这些文件夹中,`index.meta.yml` 包含以 YAML 格式跨语言共享的元数据。在名为`index.{language_code}.mdx`,每个都包含特定于该语言的前 Front matter 数据。 关于 Font matter 的更多信息,请参见: [markdown-features#front-matter](https://docusaurus.io/zh-CN/docs/markdown-features#front-matter) 和 [plugin-content-docs#markdown-front-matter](https://docusaurus.io/zh-CN/docs/api/plugins/@docusaurus/plugin-content-docs#markdown-front-matter)。 示例:`index.en-US.mdx`,`index.zh-CN.mdx` -- **图像命名**:文章中的图片应当和 **index.{语言代号}.mdx** 存在同一目录内,并且以简短的 kebab 形式命名,比如 `create-a-new-project.png`。对于屏幕截图和其他较小的图片,请使用 PNG 格式,对于较大的图片,请使用 JPG 或 JPEG 格式。 +- **图像命名**:文章中的图片应当和 **index.{语言代号}.mdx** 存在同一目录内,并且以简短的 kebab 形式命名,比如 `create-a-new-project.png`。对于屏幕截图和其他较小的图片,请使用 PNG 格式,对于较大的图片,请使用 JPG 或 JPEG 格式。 示例:`create-new-project.png`,`mountain-view.jpg` @@ -40,7 +40,7 @@ MDX 的强大功能可以将内容与其独特功能相结合。使用 Markdown 清晰地重建您的想法,并使用 Markdown 格式强调重要元素,以引导读者更加层次分明地了解信息。 -我们鼓励您在正确的地方使用**告示 (Admonitions)** (一种由 Docusaurus 提供的 MDX 特性),以提供清晰舒适的外观。您可以转到 [admonitions](https://docusaurus.io/zh-CN/docs/markdown-features/admonitions) 来了解更多. +我们鼓励您在正确的地方使用**告示 (Admonitions)** (一种由 Docusaurus 提供的 MDX 特性) ,以提供清晰舒适的外观。您可以转到 [admonitions](https://docusaurus.io/zh-CN/docs/markdown-features/admonitions) 来了解更多. 请记住,请为步骤和其他方案使用正确的标题结构。例如,这看起来不太好: @@ -121,7 +121,7 @@ launcher-home/ ``` 2024.5.2 4:08 | 2nd May 2024 | 2024年5月2日下午4点8分 -我买了34个苹果(是红的)和1只鸡【不知道是公鸡 / 还是 / 母鸡】。 +我买了34个苹果 (是红的) 和1只鸡【不知道是公鸡 / 还是 / 母鸡】。 ``` 相反,为了更好的可读性,请这样写: @@ -135,7 +135,7 @@ launcher-home/ 本指南旨在为 (潜在) 贡献者 (比如正在看这篇文章的你) 提供清晰而全面的文档结构概述。它涵盖了命名方式、文件架构以及编写文档的特定规则。 -如果您有任何问题,可以在 Github issues 中~~开票~~提交问题,加入我们的社区,或通过[电子邮件](mailto://notyoojun@outlook.com)直接联系我们。如果有文章有哪里没讲清楚,也可以直接提交 Pull Request。我们非常感谢您的重要工作,这会使文档中心变得更好! +如果您有任何问题,可以在 GitHub issues 中~~开票~~提交问题,加入我们的社区,或通过[电子邮件](mailto://notyoojun@outlook.com)直接联系我们。如果有文章有哪里没讲清楚,也可以直接提交 Pull Request。我们非常感谢您的重要工作,这会使文档中心变得更好!
@@ -155,17 +155,17 @@ launcher-home/ > 如果是文章:02.# article-name > 前面的数字是显示在侧边栏的序号,接下来有.作为分隔符。 > -> 如果这个文件夹是分类(里面有其他文章),那个就在点后面加空格并写分类的slug(采用kebab命名格式) , -> 分类文件夹下应该有_category_.json,_category_.en-US.json,等,他们包含了这一分组的元数据。对于不同语言公用的元数据(比如此分类是否默认展开),就会在_category_.json中;对于语言特定的元数据(比如显示名称,描述),就在_category_.{语言代码}.json中。 +> 如果这个文件夹是分类 (里面有其他文章) ,那个就在点后面加空格并写分类的slug (采用kebab命名格式) , +> 分类文件夹下应该有_category_.json,_category_.en-US.json,等,他们包含了这一分组的元数据。对于不同语言公用的元数据 (比如此分类是否默认展开) ,就会在_category_.json中;对于语言特定的元数据 (比如显示名称,描述) ,就在_category_.{语言代码}.json中。 > 这个文件中可以写的内容请详见:https://docusaurus.io/zh-CN/docs/sidebar/autogenerated#category-item-metadata > -> 如果这个文件夹是单个文章,那么文件名在序号和点之后应该有一个#号,并且#和slug之间有空格。对于单个文章的文件夹,里面应该有index.meta.yml(单篇文章共用元数据),和内容index.{语言代号}.mdx(如index.en-US.mdx和index.zh-CN.mdx)。对于不同语言公用的元数据,就会在index.meta.yml中以yaml格式存储;队医单个语言特定的元数据,则存储在index.{语言代号}.mdx的front matter中。关于元数据请参见:https://docusaurus.io/zh-CN/docs/markdown-features#front-matter 和 https://docusaurus.io/docs/api/plugins/@docusaurus/plugin-content-docs#markdown-front-matter。 +> 如果这个文件夹是单个文章,那么文件名在序号和点之后应该有一个#号,并且#和slug之间有空格。对于单个文章的文件夹,里面应该有index.meta.yml (单篇文章共用元数据) ,和内容index.{语言代号}.mdx (如index.en-US.mdx和index.zh-CN.mdx) 。对于不同语言公用的元数据,就会在index.meta.yml中以yaml格式存储;对于单个语言特定的元数据,则存储在index.{语言代号}.mdx的front matter中。关于元数据请参见:https://docusaurus.io/zh-CN/docs/markdown-features#front-matter 和 https://docusaurus.io/docs/api/plugins/@docusaurus/plugin-content-docs#markdown-front-matter。 > 文章中的图片应当和index.{..}.mdx存在同一目录内,并且以简短的kebab形式命名,比如 create-a-new-project.png。对于屏幕截图和其他较小的图片,请使用png格式,对于较大的图片,请使用jpg格式。 > -> 文章内采用mdx格式进行编写,建议积极使用MDX的特殊功能,如告示(https://docusaurus.io/zh-CN/docs/markdown-features/admonitions)。 +> 文章内采用mdx格式进行编写,建议积极使用MDX的特殊功能,如告示 (https://docusaurus.io/zh-CN/docs/markdown-features/admonitions) 。 > 请严格按照markdown的1-3级标题规划文章结构,并在合适的位置使用****,``,**,等markdown格式,这样能让读者更好地分清重点。 > -> 在编写中文文章时,请一定要注意在 [中文] 和 [英文/字母/数字/半角符号] 中使用空格。所有括号请使用半角符号,并在括号的外侧各添加一个空格。(斜线可以不加空格) -> 比如错误示范:2024年5月2日,我买了34个苹果(是红的)和1只鸡【不知道是公鸡 / 还是 / 母鸡】。 +> 在编写中文文章时,请一定要注意在 [中文] 和 [英文/字母/数字/半角符号] 中使用空格。所有括号请使用半角符号,并在括号的外侧各添加一个空格。 (斜线可以不加空格) +> 比如错误示范:2024年5月2日,我买了34个苹果 (是红的) 和1只鸡【不知道是公鸡 / 还是 / 母鸡】。 > 正确示范:2024 年 5 月 2 日,我买了 34 个苹果 (是红的) 和 1 只鸡 [不知道是公鸡/还是/母鸡]。 > ``` diff --git a/data/blogs/announcements/2024-01-17-social-username-change/index.en-US.mdx b/data/blogs/announcements/2024-01-17-social-username-change/index.en-US.mdx index e4c7a4b..f1178a2 100644 --- a/data/blogs/announcements/2024-01-17-social-username-change/index.en-US.mdx +++ b/data/blogs/announcements/2024-01-17-social-username-change/index.en-US.mdx @@ -11,9 +11,9 @@ New link: https://github.com/iNKORE-NET {/* truncate */} -This transition will affect all the existing links or references to our organization on Github. We recommend updating your bookmarks and favorites to reflect the new name. +This transition will affect all the existing links or references to our organization on GitHub. We recommend updating your bookmarks and favorites to reflect the new name. -We believe this change will enhance our online visibility and make it easier for people to engage with us on Github. We look forward to continuing to share our projects and collaborate with others in the open-source community under our new name. +We believe this change will enhance our online visibility and make it easier for people to engage with us on GitHub. We look forward to continuing to share our projects and collaborate with others in the open-source community under our new name. Best regards, NotYoojun.! from iNKORE Studios diff --git a/data/blogs/announcements/2024-01-17-social-username-change/index.zh-CN.mdx b/data/blogs/announcements/2024-01-17-social-username-change/index.zh-CN.mdx index 218d7fd..01a933a 100644 --- a/data/blogs/announcements/2024-01-17-social-username-change/index.zh-CN.mdx +++ b/data/blogs/announcements/2024-01-17-social-username-change/index.zh-CN.mdx @@ -11,9 +11,9 @@ tags: [工作室, 名称, 用户名, 社交, 公告] {/* truncate */} -此转换将影响 Github 上对我们组织的所有现有链接或引用。我们建议您更新书签和收藏夹以反映新名称。 +此转换将影响 GitHub 上对我们组织的所有现有链接或引用。我们建议您更新书签和收藏夹以反映新名称。 -我们相信这一变化将提高我们的在线知名度,并使人们更容易在 Github 上与我们互动。我们期待继续分享我们的项目,并以我们的新名称与开源社区中的其他人合作。 +我们相信这一变化将提高我们的在线知名度,并使人们更容易在 GitHub 上与我们互动。我们期待继续分享我们的项目,并以我们的新名称与开源社区中的其他人合作。 此致敬意 NotYoojun.! 来自 iNKORE Studios diff --git a/data/blogs/blog/2024-09-17-reflection-interest-in-opensource-community/index.en-US.mdx b/data/blogs/blog/2024-09-17-reflection-interest-in-opensource-community/index.en-US.mdx index 8fdef8f..e9fb99f 100644 --- a/data/blogs/blog/2024-09-17-reflection-interest-in-opensource-community/index.en-US.mdx +++ b/data/blogs/blog/2024-09-17-reflection-interest-in-opensource-community/index.en-US.mdx @@ -37,13 +37,13 @@ https://github.com/iNKORE-NET/UI.WPF.Modern ### Background -I remember when I just started our studio's first desktop application, I decided to use WPF for development, but the interface that Microsoft made for WPF... it's really hard to judge. After several hours, I found a project called ModernWpf on Github. The controls in it are all in the style of Windows 10, and at this time Windows 11 has been released, so I was thinking, is there a control library in the style of Windows 11? Later I found a branch repository of ModernWpf, and the controls in it are in the style of Windows 11. +I remember when I just started our studio's first desktop application, I decided to use WPF for development, but the interface that Microsoft made for WPF... it's really hard to judge. After several hours, I found a project called ModernWpf on GitHub. The controls in it are all in the style of Windows 10, and at this time Windows 11 has been released, so I was thinking, is there a control library in the style of Windows 11? Later I found a branch repository of ModernWpf, and the controls in it are in the style of Windows 11. The author of this fork is one of the main characters in this incident, let's just call him Whatwhat. I looked at the license of this library, it was (and is) the MIT license, so I forked this library and started my control library journey. Before I started my control library, I also tried to connect with the original author Whatwhat, to begin with he wanted me to join his ModernWpf project. Whatwhat's idea is "porting UWP", while my idea is "creating WPF", so we fell out. After that, I started my control library journey, I named this library iUWM, the purpose of this library is to make it easier for WPF developers to use Windows 11 style controls. I added a lot of my own ideas to this library, such as control styles, control behaviors, etc., for example, I gave users the ability to completely control the window title bar height and buttons, which Whatwhat thought should not exist. -At first, I wrote this library mainly for myself and the studio's projects, so I casually made the repository public on Github, but I didn't expect this repository to be discovered quickly, and now it has a considerable number of stars and usage. I am very happy and proud. However, Whatwhat does not buy it, he thought that this library is his fork library, and I should continue to use the name of ModernWpf instead of iUWM. +At first, I wrote this library mainly for myself and the studio's projects, so I casually made the repository public on GitHub, but I didn't expect this repository to be discovered quickly, and now it has a considerable number of stars and usage. I am very happy and proud. However, Whatwhat does not buy it, he thought that this library is his fork library, and I should continue to use the name of ModernWpf instead of iUWM. :::info My judgments diff --git a/data/blogs/blog/2024-09-17-reflection-interest-in-opensource-community/index.zh-CN.mdx b/data/blogs/blog/2024-09-17-reflection-interest-in-opensource-community/index.zh-CN.mdx index bacec20..9ae528d 100644 --- a/data/blogs/blog/2024-09-17-reflection-interest-in-opensource-community/index.zh-CN.mdx +++ b/data/blogs/blog/2024-09-17-reflection-interest-in-opensource-community/index.zh-CN.mdx @@ -10,7 +10,7 @@ tags: ["开源", "利益", "回顾与反思", "社区", "iNKORE.UI.WPF.Modern"] :::note -**极限省流版 (表达并不准确也不够中立,有时间和心情的话最好看下文):** 开放源代码社区里,我们借鉴了别人的代码 (根据 MIT 许可证完全合法合理吗,除了我们疏忽未将原作者名字进行标注) 做了个衍生作品,我们做得比原作者好(用的人比原作多,收藏数量是原作的十多倍),原作者急眼了,到处去群里爆我们阴阳我们。虽然我们没有按照许可证要求标明原作者,但是我们在事情发生之后第一时间找到了原作者,可是他变本加厉,继续阴阳... +**极限省流版 (表达并不准确也不够中立,有时间和心情的话最好看下文):** 开放源代码社区里,我们借鉴了别人的代码 (根据 MIT 许可证完全合法合理,除了我们疏忽未将原作者名字进行标注) 做了个衍生作品,我们做得比原作者好(用的人比原作多,收藏数量是原作的十多倍),原作者急眼了,到处去群里爆我们阴阳我们。虽然我们没有按照许可证要求标明原作者,但是我们在事情发生之后第一时间找到了原作者,可是他变本加厉,继续阴阳... ::: @@ -53,13 +53,13 @@ https://github.com/iNKORE-NET/UI.WPF.Modern ### 前情提要 -我记得当时我才开始我们工作室的第一个桌面应用,决定使用 WPF 来开发,但是微软给 WPF 做的界面啊...真是一言难尽。几番摸索,在 Github 上找到了一个名为 ModernWpf 的项目。它里面的控件都是 Windows 10 风格的,正好此时 Windows 11 已经发布了,我就在想,有没有一个控件库是 Windows 11 风格的呢?于是我就找到了 ModernWpf 的一个分支仓库,这个里面的控件库就是 Windows 11 风格的。 +我记得当时我才开始我们工作室的第一个桌面应用,决定使用 WPF 来开发,但是微软给 WPF 做的界面啊...真是一言难尽。几番摸索,在 GitHub 上找到了一个名为 ModernWpf 的项目。它里面的控件都是 Windows 10 风格的,正好此时 Windows 11 已经发布了,我就在想,有没有一个控件库是 Windows 11 风格的呢?于是我就找到了 ModernWpf 的一个分支仓库,这个里面的控件库就是 Windows 11 风格的。 这个控件库的作者就是这次事件的主要人物之一,我就称他为 Whatwhat 吧。我看了下这个库的许可证,是 MIT 许可证,我就 fork 了这个库,然后开始了我的控件库之旅。在做自己的控件库之前也和原作者 Whatwhat 交流过,他首先想让我加入他的 ModernWpf 项目。Whatwhat 的想法是 "移植 UWP",而我的想法是 "创造 WPF",于是就谈崩了。 在此之后,我就开始了我的控件库之旅,我将这个库命名为 iUWM,这个库的目的是为了让 WPF 开发者能够更加方便地使用 Windows 11 风格的控件。我在这个库里面加入了很多自己的想法,比如说控件的样式,控件的行为等等,比如,我赋予了用户完全掌控窗口标题栏高度和按钮的能力,这些在 Whatwhat 的眼里是不应该有的。 -刚开始我编写此库主要是为了自己和工作室的项目,也就随手把仓库公开在 Github 上,没想到这个仓库很快被人发现,现在已经相当数量的 star 和使用量了。我很开心,也很自豪,但是 Whatwhat 对此并不买账,他认为我这个库是他的分支库,我应该继续使用 ModernWpf 的名字,而不是 iUWM。 +刚开始我编写此库主要是为了自己和工作室的项目,也就随手把仓库公开在 GitHub 上,没想到这个仓库很快被人发现,现在已经相当数量的 star 和使用量了。我很开心,也很自豪,但是 Whatwhat 对此并不买账,他认为我这个库是他的分支库,我应该继续使用 ModernWpf 的名字,而不是 iUWM。 :::info 我的评判 diff --git a/data/blogs/blog/2025-08-20-evidence-based-expose-infringement-of-mcskinn/index.zh-CN.mdx b/data/blogs/blog/2025-08-20-evidence-based-expose-infringement-of-mcskinn/index.zh-CN.mdx index 0f706fb..0f1cacc 100644 --- a/data/blogs/blog/2025-08-20-evidence-based-expose-infringement-of-mcskinn/index.zh-CN.mdx +++ b/data/blogs/blog/2025-08-20-evidence-based-expose-infringement-of-mcskinn/index.zh-CN.mdx @@ -19,7 +19,7 @@ This post is only available in Simplified Chinese, as this incident happened in :::info -由于事情发生在中国大陆,聊天截图将以中文展示;此文章中引用的聊天记录图片都为了优化阅读体验而进行了处理,同时也隐去了一些不应当披露的个人信息。虽然本文中直接引用的聊天记录并非可以直接作为证据,我们已将仅经过必要修改的聊天记录 (按照法律与道德对人员的隐私保护要求) 统一存储到了 Github 仓库中,供有需要的读者查阅,你也可以通过查阅它们来更客观,更全面地了解事情经过——理性吃瓜。 +由于事情发生在中国大陆,聊天截图将以中文展示;此文章中引用的聊天记录图片都为了优化阅读体验而进行了处理,同时也隐去了一些不应当披露的个人信息。虽然本文中直接引用的聊天记录并非可以直接作为证据,我们已将仅经过必要修改的聊天记录 (按照法律与道德对人员的隐私保护要求) 统一存储到了 GitHub 仓库中,供有需要的读者查阅,你也可以通过查阅它们来更客观,更全面地了解事情经过——理性吃瓜。 **查看完整的聊天记录存档**:https://github.com/iNKORE-NET/Hallofshame/tree/main/archives/2025-08/QGroup682528253 diff --git a/data/docs/ui-wpf-modern/02.# onboarding/index.en-US.mdx b/data/docs/ui-wpf-modern/02.# onboarding/index.en-US.mdx index ad39701..18c5a4c 100644 --- a/data/docs/ui-wpf-modern/02.# onboarding/index.en-US.mdx +++ b/data/docs/ui-wpf-modern/02.# onboarding/index.en-US.mdx @@ -86,7 +86,7 @@ Then you're expected to see this package has been added to your dependencies lis :::info -There are a few other libraries appearing when searching. You can learn more about them in our [Github profile](https://github.com/iNKORE-NET) and their repositories. +There are a few other libraries appearing when searching. You can learn more about them in our [GitHub profile](https://github.com/iNKORE-NET) and their repositories. ::: diff --git a/data/docs/ui-wpf-modern/02.# onboarding/index.zh-CN.mdx b/data/docs/ui-wpf-modern/02.# onboarding/index.zh-CN.mdx new file mode 100644 index 0000000..ebf5a3a --- /dev/null +++ b/data/docs/ui-wpf-modern/02.# onboarding/index.zh-CN.mdx @@ -0,0 +1,220 @@ +# 快速开始 + +在本指南中,我们将引导您完成将 iNKORE.UI.WPF.Modern 库集成到应用程序中的过程,让您为 WPF 项目带来现代化和视觉上引人入胜的用户界面。凭借对 Fluent Design 元素的支持和灵活的自定义选项,iNKORE.UI.WPF.Modern 可以将您的应用程序转变为一个视觉上令人惊艳的体验。 + + +## 第 1 步:调整配置 + +在安装软件包之前,我们建议您对项目设置进行一些调整。在解决方案视图中右键单击项目,然后单击**属性**。 + +![右键单击项目](right-click-the-project.png) + +### 对于 .NET Framework 项目 + +如果您的 csproj 风格是旧式的,您应该看到这个界面: + +![项目属性 (旧式) ](legacy-csproj-props.png) + +:::info 提醒 + +我们强烈建议您将 csproj 文件转换为[SDK 风格](https://learn.microsoft.com/zh-cn/dotnet/core/project-sdk/overview),它提供更多功能和更好的体验。有关更多信息,请查看 Microsoft 的文档。 + +::: + +如果您的项目已经升级到 SDK 风格,您应该能够看到这样的界面: + +![项目属性 (SDK 风格) ](sdk-csproj-props.png) + +无论您的 csproj 文件是什么风格,请确保目标框架是 .NET Framework 4.6.2 或更高版本。 + +如果您使用的是较旧的框架版本,库可能无法正确加载。 + +### 对于 .NET Core (也包括 6.0 及更高版本) 项目 + +首先,请确保框架是 .NET 6.0 或更高版本。 + +![创建 .NET 6.0 应用](creating-dotnet-6-project.png) + +![在项目属性中设置目标框架](dotnet-6-project-props-framework.png) + +:::danger 注意! + +我们刚刚删除了对 .NET Core 3.1 和 .NET 5.0 的支持,这意味着这些框架与此库的最新版本不兼容。 + +如果您必须坚持使用这些旧版本,您仍然可以下载完整源代码并自己编译具有旧版本支持的二进制文件。但是,由于对较新 API 的一些引用,此编译可能会失败。 + +::: + +然后让我们关注**目标 OS 版本**选项。我们建议您将其设置为 `10.0.18362.0` 或更高版本以启用主题同步功能。 + +![目标 OS 版本](target-os-version.png) + +:::warning + +如果目标版本设置为 10.0,您可能会在输出目录中看到这些文件: + +![Windows RT 依赖文件](the-rt-files.png) + +这是由 .NET SDK 引起的,与我们的任何库都无关。 + +如果您在意这一点,那么将其设置为 7.0,虽然这会使这两个文件消失,但您的应用将无法跟随系统主题。 + +::: + + +:::tip + +虽然**目标 OS 版本**设置为 10.0,但您可以将**支持的 OS 版本**设置为任何您想要的版本。为了在 .NET 支持的任何 Windows 版本上运行您的应用,最好的选择是将其设置为 `7.0`。 + +![支持的 OS 版本](supported-os-version.png) + +::: + +## 第 2 步:安装软件包 + +再次右键单击您的项目,然后单击**管理 NuGet 程序包**菜单。 + +![右键单击项目](right-click-the-project.png) + +然后单击**浏览**,在搜索框中输入 `inkore`。我们所有的公开库都会出现在这里。然后选择 `iNKORE.UI.WPF.Modern` 并单击**安装**,再选择 `iNKORE.UI.WPF` 并再次单击安装。 + +![浏览 NuGet 程序包](browse-nuget-package.png) + +然后您应该看到此程序包已添加到您的依赖项列表中: + +![依赖项列表中的程序包](package-in-the-deps.png) + +:::info + +搜索时会出现一些其他库。您可以在我们的 [GitHub 主页](https://github.com/iNKORE-NET)及其存储库中了解更多信息。 + +::: + +:::warning 为什么是 **iNKORE.UI.WPF**? + +通常,我们使用 `iNKORE.UI.WPF` 作为所有 WPF 库的基础库。它包含在所有 WPF 库之间共享的一些常见实用程序和控件。 + +如果您在运行时看到此异常,请手动安装 `iNKORE.UI.WPF`: + +> **System.Windows.Markup.XamlParseException**: 'Initialization of 'iNKORE.UI.WPF.Modern.ThemeResources' threw an exception.' + +> [InnerException] +> FileNotFoundException: Could not load file or assembly 'iNKORE.UI.WPF, Version=######, Culture=neutral, PublicKeyToken=######'. The system cannot find the file specified. + + +当您安装 iNKORE.UI.WPF.Modern 时,iNKORE.UI.WPF 应该会自动安装。但是,由于某些原因 (可能是 NuGet 内部错误或配置错误) ,它可能不会被安装。 + +如果您找到了一种方法来确保 `iNKORE.UI.WPF` 自动安装,请告诉我们。 + +::: + +## 第 3 步:添加主题资源 + +打开根目录中的 `App.xaml` 文件,并添加命名空间声明: + +```ini +xmlns:ui="http://schemas.inkore.net/lib/ui/wpf/modern" +``` + +然后,在 `Application.Resources` 中,创建一个新的 `ResourceDictionary` 并添加属性 `ResourceDictionary.MergedDictionaries`。 + +在 `MergedDictionaries` 中,添加新的 `ui:ThemeResources` 和 `ui:XamlControlsResources` 实例。 + +最后,您的 `App.xaml` 文件应该如下所示: + +```xml title="App.xaml" + + + + +# highlight-start + + +# highlight-end + + + + + + + +``` + +此时,现代主题已成功添加到项目中。所有控件现在应该都具有现代风格。 + + +## 第 4 步:将样式应用到 MainWindow + +让我们将现代样式应用到主窗口。转到 `MainWindow.xaml`,首先添加命名空间声明: + +```ini +xmlns:ui="http://schemas.inkore.net/lib/ui/wpf/modern" +``` + +然后通过应用此附加属性让窗口使用现代样式: + +```ini +ui:WindowHelper.UseModernWindowStyle="True" +``` + +:::info + +与其他控件不同,由于安全和兼容性原因,窗口无法在不手动设置其样式的情况下全局设置样式。 + +::: + +现在,如果您运行该应用,您可以看到窗口具有现代风格的框架。您还可以使用 `ui:WindowHelper.SystemBackdropType` 属性向窗口添加材质: + +```ini +ui:WindowHelper.SystemBackdropType="Mica" +``` + +现在您的 `MainWindow.xaml` 应该如下所示: + +```xml title="MainWindow.xaml" + + + + + + + + +``` + +![仅带图标的 Button](button-with-icon-only.png) + +有关 *ui:FontIcon* 的更多信息,请[点击这里](%BASE_NAME%/components/media/font-icon) + +### 带图标和文本的 Button + +如果你想同时显示图标和文本,最好的方式是使用 ui:IconAndText 组件。它将图标和文本组合在一起: + +```xml + +``` + +![带图标和文本的按钮](a-button-with-icon-and-text.png) + +有关 IconAndText 的更多信息,请[点击这里](%BASE_NAME%/components/media/icon-and-text) + +如果你不想使用 FontIcon,或者你想完全自定义子组件 (不推荐这样做,因为这可能会增加复杂性并使维护更困难) ,可以尝试以下代码: + +```xml + +``` + +### 强调按钮 (Accent Button) + +强调按钮属于高强调级别,通过使用层级和填充进行区分。它们包含对你的应用程序最重要的操作。 + +要为 Button 应用强调样式,需要将 Style 属性设置为 `{StaticResource {x:Static ui:ThemeKeys.AccentButtonStyleKey}}`。 + +```xml + +``` + +这样当鼠标移动到按钮上时,背景颜色就会变为绿色。以此方法,你可以重写任意未被硬编码的资源 (颜色、画刷、厚度、Double、动画等) 。 + +![](make-hover-green.gif) + +:::info 小许缺憾 + +在 Visual Studio 中,`x:Static` 用于 `x:Key` 时 IntelliSense 有时体验不佳,但这只是编辑器的问题,运行时代码仍然有效。 + +::: + +### 重写多个资源 + +你可以在某个容器上一次性重写多项资源,从而影响该容器及其子元素。例如,可以让所有按钮在悬停时变绿、按下时变蓝: + +```xml + +# highlight-start + + + + + +# highlight-end + + +``` + +![Red button](red-button.png) + +## 另请参阅 + +### 相关文章 + +- [主题 / 主题资源](%BASE_NAME%/features/theming/theme-resources) + +- [定义 / StaticResourceExtension Class](%BASE_NAME%/definitions/markup/static-resource-extension) + +### Microsoft Learn + +- [ResourceDictionary Class (WPF)](https://learn.microsoft.com/zh-cn/dotnet/api/system.windows.resourcedictionary) + +- [Application Resource, Content, and Data Files - WPF](https://learn.microsoft.com/zh-cn/dotnet/desktop/wpf/app-development/wpf-application-resource-content-and-data-files) + +- [Merged resource dictionaries (WPF .NET)](https://learn.microsoft.com/zh-cn/dotnet/desktop/wpf/systems/xaml-resources-merged-dictionaries) \ No newline at end of file diff --git a/data/docs/ui-wpf-modern/04. features/02. overrides/category.zh-CN.json b/data/docs/ui-wpf-modern/04. features/02. overrides/category.zh-CN.json new file mode 100644 index 0000000..2c0c98f --- /dev/null +++ b/data/docs/ui-wpf-modern/04. features/02. overrides/category.zh-CN.json @@ -0,0 +1,8 @@ +{ + "label": "重写", + "link": + { + "type": "generated-index", + "description": "重写功能使您能够高度自定义组件的外观。" + } +} diff --git a/data/docs/ui-wpf-modern/05. definitions/00. controls/00. helpers/# window-helper/index.en-US.mdx b/data/docs/ui-wpf-modern/05. definitions/00. controls/00. helpers/# window-helper/index.en-US.mdx index 45bc1c7..ec98574 100644 --- a/data/docs/ui-wpf-modern/05. definitions/00. controls/00. helpers/# window-helper/index.en-US.mdx +++ b/data/docs/ui-wpf-modern/05. definitions/00. controls/00. helpers/# window-helper/index.en-US.mdx @@ -78,7 +78,7 @@ This property decides whether the **Background** property will be applied to the ### ApplyNoise -This property decides whether the noise effect will be applied to the window. If you set this property to **False**, the noise effect will not be rendered. The noise effect is a subtle noise texture that makes the window look more natural and less flat. The default value is always **False** since we figured out that when you use the acrylic backdrop, the noise effect will be covered by system and it's not necessary to render the noise effect again. +This property decides whether the noise effect will be applied to the window. If you set this property to **False**, the noise effect will not be rendered. The noise effect is a subtle noise texture that makes the window look more natural and less flat. The default value is always **False** since we figured out that when you use the Acrylic backdrop, the noise effect will be covered by system and it's not necessary to render the noise effect again. You can set this property to **True** to enable an additional noise effect manually. @@ -180,4 +180,4 @@ This class is used to customize the [Window](%BASE_NAME%/components/dialogs/wind ### Source code -- [Github | WindowHelper.cs](https://github.com/iNKORE-NET/UI.WPF.Modern/blob/main/source/iNKORE.UI.WPF.Modern/Controls/Helpers/WindowHelper.cs) \ No newline at end of file +- [GitHub | WindowHelper.cs](https://github.com/iNKORE-NET/UI.WPF.Modern/blob/main/source/iNKORE.UI.WPF.Modern/Controls/Helpers/WindowHelper.cs) \ No newline at end of file diff --git a/data/docs/ui-wpf-modern/05. definitions/00. controls/00. helpers/# window-helper/index.zh-CN.mdx b/data/docs/ui-wpf-modern/05. definitions/00. controls/00. helpers/# window-helper/index.zh-CN.mdx new file mode 100644 index 0000000..53194bb --- /dev/null +++ b/data/docs/ui-wpf-modern/05. definitions/00. controls/00. helpers/# window-helper/index.zh-CN.mdx @@ -0,0 +1,165 @@ +--- +description: 提供窗口组件的附加属性和样式管理。 +--- + + +# WindowHelper 类 + +提供用于窗口组件的附加属性与样式管理。 + +## 定义 + +- 命名空间: [iNKORE.UI.WPF.Modern.Controls.Helpers](.) +- 程序集: iNKORE.UI.WPF.Modern.dll + +```csharp +public static class WindowHelper {...} +``` + +静态类,无继承关系。 + +## 依赖属性 + +### UseModernWindowStyle + +获取或设置是否对窗口应用现代窗口样式。现代窗口样式为窗口提供现代外观与交互体验。 + +仅当将此值设为 `true` 时,下列属性才会生效。 + +- 属性:附加属性 +- 类型:`bool` +- 默认值:`false` + +### SystemBackdropType + +获取或设置窗口材质类型。可从 [BackdropType 枚举](%BASE_NAME%/definitions/helpers/styles/backdrop-type) 中选择。 + +:::warning 系统兼容性 + +上文列出了 Acrylic 背景的可用性。Mica 与 Tabbed 背景仅在 Windows 11 可用;在较旧的 Windows 版本上,这些窗口材质将不会生效。 + +选项 **Acrylic** 会根据系统版本自动选择合适的 API:在 Windows 11 上使用 Acrylic11,在 Windows 10 上使用 Acrylic10,但这可能会引发一些不期望的行为。 + +::: + +- 属性:附加属性 +- 类型:[BackdropType](%BASE_NAME%/definitions/helpers/styles/backdrop-type) +- 默认值:`BackdropType.None` + +### Acrylic10Color + +获取或设置 Acrylic10 背景的颜色。仅在 **SystemBackdropType** 为 `Acrylic10` 或在 Windows 10 上以 `Acrylic` 运行时生效。你可以通过设置 **Color** 值来自定义 Acrylic10 背景颜色。 + +:::warning 使用 Color 值而非 Brush + +该属性仅接受 **Color** 值,若传入 **Brush** 值将抛出异常。如需从 **Brush** 转为 **Color**,可使用 **iNKORE.UI.WPF.Converters.ColorToBrushConverter** (需逆向转换) 。 + +::: + +- 属性:附加属性 +- 类型:`Color` +- 默认值:`Color.FromArgb(0x99, 0x00, 0x00, 0x00)` + +### ApplyBackground + +决定是否将 `Background` 属性应用于窗口。若将此属性设为 `False`,窗口将忽略 `Background` 并不渲染背景。通常我们会根据所用的窗口材质自动设置此属性,你也可手动控制,但该操作并不常见。 + +- 属性:附加属性 +- 类型:`bool` +- 默认值:`true` (当 **SystemBackdropType** 为 `None` 时为 `True`,否则为 `False`) + +### ApplyNoise + +决定是否为窗口启用噪点效果。噪点是一种细微的纹理效果,可让窗口看起来更自然、不那么平面。默认值为 `False`,因为在使用 Acrylic 背景时系统会覆盖噪点效果,故通常无需重复渲染。 + +你也可以手动将其设为 `True` 以启用额外噪点效果。 + +- 属性:附加属性 +- 类型:`bool` +- 默认值:`false` + +### CornerStyle + +通过此属性设置窗口的圆角样式。可从 [WindowCornerStyle 枚举](../../definitions/helpers/styles/window-corner-style) 中选择。 + +:::warning 系统兼容性 + +圆角样式仅在 Windows 11 可用;在较旧系统上该设置不会生效。 + +::: + +- 属性:附加属性 +- 类型:[WindowCornerStyle](../../helpers/styles/window-corner-style) +- 默认值:`WindowCornerStyle.None` + +### FixMaximizedWindow + +决定是否对窗口应用额外的最大化修复器 (maximize fixer) 。该修复器用于修正默认窗口样式导致的最大化尺寸错误问题。 + +该修复有时可能触发一些异常;通常这些异常是无害的,不会影响窗口的正常使用。 + +更多信息见 [Window / Maximize fixer](%BASE_NAME%/components/dialogs/window#maximize-fixer)。 + +- 属性:附加属性 +- 类型:`bool` +- 默认值:`true` + +### ShouldDisplayManualBorder + +决定是否显示手动绘制的边框。手动边框由窗口绘制,遵循窗口的 `BorderBrush` 与 `BorderThickness`,从而允许自定义窗口边框样式。 + +该属性为只读,由系统版本决定:在 Windows 11 及更高版本,DWM 会自动绘制边框;在 Windows 10 或更低版本,将显示手动边框。 + +- 属性:附加属性 | 只读 +- 类型:`bool` +- 默认值:`false` (在 Windows 10 或更低版本为 `True`,否则为 `False`) + +### ~~UseAeroBackdrop~~ + +已废弃,请使用 **SystemBackdropType**。 + +### ~~UseAcrylicBackdrop~~ + +已废弃,请使用 **SystemBackdropType**。 + +## 字段 + +### (依赖属性) + +上述依赖属性各自对应一个 `DependencyProperty` 字段。 + +## 方法 + +### (依赖属性) + +对可写的附加依赖属性,类提供对应的 `Get` 与 `Set` 方法;对只读附加依赖属性,仅提供 `Get` 方法。 + +### UpdateWindowChrome + +当需要更新 `WindowChrome` 时,该方法会被自动调用;你也可以手动调用以在异常情况发生后触发更新。 + +```csharp +public static WindowChrome UpdateWindowChrome(this Window window); +``` + +## 备注 + +### 组件 + +该类用于自定义 [Window](%BASE_NAME%/components/dialogs/window) 组件。 + +## 另请参阅 + +### 相关文章 + +- [组件 / Window](%BASE_NAME%/components/dialogs/window) + +### Microsoft Learn + +- [Window Class (WPF)](https://learn.microsoft.com/zh-cn/dotnet/api/system.windows.window?view=windowsdesktop-8.0#properties) + +- [Materials in Windows 11](https://learn.microsoft.com/zh-cn/windows/apps/design/signature-experiences/materials) + +### 源代码 + +- [GitHub | WindowHelper.cs](https://github.com/iNKORE-NET/UI.WPF.Modern/blob/main/source/iNKORE.UI.WPF.Modern/Controls/Helpers/WindowHelper.cs) \ No newline at end of file diff --git a/data/docs/ui-wpf-modern/05. definitions/00. controls/00. primitives/01.# titlebar-button-availability/index.en-US.mdx b/data/docs/ui-wpf-modern/05. definitions/00. controls/00. primitives/01.# titlebar-button-availability/index.en-US.mdx index d20a207..6038b4a 100644 --- a/data/docs/ui-wpf-modern/05. definitions/00. controls/00. primitives/01.# titlebar-button-availability/index.en-US.mdx +++ b/data/docs/ui-wpf-modern/05. definitions/00. controls/00. primitives/01.# titlebar-button-availability/index.en-US.mdx @@ -53,4 +53,4 @@ The button is enabled and visible. You can see and interact with the button. ### Source code -- [Github | TitleBar.cs](https://github.com/iNKORE-NET/UI.WPF.Modern/blob/main/source/iNKORE.UI.WPF.Modern/Controls/Primitives/TitleBar.cs) +- [GitHub | TitleBar.cs](https://github.com/iNKORE-NET/UI.WPF.Modern/blob/main/source/iNKORE.UI.WPF.Modern/Controls/Primitives/TitleBar.cs) diff --git a/data/docs/ui-wpf-modern/05. definitions/00. controls/00. primitives/01.# titlebar-button-glyph-style/index.en-US.mdx b/data/docs/ui-wpf-modern/05. definitions/00. controls/00. primitives/01.# titlebar-button-glyph-style/index.en-US.mdx index b4f01ec..c375e1c 100644 --- a/data/docs/ui-wpf-modern/05. definitions/00. controls/00. primitives/01.# titlebar-button-glyph-style/index.en-US.mdx +++ b/data/docs/ui-wpf-modern/05. definitions/00. controls/00. primitives/01.# titlebar-button-glyph-style/index.en-US.mdx @@ -49,4 +49,4 @@ This adapts the Fluent style from the Windows 11 Fluent Design System: ### Source code -- [Github | TitleBar.cs#coming_soon](https://github.com/iNKORE-NET/UI.WPF.Modern/blob/main/source/iNKORE.UI.WPF.Modern/Controls/Primitives/TitleBar.cs) \ No newline at end of file +- [GitHub | TitleBar.cs#coming_soon](https://github.com/iNKORE-NET/UI.WPF.Modern/blob/main/source/iNKORE.UI.WPF.Modern/Controls/Primitives/TitleBar.cs) \ No newline at end of file diff --git a/data/docs/ui-wpf-modern/05. definitions/00. controls/00. primitives/01.# titlebar/index.en-US.mdx b/data/docs/ui-wpf-modern/05. definitions/00. controls/00. primitives/01.# titlebar/index.en-US.mdx index 63b714f..2e63140 100644 --- a/data/docs/ui-wpf-modern/05. definitions/00. controls/00. primitives/01.# titlebar/index.en-US.mdx +++ b/data/docs/ui-wpf-modern/05. definitions/00. controls/00. primitives/01.# titlebar/index.en-US.mdx @@ -281,4 +281,4 @@ This class is used to customize the title bar of the [Window](%BASE_NAME%/compon ### Source code -- [Github | TitleBar.cs](https://github.com/iNKORE-NET/UI.WPF.Modern/blob/main/source/iNKORE.UI.WPF.Modern/Controls/Primitives/TitleBar.cs) +- [GitHub | TitleBar.cs](https://github.com/iNKORE-NET/UI.WPF.Modern/blob/main/source/iNKORE.UI.WPF.Modern/Controls/Primitives/TitleBar.cs) diff --git a/data/docs/ui-wpf-modern/05. definitions/00. controls/01.# toggle-switch/index.en-US.mdx b/data/docs/ui-wpf-modern/05. definitions/00. controls/01.# toggle-switch/index.en-US.mdx index d15c83f..85b147d 100644 --- a/data/docs/ui-wpf-modern/05. definitions/00. controls/01.# toggle-switch/index.en-US.mdx +++ b/data/docs/ui-wpf-modern/05. definitions/00. controls/01.# toggle-switch/index.en-US.mdx @@ -108,6 +108,6 @@ This class inherits methods from its base class **Control**. ### Source code -- [Github | ToggleSwitch.cs](https://github.com/iNKORE-NET/UI.WPF.Modern/blob/main/source/iNKORE.UI.WPF.Modern.Controls/Controls/Windows/ToggleSwitch/ToggleSwitch.cs) +- [GitHub | ToggleSwitch.cs](https://github.com/iNKORE-NET/UI.WPF.Modern/blob/main/source/iNKORE.UI.WPF.Modern.Controls/Controls/Windows/ToggleSwitch/ToggleSwitch.cs) diff --git a/data/docs/ui-wpf-modern/05. definitions/00. controls/01.# toggle-switch/index.zh-CN.mdx b/data/docs/ui-wpf-modern/05. definitions/00. controls/01.# toggle-switch/index.zh-CN.mdx new file mode 100644 index 0000000..8f1e635 --- /dev/null +++ b/data/docs/ui-wpf-modern/05. definitions/00. controls/01.# toggle-switch/index.zh-CN.mdx @@ -0,0 +1,113 @@ +# ToggleSwitch 类 + +表示一个可在两种状态之间切换的开关控件。 + +更多信息、设计指引与代码示例,请参阅 [Toggle switches](%BASE_NAME%/components/basic-input/toggle-switch)。 + +## 定义 + +- 命名空间: [iNKORE.UI.WPF.Modern.Controls](.) + +- 程序集: iNKORE.UI.WPF.Modern.dll + +- 继承: [Object](https://learn.microsoft.com/zh-cn/dotnet/api/system.object) → (...) → [Control](https://learn.microsoft.com/zh-cn/dotnet/api/system.windows.controls.control) → ToggleSwitch + +```csharp +[ContentProperty(nameof(Header))] +[TemplatePart(Name = nameof(HeaderContentPresenter), Type = typeof(ContentPresenter))] +[TemplatePart(Name = nameof(SwitchKnobBounds), Type = typeof(FrameworkElement))] +[TemplatePart(Name = nameof(SwitchKnob), Type = typeof(FrameworkElement))] +[TemplatePart(Name = nameof(KnobTranslateTransform), Type = typeof(TranslateTransform))] +[TemplatePart(Name = nameof(SwitchThumb), Type = typeof(Thumb))] +[TemplateVisualState(GroupName = VisualStates.GroupCommon, Name = VisualStates.StateNormal)] +[TemplateVisualState(GroupName = VisualStates.GroupCommon, Name = VisualStates.StateMouseOver)] +[TemplateVisualState(GroupName = VisualStates.GroupCommon, Name = VisualStates.StatePressed)] +[TemplateVisualState(GroupName = VisualStates.GroupCommon, Name = VisualStates.StateDisabled)] +[TemplateVisualState(GroupName = ContentStatesGroup, Name = OffContentState)] +[TemplateVisualState(GroupName = ContentStatesGroup, Name = OnContentState)] +[TemplateVisualState(GroupName = ToggleStatesGroup, Name = DraggingOnState)] +[TemplateVisualState(GroupName = ToggleStatesGroup, Name = DraggingOffState)] +[TemplateVisualState(GroupName = ToggleStatesGroup, Name = OffState)] +[TemplateVisualState(GroupName = ToggleStatesGroup, Name = OnState)] +public class ToggleSwitch : Control { ... } +``` + +## 构造函数 + +### ToggleSwitch() + +初始化 `ToggleSwitch` 的新实例。 + +## 属性 + +### IsOn + +获取或设置 `ToggleSwitch` 的开关状态 (开/关) 。 + +- 属性:依赖属性 + +- 类型:`bool` + +- 默认值:`false` + +### [On/Off]-[Content/ContentTemplate] + +默认情况下,`ToggleSwitch` 包含自动本地化的 On/Off 标签。你可以通过设置 `OnContent` 与 `OffContent` 来替换这些标签。 + +下面示例将 On/Off 标签替换为 Show/Hide: + +```xml + +``` + +下面示例移除了标签: + +```xml + +``` + +你也可以通过设置 `OnContentTemplate` 与 `OffContentTemplate` 来使用更复杂的内容。 + +### (继承) + +该类继承自基类 `Control` 的属性。 + +## 事件 + +### Toggled + +当 `IsOn` 属性值更改时触发该事件。 + +- 事件类型:Routed + +- 委托类型:`RoutedEventHandler` + +### (继承) + +该类继承自基类 `Control` 的事件。 + +## 方法 + +### (继承) + +该类继承自基类 `Control` 的方法。 + + +## 另请参阅 + +### 相关文章 + +- [组件 / ToggleSwitch](%BASE_NAME%/components/basic-input/toggle-switch) + +### Microsoft Learn + +- [Toggle switches - Windows apps](https://learn.microsoft.com/zh-cn/windows/apps/design/controls/toggles) + +- [ToggleSwitch class (WinRT)](https://learn.microsoft.com/zh-cn/windows/windows-app-sdk/api/winrt/microsoft.ui.xaml.controls.toggleswitch) + +### 源代码 + +- [GitHub | ToggleSwitch.cs](https://github.com/iNKORE-NET/UI.WPF.Modern/blob/main/source/iNKORE.UI.WPF.Modern.Controls/Controls/Windows/ToggleSwitch/ToggleSwitch.cs) + + diff --git a/data/docs/ui-wpf-modern/05. definitions/00. helpers/00. styles/# backdrop-type/index.en-US.mdx b/data/docs/ui-wpf-modern/05. definitions/00. helpers/00. styles/# backdrop-type/index.en-US.mdx index ce60672..c156dc3 100644 --- a/data/docs/ui-wpf-modern/05. definitions/00. helpers/00. styles/# backdrop-type/index.en-US.mdx +++ b/data/docs/ui-wpf-modern/05. definitions/00. helpers/00. styles/# backdrop-type/index.en-US.mdx @@ -27,7 +27,7 @@ None of the system backdrops will be applied. The window will remain solid. ### Mica -The window will have a mica effect, which is a translucent background that blurs the desktop background it. +The window will have a Mica effect, which is a translucent background that blurs the desktop background behind it. **Value**: 2 @@ -39,11 +39,11 @@ Mica is mode aware; it supports both light and dark modes. Mica also indicates w ### Acrylic -The window will have an acrylic effect and determine which API will be used depending on the system version, which is a translucent background that blurs the content behind it. +The window will have an Acrylic effect and determine which API will be used depending on the system version, which is a translucent background that blurs the content behind it. **Value**: 3 -Acrylic is a semi-transparent material that replicates the effect of frosted glass. In Windows 11, acrylic has been updated to be brighter and more translucent, allowing for a stronger contextual relationship with the visuals behind it. Acrylic is used only for transient, light-dismiss surfaces such as flyouts and context menus. +Acrylic is a semi-transparent material that replicates the effect of frosted glass. In Windows 11, Acrylic has been updated to be brighter and more translucent, allowing for a stronger contextual relationship with the visuals behind it. Acrylic is used only for transient, light-dismiss surfaces such as flyouts and context menus. Acrylic is mode aware; it supports both light and dark mode. @@ -51,11 +51,11 @@ Acrylic is mode aware; it supports both light and dark mode. ### Tabbed -The window will have a tabbed effect, which looks like mica but have deeper colors. This is often used when there's a root TabControl on the window (e.g. the Windows Explorer). +The window will have a Tabbed effect, which looks like Mica but has deeper colors. This is often used when there's a root TabControl on the window (e.g. the Windows Explorer). **Value**: 4 -Mica Alt (aka. Tabbed) is a variant of Mica, with stronger tinting of the user's desktop background color. You can apply Mica Alt to your app's backdrop to provide a deeper visual hierarchy than Mica, especially when creating an app with a tabbed title bar. Mica Alt is available for apps that use Windows App SDK 1.1 or later, while running on Windows 11 version 22000 or later. +Mica Alt (aka. Tabbed) is a variant of Mica, with stronger tinting of the user's desktop background color. You can apply Mica Alt to your app's backdrop to provide a deeper visual hierarchy than Mica, especially when creating an app with a Tabbed title bar. Mica Alt is available for apps that use Windows App SDK 1.1 or later, while running on Windows 11 version 22000 or later. ![](mica-alt-tabs.png) @@ -131,4 +131,4 @@ If your idea is not working on other Win32 applications, it won't work on our li ### Source code -- [Github | BackdropHelper.cs](https://github.com/iNKORE-NET/UI.WPF.Modern/blob/main/source/iNKORE.UI.WPF.Modern/Helpers/Styles/BackdropHelper.cs#L18) +- [GitHub | BackdropHelper.cs](https://github.com/iNKORE-NET/UI.WPF.Modern/blob/main/source/iNKORE.UI.WPF.Modern/Helpers/Styles/BackdropHelper.cs#L18) diff --git a/data/docs/ui-wpf-modern/05. definitions/00. helpers/00. styles/# backdrop-type/index.zh-CN.mdx b/data/docs/ui-wpf-modern/05. definitions/00. helpers/00. styles/# backdrop-type/index.zh-CN.mdx new file mode 100644 index 0000000..a80ff1b --- /dev/null +++ b/data/docs/ui-wpf-modern/05. definitions/00. helpers/00. styles/# backdrop-type/index.zh-CN.mdx @@ -0,0 +1,134 @@ +--- +description: 指定窗口材质类型。由 `WindowHelper.SystemBackdropType` 属性使用。 +--- + +# BackdropType 枚举 + +指定窗口材质类型。由 `WindowHelper.SystemBackdropType` 属性使用。 + +## 定义 + +- 命名空间: [iNKORE.UI.WPF.Modern.Helpers.Styles](.) +- 程序集: iNKORE.UI.WPF.Modern.dll + +```csharp +public enum BackdropType {...} +``` + +继承: [Object](https://learn.microsoft.com/zh-cn/dotnet/api/system.object) → [ValueType](https://learn.microsoft.com/zh-cn/dotnet/api/system.valuetype?view=windowsdesktop-8.0) → [Enum](https://learn.microsoft.com/zh-cn/dotnet/api/system.enum?view=windowsdesktop-8.0) → BackdropType + +## 枚举值 + +### None + +不应用任何窗口材质,窗口保持实色。 + +**值**:1 + +### Mica + +窗口将使用 Mica 效果,表现为对桌面背景进行模糊与半透明处理的材质。 + +**值**:2 + +Mica 是 Windows 11 引入的一种新型不透明材质,表面会根据用户桌面背景色做细微着色。 + +Mica 支持浅色/深色模式,并内置了针对窗口聚焦 (活动/非活动) 的状态差异。 + +![](materials_mica_hero_1880.jpg) + +### Acrylic + +窗口将使用 Acrylic 效果,所用的具体 API 由系统版本决定,表现为模糊背景之上的半透明材质。 + +**值**:3 + +Acrylic 是一种半透明材质,模拟磨砂玻璃效果。在 Windows 11 中,Acrylic 更明亮、更透明,以便与背后的视觉内容建立更强的语境关系。Acrylic 通常用于临时、轻度消失的表面,例如弹出菜单与上下文菜单。 + +Acrylic 支持浅色/深色模式。 + +![](materials_acrylic_hero_1880.jpg) + +### Tabbed + +窗口将使用类似 Mica 的 Tabbed (Mica Alt) 效果,但色彩更深,通常用于窗口具有根 `TabControl` 的场景 (例如资源管理器) 。 + +**值**:4 + +Mica Alt (又称 Tabbed) 是 Mica 的一个变体,对用户桌面背景色做更强的着色。针对带有选项卡的标题栏应用 Mica Alt,可以提供比 Mica 更深的视觉层级。Mica Alt 在使用 Windows App SDK 1.1 及更高版本且运行于 Windows 11 版本 22000 或更高时可用。 + +![](mica-alt-tabs.png) + +### Acrylic10 + +使用较旧 API 实现的 Acrylic 效果。 + +**值**:5 + +### Acrylic11 + +使用较新 API 实现的 Acrylic 效果。 + +**值**:6 + +## 备注 + +### Acrylic10 与 Acrylic11 + +尽管 Acrylic10 与 Acrylic11 在视觉效果上相似,但它们使用不同的 API,存在一些差异: + +| | Acrylic10 | Acrylic11 | +|-------------------|----------------------------------------------------------------------|-------------------------------------------------------------------------------------| +| 可用性 | Windows 10 与 11 (Windows 10.0.17063+) | Windows 11 (Windows 10.0.22523+) | +| 性能 | 调整窗口大小时可能有卡顿 | 调整窗口大小时表现良好 | +| 可定制性 | 可定制色调 (使用 ui:WindowHelper.Acrylic10Color 属性) | 不支持 | +| 过渡 | 无 | 在切换浅/深色及聚焦/失焦时会显示过渡动画 | +| 失去焦点时 | Acrylic 效果仍然保留 | Acrylic 效果会被临时禁用 | + +如上所示,两个 Acrylic 效果各有优缺点,可根据需求选择。 + +### Mica 与 Tabbed + +Mica 与 Tabbed 在外观上相似,但用途不同:Mica 适用于一般窗口,Tabbed 适用于带根 `TabControl` 的窗口。 + +下面图片展示了带选项卡的标题栏中 Mica 与 Mica Alt (Tabbed) 的差异。 + +![](mica-tabs.png) + +![](mica-alt-tabs.png) + +### 系统级特性 + +窗口材质由系统提供并由系统管理,这意味着我们并不自行实现背景效果或对其有完全控制权。我们所能做的是请求系统对窗口应用相应的背景效果。 + +:::danger 注意 + +请不要要求我们做超出我们控制范围的操作。例如:提升 Acrylic10 的性能、强制对某个控件应用材质、或更改 Acrylic11 的颜色。我们无法实现这些功能。如遇窗口材质问题,请向 Microsoft 报告。 + +如果你的想法在其他 Win32 应用中不可行,在我们的库中也不会可行。我们使用的是其他 Win32 应用同样的 API。在提出请求前,请先确认该行为在其他 Win32 应用中是否可行。 + +::: + +## 另请参阅 + +### 相关文章 + +- [组件 / Window](%BASE_NAME%/components/dialogs/window#system-backdrops) + +- [定义 / WindowHelper Class](%BASE_NAME%/definitions/controls/helpers/window-helper#systembackdroptype) + +- [定义 / Acrylic10Helper Class](%BASE_NAME%/definitions/controls/helpers/acrylic10-helper) + +- [定义 / BackdropHelper Class](%BASE_NAME%/definitions/controls/helpers/backdrop-helper) + +### Microsoft Learn + +- [Mica material - Windows Apps](https://learn.microsoft.com/zh-cn/windows/apps/design/style/mica) + +- [Acrylic material - Windows Apps](https://learn.microsoft.com/zh-cn/windows/apps/design/style/acrylic) + +- [Materials in Windows 11](https://learn.microsoft.com/zh-cn/windows/apps/design/signature-experiences/materials) + +### 源代码 + +- [GitHub | BackdropHelper.cs](https://github.com/iNKORE-NET/UI.WPF.Modern/blob/main/source/iNKORE.UI.WPF.Modern/Helpers/Styles/BackdropHelper.cs#L18) diff --git a/data/docs/ui-wpf-modern/05. definitions/00. helpers/00. styles/# window-corner-style/index.en-US.mdx b/data/docs/ui-wpf-modern/05. definitions/00. helpers/00. styles/# window-corner-style/index.en-US.mdx index 1e5bd2d..1724c4a 100644 --- a/data/docs/ui-wpf-modern/05. definitions/00. helpers/00. styles/# window-corner-style/index.en-US.mdx +++ b/data/docs/ui-wpf-modern/05. definitions/00. helpers/00. styles/# window-corner-style/index.en-US.mdx @@ -74,8 +74,8 @@ On version 10.0.22000.100, anti-aliasing is not applied to the rounded corners a ### Microsoft Learn -- [Apply rounded corners in desktop apps for Windows 11](https://docs.microsoft.com/en-us/windows/apps/desktop/modernize/apply-rounded-corners) +- [Apply rounded corners in desktop apps for Windows 11](https://learn.microsoft.com/en-us/windows/apps/desktop/modernize/ui/apply-rounded-corners) ### Source code -- [Github | CornerHelper.cs#L309](https://github.com/iNKORE-NET/UI.WPF.Modern/blob/main/source/iNKORE.UI.WPF.Modern/Helpers/Styles/CornerHelper.cs#L309) +- [GitHub | CornerHelper.cs#L309](https://github.com/iNKORE-NET/UI.WPF.Modern/blob/main/source/iNKORE.UI.WPF.Modern/Helpers/Styles/CornerHelper.cs#L309) diff --git a/data/docs/ui-wpf-modern/05. definitions/00. helpers/00. styles/# window-corner-style/index.zh-CN.mdx b/data/docs/ui-wpf-modern/05. definitions/00. helpers/00. styles/# window-corner-style/index.zh-CN.mdx new file mode 100644 index 0000000..af23359 --- /dev/null +++ b/data/docs/ui-wpf-modern/05. definitions/00. helpers/00. styles/# window-corner-style/index.zh-CN.mdx @@ -0,0 +1,81 @@ +--- +description: 指定窗口的圆角样式。由 `WindowHelper.CornerStyle` 属性使用。 +--- + +# WindowCornerStyle 枚举 + +指定窗口的圆角样式。由 `WindowHelper.CornerStyle` 属性使用。 + +## 定义 + +- 命名空间: [iNKORE.UI.WPF.Modern.Helpers.Styles](.) + +- 程序集: iNKORE.UI.WPF.Modern.dll + +```csharp +public enum WindowCornerStyle : uint {...} +``` + +继承: [Object](https://learn.microsoft.com/zh-cn/dotnet/api/system.object) → [ValueType](https://learn.microsoft.com/zh-cn/dotnet/api/system.valuetype?view=windowsdesktop-8.0) → [Enum](https://learn.microsoft.com/zh-cn/dotnet/api/system.enum?view=windowsdesktop-8.0) → WindowCornerStyle + +## 枚举值 + +### Default + +让系统决定是否应用窗口圆角。 + +*等价于 DWMWCP_DEFAULT* + +**值**:0 + +### DoNotRound + +从不应用窗口圆角。 + +*等价于 DWMWCP_DONOTROUND* + +**值**:1 + +### Round + +在适当情况下应用窗口圆角。 + +*等价于 DWMWCP_ROUND* + +**值**:2 + +### RoundSmall + +在适当情况下应用小一些的窗口圆角。 + +*等价于 DWMWCP_ROUNDSMALL* + +**值**:3 + +## 备注 + +要使用 Windows 11 引入的圆角特性,请查看该功能的官方说明。 + + (本文档日期为 2020/10/02,但实际提交于 2021/07/17。) + +关键常量的底层值 (例如 DWMWA_WINDOW_CORNER_PREFERENCE 及 DWM_WINDOW_CORNER_PREFERENCE 枚举) 可在包含于 Windows Insider Preview SDK 的 dwmapi.h 中找到。 + +当窗口应用圆角时,系统会自动添加一条灰色轮廓。 + +在版本 10.0.22000.100 中,圆角未应用抗锯齿处理,边缘会显得较为锯齿 (标准标题栏除外) 。 + +## 另请参阅 + +### 相关文章 + +- [组件 / Window](%BASE_NAME%/components/dialogs/window) + +- [定义 / WindowHelper Class](%BASE_NAME%/definitions/controls/helpers/window-helper#cornerstyle) + +### Microsoft Learn + +- [Apply rounded corners in desktop apps for Windows 11](https://learn.microsoft.com/zh-cn/windows/apps/desktop/modernize/ui/apply-rounded-corners) + +### 源代码 + +- [GitHub | CornerHelper.cs#L309](https://github.com/iNKORE-NET/UI.WPF.Modern/blob/main/source/iNKORE.UI.WPF.Modern/Helpers/Styles/CornerHelper.cs#L309)