아래의 XAML은 다양 유일한 것은 그것이 호스팅하는 UserControl을하다 내가 여러 프리젠 테이션에서 사용하고 창입니다 :WPF 창을 다시 사용하려고
<Window x:Class="Smack.ConstructionAdmin.Presentation.Wpf.Views.Admin.Employees.EmployeeShellView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:Smack.ConstructionAdmin.Presentation.Wpf.Views.Admin.Employees"
xmlns:s="clr-namespace:Smack.ConstructionAdmin.Presentation.Wpf"
xmlns:cmdRef="clr-namespace:Smack.Core.Presentation.Wpf.ViewModels.Commands.Reference;assembly=Smack.Core.Presentation.Wpf"
Background="{DynamicResource WaveWindowBackground}"
Title="{Binding Source={x:Static s:Strings.AppName}}"
Icon="pack://application:,,,/Smack.ConstructionAdmin.Presentation.Wpf;component/Images/Time-Machine_16.png"
FontFamily="Arial"
WindowStartupLocation="CenterScreen" Width="750" Height="600"
>
<DockPanel>
<local:EmployeeShellUserControl DataContext="{Binding}" />
</DockPanel>
<Window.InputBindings>
<cmdRef:KeyBindingEx CommandReference="{Binding AddCommand}"/>
<cmdRef:KeyBindingEx CommandReference="{Binding EditCommand}"/>
<cmdRef:KeyBindingEx CommandReference="{Binding DeleteCommand}"/>
</Window.InputBindings>
</Window>
그래서 그것을 재사용 의미를 보인다는 어떻게 든 변하지 않는 부분. 여기에 스타일을 그렇게 나의 첫 번째 시도이다
<Style x:Key="MyWindowStyle" TargetType="{x:Type Window}">
<Setter Property="Background" Value="{DynamicResource WaveWindowBackground}"></Setter>
<Setter Property="FontFamily" Value="Arial"></Setter>
<Setter Property="Height" Value="600"></Setter>
<Setter Property="Width" Value="750"></Setter>
<Setter Property="Title" Value="{Binding AppName}"></Setter>
<Setter Property="Icon" Value="{Binding IconUri}"></Setter>
</Style>
고통 포인트
내가 WindowStartupLocation에 대한 속성 setter를 찾을 수 없습니다-
내가있는 InputBindings을 만드는 방법을 볼 수 없습니다
- 스타일의 부분
스타일을 올바르게 사용하거나 거기에 사용할 다른 기술이 있습니까? 위의 속성을 어떻게 설정할 수 있습니까?
건배.
Berryl
완벽하게 들립니다. 그러나 당신이 의미하는 것이 확실하지 않습니다 - 더 잘 설명하기 위해 일부 코드 및/또는 xaml을 긁을 수 있습니까? – Berryl
@Berryl : 예제를 추가했습니다. 괜찮습니까? – Jon
그래서 ShellView를있는 그대로두고 인스턴스를 만들고 내용을 설정 하시겠습니까? 기존 UserControl을 대체하는 부분은 Content가되거나 Content 속성의 정의는 어떻게됩니까? – Berryl