1
리소스 사전을 만들었고 리소스 사전에 스타일을 액세스 할 수 있지만 가능한 경우 어떻게 전체 컨트롤을 참조 할 수 있습니까? 리소스 주문의 WPF 참조 컨트롤
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Style x:Key="MainWindowStyle" TargetType="Window">
<Setter Property="Background" Value="Transparent"></Setter>
<!--Can access this-->
</Style>
<Window x:Key="CustomWindow" Background="Transparent">
<!--Want to access this-->
</Window>
</ResourceDictionary>
가 여기에 메인 윈도우의 XAML 파일입니다 :
<Window x:Class="MyNamespace.MyWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="640" Width="960" >
<!--setting Style={StaticResource MainWindowStyle} adds the style but I want this window to be replaced by the one in the resourcedictionary-->
<Grid>
</Grid>
</Window>
그래서 나는 기본적으로 리소스 사전에서 만든 하나 XAML 파일에서 창을 대체 할
는 여기에있는 ResourceDictionary입니다.
정확히 내가 감사하고 싶었던 것! – Anomaly
아, 다행스럽게도, 다른 컨트롤을 중첩 시키려고하면 '창'이 넘어 지지만 필요한 것이 'UserControl'에 들어갈 수 있다면 일이 효과적입니다. 약간의 문제로, 이것은 프로젝트의 다른 곳에서'Control'을 사용하는 가장 간단한 방법은 아닙니다. 일반적으로 새 네임 스페이스를 추가하고 XAML 내에서 직접 'Control'을 참조하십시오 (예 : http://msdn.microsoft.com/en-gb/library/bb514546%28v=vs.90%29). aspx 나는 당신이 원했던 것과 가장 가까운 것처럼 보이는이 방법을 제안했다. 행운 = D – Chris