ModernUI Tutorial: create a custom topic, modernui custom

Source: Internet
Author: User

ModernUI Tutorial: create a custom topic, modernui custom

Modern ui wpf includes two built-in themes (dark and light ). In version 1.0.3, you can build custom themes. Modern UI applications are usually defined in the global resource dictionary App. xaml as follows:

The "/FirstFloor. ModernUI; component/Assets/ModernUI. xaml" dictionary contains the Modern UI style of the core WPF controls (such as Button buttons, TextBlock, and ListBox boxes. The second dictionary contains the definition of the paint brush and other resources. If you want to use a custom topic, you need to replace the second dictionary with your own version.

Create a new topic:

The following steps describe how to create a new topic.
1) Make sure that you have installed the latest Modern UI for WPF template extension for Visual Studio 2012.
2) create a new or open an existing Modern UI Project
3) add an Assets file to your project
4) add a new item to the Assets folder. In the Add new project dialog box, navigate to Visual c # project> Modern UI for WPF and select the Modern UI topic. Rename the file to ModernUI. MyTheme and select Add dd.
5) open App. xaml and replace the current topic with a new topic;

6) Compile and run the project. Your application will display a new theme like this;

Custom topic:

A custom topic is generally a theme derived from a dark or light. A topic derived from a built-in topic automatically contains all required resources. So what you need to do is to overwrite these resources, or you can choose not to overwrite the built-in theme resources, but you need to provide new theme resources.

It is easy to derive a built-in topic. Refer to the dark or light topic to add a MergedDictionary reference;

By adding the following brush resource to your custom topic, all buttons will become red backgrounds:

By adding the following brush resource to your custom topic, all buttons will become red backgrounds:

See a complete overview of all resources required by a topic in topic resource reference.

 

Portal: ModernUI Tutorial: Directory

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.