Bài viết

Kho tài liệu và bài viết được chia sẻ, đánh giá bởi cộng đồng

Add Material Design vào ứng dụng WPF

Vo Tan Duc đã tạo 09:38 25-05-2023 2.251 lượt xem 0 bình luận

Nội dung bài viết

Cài đặt

Vào Tools -> Nuget Package Manager -> Package Manager Console -> gõ dòng lệnh

Install-Package MaterialDesignThemes

Sử dụng

Vào App.xaml, gõ đoạn code sau

<ResourceDictionary>
      <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Light.xaml" />
        <ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Defaults.xaml" />
        <ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Primary/MaterialDesignColor.DeepPurple.xaml" />
        <ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Accent/MaterialDesignColor.Lime.xaml" />
      </ResourceDictionary.MergedDictionaries>
</ResourceDictionary>

Trở lại với MainWindow.xaml, add dòng lệnh này vào

xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"

 

Nội dung bài viết

Bình luận

Để bình luận, bạn cần đăng nhập bằng tài khoản Howkteam.

Đăng nhập

Câu hỏi mới nhất