C#里使用MaterialDesign时在VS2022里出错
由于在新版本的WPF里,已经没有下面的命名空间:
<!-- 旧版 Blend SDK 的声明 -->
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
<!-- 新版 Microsoft.Xaml.Behaviors 的声明 -->
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
需要修改为最后这个才不会出错。
因此需要把前面的MaterialDesignWindow.xaml文件进行修改如下:
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
xmlns:md="http://materialdesigninxaml.net/winfx/xaml/themes"