3

This may well be a stupid question, but I cannot find an answer...

I am just getting started with WPF, and am trying to add a ResourceDictionary to my project.

this one here:

https://monotone.codeplex.com/

So I downloaded the zip file, and unzipped it to:

MyProjectDir/MonoTone

I have added the following to my App.xaml

 <Application x:Class="TestWPF.App"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:local="clr-namespace:TestWPF"
             xmlns:xcad="http://schemas.xceed.com/wpf/xaml/avalondock"
             StartupUri="MainWindow.xaml">

    <Application.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>

                <ResourceDictionary Source="Monotone/Monotone.Colors.xaml" />
                <ResourceDictionary Source="Monotone/Monotone.Brushes.xaml" />
                <ResourceDictionary Source="Monotone/Monotone.MahApps.xaml" />
                <ResourceDictionary Source="Monotone/Monotone.xaml" />
                <ResourceDictionary Source="Monotone/Monotone.ExtendedWPFToolkit.xaml" />
                <ResourceDictionary Source="Monotone/Monotone.ColorBox.xaml" />

            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>

    </Application.Resources>

</Application>

as here:

https://monotone.codeplex.com/wikipage?title=Installing%20Monotone&referringTitle=Documentation

Now Intelsense is underlining the xaml paths, and cannot find the files.

I have added a reference to the dll. What am i missing?

Thank you.

anti
  • 3,011
  • 7
  • 36
  • 86

3 Answers3

2

First, try including the Monotone catalog in the solution by clicking on show all files icon in solution explorer.

Second, as shown in below screen, pinpoint the exact path as in the first line of example. Example

Janis S.
  • 2,526
  • 22
  • 32
  • 1
    Thank you! I have done this, and see the files in the sln. Intelsense has stopped complaining, but I get a lot of errors on build: – anti Sep 07 '17 at 19:34
  • Severity Code Description Project File Line Suppression State Error The type 'nc:Spinner' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built. TestWPF D:\TestWPF\TestWPF\Monotone\Monotone.ColorBox.xaml 101 – anti Sep 07 '17 at 19:35
  • 1
    Saw your comment and would not be able to respond better than @Joshua Miller. That's also the acceptable answer, totally agree. – Janis S. Sep 07 '17 at 20:43
1

To explicitly answer your question: Visual Studio was complaining because you needed to add the Monotone files (from the release zip) to your project under a folder called "Monotone". Janis S's answer already stated this.

Unfortunately, the Monotone project contains a few dependencies on other projects... Specifically, you'll notice that it references the ColorBox control, which can be found on CodePlex, and it also depends on some Xceed assemblies. Your project will not build without those.

A few examples of the references to external dependencies are:

xmlns:xtk="http://schemas.xceed.com/wpf/xaml/toolkit"
xmlns:nc="http://schemas.ncore.com/wpf/xaml/colorbox"
xmlns:conv="clr-namespace:Xceed.Wpf.Toolkit.Converters;assembly=Xceed.Wpf.Toolkit"
xmlns:Behaviours="clr-namespace:MahApps.Metro.Behaviours"
xmlns:mm="http://metro.mahapps.com/winfx/xaml/controls"
xmlns:mmm="http://metro.mahapps.com/winfx/xaml/shared"

At this point you have three options

  1. remove all references to the external assemblies.
  2. OR figure out which assemblies are needed and add references to those as well.
  3. OR find a different dark theme to use.

Option 3 is probably the best one at this point as CodePlex is shutting down soon and Monotone does not appear to be maintained. A quick Google search results in a few free WPF Dark Themes that are still functioning that could be used instead.

Edit

If you really want to use Monotone, go to their downloads page and grab the sample application. All of the missing DLLs are included in that download (you will need to include those in your project and add them as references).

Community
  • 1
  • 1
JoshuaTheMiller
  • 2,582
  • 25
  • 27
  • 1
    @Joshua Miller, you cracked it, good that you have also found the way of using Monotone if it is absolutely no other choice, however, vote-up because of the 3rd option. – Janis S. Sep 07 '17 at 20:48
0

I might be very late to the party, but to clarify things:

  • I am the creator of Monotone (which was a theme I used for an IDE I developed which is now obsolete). I don't mind if you pick another/better dark theme for your application, it's pretty old at this point.

  • Monotone is now 'maintained' on GitHub. Well, it's more or less stale at this point since I'm not into C# anymore. But if you (or anyone else) have a specific problem with it, feel free to submit an issue on GitHub or a pull request that solves it.

  • You only need to add the XAML-files for Monotone.Colors.xaml, Monotone.Brushes.xaml and Monotone.xaml to the ResourceDictionary.MergedDictionaries for the default WPF controls. Include in this order. If I remember correctly the files have to be set to EmbeddedResource. That's it.

  • Monotone.ExtendedWPFToolkit.xaml is only needed if you use (and want to theme) the ExtendedWPFToolkit controls. Sames goes for Monotone.MahApps.xaml and Monotone.ColorBox.xaml. So, these are optional. It's kept in separate files to avoid dependencies to libaries you might not use

  • You don't need the DLLs for styling the standard WPF controls

  • Because of the shutdown of CodePlex the Wiki-Pages are gone. I might dig into the code and recreate it on GitHub (or even better add it to the repo itself), that you have a helpful documentation.

  • As pointed out, the SampleApplication contains a working example which you can use as a template and/or to understand how it works

0xDEADBEEF
  • 3,401
  • 8
  • 37
  • 66