2017-04-15 7 views
0

プロトタイププロジェクトでControlTemplateを編集した後、カスタムControlTemplateをメインプロジェクトに移動することにしました。予想通りこれは、箱から出して動作しませんでした、Visual Studioは、次のエラーを私に通知:SystemColorが見つからないInactiveSelectionHighlightTextBrushKey

Error Cannot find the static member 'InactiveSelectionHighlightBrushKey' on the type 'SystemColors'.

を、それは間違っていたものをクリアしていなかったので、何のハイライトと警告が、XAMLソースにありませんでした。

enter image description here

私は私のプロトタイププロジェクトのオブジェクトブラウザでメンバーを見つけた:「InactiveSelectionHighlightBrushKey」の定義に行く、私はSystemColorsメンバーリストのエントリを見ていません。私のメインプロジェクトでSystemColorsクラスがどのように不完全なのでしょうか?

+1

対象とするフレームワークのバージョンはどれですか? MSDNにはAcceleratingが4.5で追加されました:https://msdn.microsoft.com/library/system.windows.systemcolors.inactiveselectionhighlightbrushkey(v=vs.110).aspx –

+0

@FlatEric .NET Framework 4.5.2 – oddRaven

答えて

0

this commentに基づいて、私はフレームワークバージョンの違いを探し始めました。

何らかの理由で、プロジェクトがTargetFrameworkがプロパティで「.NET Framework 4.5.2」に設定されていても、PresentationFramework.dllおよびWindowsBase.dllの参照パスは/v4.0パスを指していました。プロパティーでターゲットを4.0から4.5.2に変更しても効果はありませんでした。手動でリファレンスを削除して追加する必要がありました。 .csproj上

git diff次の変更を示しています。WindowsBase.dllのための同じ

- <Reference Include="PresentationFramework"> 
-  <HintPath>..\..\..\..\..\..\..\..\..\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\PresentationFramework.dll</HintPath> 
- </Reference> 
+ <Reference Include="PresentationFramework" /> 

を。 The explicit definition of HintPath probably caused the DLL references not to change from path version

関連する問題