简体   繁体   中英

WPF Mahapps Controls in different Project

I m testing MahApps.Metro, and I have a WPF (Windows Application type project). Now I created some views in a different project (WpfControlLibrary) to store User Controls tto be used by the WPF main project.

How can I use the MahApps.Metro style in this new WpfControlLibrary?

Is it possible to share App.xaml and other Resources (like the Icons package) existing in the WPF main project in this WpfControlLibrary?

Do I need to install the MahApps.Metro and MAhApps.Metro.Resources in each new WpfControlLibrary?

In the Main WPF project I declared the "Controls:MetroWindow" under the xmlns:Controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro", for the WpfControlLibrary how the

Thank you

Is it possible to share App.xaml and other Resources (like the Icons package) existing in the WPF main project in this WpfControlLibrary?

No , it is not.

Do I need to install the MahApps.Metro and MahApps.Metro.Resources in each new WpfControlLibrary?

Yes , you have. But that is not as bad as it seems, trust me:

Visual Studio gives you the option to manage the NuGet packages to your entire solution. Here's how it can be done:

  • Right click in your solution, and select Manage NuGet Packages for Solution

步

  • This page will open:

步

Here you can easily see which NuGet packages are installed on all your projects (in this solution), the available updates and even browse to install more packages.

As you can see, I selected MahApps.Metro package, and it shows me that the version 1.4.1 is installed on Helpers\\SystemSpecs.Helpers and View\\SystemSpecs.View (top-right corner of the image).

To install it on another project, all I have to do is select the CheckBox for the project and click Install . The same process applies to uninstalling it (except that you'll click Uninstall hehe).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM