2012-03-11 3 views
12

나는 XAML에서 사용자 제어를 쓴이 C 번호로 컴파일됩니다 후 결과 C#을이 라인이 있습니다내 Microsoft.Windows.Themes 어셈블리는 어디에 있습니까?

using Microsoft.Windows.Themes; 

이제 오류가 발생합니다 :

형식 또는 네임 스페이스 이름 '테마' 'Microsoft.Windows'(당신이 어셈블리 참조가 누락?) 네임 스페이스에 존재하지 않는 내가 컴파일 된 C#의 출력에 영향을 미칠 수 없기 때문에 내가 생각

(remov 아무것도 없다 전자 XAML에서), 난 그냥 참조로 추가 할 것입니다.

그러나 참조 추가 대화 상자에는 Microsoft.Windows.Themes이 포함되어 있지 않습니다. 이것이 .NET의 일부가 아닌가? 그 뒤에

<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> 

그리고 C# 코드 : 여기

using System; 
using System.Windows.Controls; 

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

은 컴파일 된 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; 
     } 
    } 
} 
+0

내가 반사경을 사용하여 PresentationFramework.dll에서 찾고 있어요, 나는 그들이 물리적으로 어디에 위치해 있는지 테마 .dll을 찾지 못하는 것일까 요? –

답변

29

Microsoft.Windows.Themes 여기

이 문제가 발생하는 예 XAML 사용자 컨트롤의 테마별 PresentationFramework 어셈블리에 있습니다.

  • PresentationFramework.Aero.dll
  • PresentationFramework.AeroLite.dll
  • PresentationFramework.Classic.dll을 : 당신은 사람이 당신의 XAML에서 참조에 따라 다음 중 하나에 대한 참조를 추가 할 수 있습니다
  • PresentationFramework.Luna.dll
  • PresentationFramework.Royale.dll
+0

"XAML에서 참조 된 항목"? 나는 그런 것들에 대한 언급이 없다. 어느 것을 골라야합니까? 내 질문에 내 XAML을 잠시 게시 해 보겠습니다. – Tower

+0

흠, 신선한 WPF 프로젝트의 신선한 사용자 정의 컨트롤에 코드를 놓았습니다. 그리고 그 코드를 사용하지 않습니다. 코드에서 정확히 using 문이 나타 납니까? – BoltClock

+0

컴파일 된 XAML -> C# 코드를 첨부했습니다. '사용 중 '을 보여줍니다. 나는 깨끗한 솔루션을 시도한 다음 차이없이 솔루션을 다시 빌드합니다. – Tower

관련 문제