Où se trouve mon assembly Microsoft.Windows.Themes?

J'ai écrit un contrôle utilisateur dans le code XAML et après il sera compilé en C# C# résultant a cette ligne:

using Microsoft.Windows.Themes;

Qui déclenche une erreur maintenant:

Le type ou le nom d'espace de noms 'Thèmes' n'existe pas dans l'espace de noms
"Microsoft.De Windows (vous manque une référence d'assembly?)

J'ai trouvé depuis que je ne l'affecte pas la sortie de compilé en C# (il n'y a rien à retirer de XAML), je voudrais simplement ajouter que comme Référence.

Cependant, le dialogue Ajouter une Référence ne contient pas de Microsoft.Windows.Themes. N'est-ce pas une partie de .NET?

Voici un exemple de code XAML de contrôle de l'utilisateur qui sont les causes de ce problème:

<UserControl x:Class="GG.UserControls.MainMenu"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">

    <StackPanel>
        <Menu VerticalAlignment="Top" Background="{x:Null}">
            ... //Just static menu items.
        </Menu>
    </StackPanel>

</UserControl>

Et C# code derrière elle:

using System;
using System.Windows.Controls;

namespace GG.UserControls
{
    ///<summary>
    ///Interaction logic for MainMenu.xaml
    ///</summary>
    public partial class MainMenu : UserControl
    {
        public MainMenu()
        {
            InitializeComponent();
        }
    }
}

Voici un exemple de compilé en C#:

#pragma checksum "..\..\..\..\UserControls\MainMenu.xaml" "{406ea660-64cf-4c82-b6f0-42d48172a799}" "5A85C5B16565514165AD23641F944BC6"
//------------------------------------------------------------------------------
//<auto-generated>
//    This code was generated by a tool.
//    Runtime Version:4.0.30319.17020
//
//    Changes to this file may cause incorrect behavior and will be lost if
//    the code is regenerated.
//</auto-generated>
//------------------------------------------------------------------------------
using GG;
using GG.UserControls;
using Microsoft.Windows.Shell;
using Microsoft.Windows.Themes; //<---- WTF?
using System;
using System.Diagnostics;
using System.Windows;
using System.Windows.Automation;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Markup;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Media.Effects;
using System.Windows.Media.Imaging;
using System.Windows.Media.Media3D;
using System.Windows.Media.TextFormatting;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Shell;
namespace GG.UserControls {
///<summary>
///ChangesetHistory
///</summary>
public partial class MainMenu : System.Windows.Controls.UserControl, System.Windows.Markup.IComponentConnector {
private bool _contentLoaded;
///<summary>
///InitializeComponent
///</summary>
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "4.0.0.0")]
public void InitializeComponent() {
if (_contentLoaded) {
return;
}
_contentLoaded = true;
System.Uri resourceLocater = new System.Uri("/GG;component/usercontrols/mainmenu.xaml", System.UriKind.Relative);
#line 1 "..\..\..\..\UserControls\MainMenu.xaml"
System.Windows.Application.LoadComponent(this, resourceLocater);
#line default
#line hidden
}
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "4.0.0.0")]
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Design", "CA1033:InterfaceMethodsShouldBeCallableByChildTypes")]
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity")]
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1800:DoNotCastUnnecessarily")]
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) {
this._contentLoaded = true;
}
}
}

source d'informationauteur Tower