더 나은 방법
은
확인할 수 있습니다 : 또한 Silverlight and styles
을 확인하십시오 How to set Silverlight Control Styles via Application.Resources
넣어 스타일을 좋아 이 Application.Xaml 파일에 또는 당신을 위해 새로 생성
<Application xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="AppResStyle.App"
>
<Application.Resources>
<Style x:Key="ButtonStyle" TargetType="Button">
<Setter Property="BorderBrush" Value="Green" />
<Setter Property="Foreground" Value="Blue" />
</Style>
</Application.Resources>
</Application>
이제 t처럼 활용할 수 있습니다. 그의 여러 스타일에서 버튼에 스타일 지정하기
<UserControl x:Class="AppResStyle.Page"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Width="130" Height="80">
<Grid x:Name="LayoutRoot" Background="White">
<Button Content="Button1" Height="75" Width="125" Style="{StaticResource ButtonStyle}" />
</Grid>
</UserControl>
나는 그것이 어떻게 작동하는지 알고 있다고 생각합니다.그러나, 나는 [이 토론] (http://stackoverflow.com/questions/1316405/how-to-set-a-top-margin-only-in-xaml)을 발견했으며, 내가 이해할 수있는 한, 오직 예를 지정하는 방법 모든 구성 요소의 왼쪽 여백. 어떻게해야합니까? 왼쪽 여백은 고정 된 채로 있어야하지만, 위쪽 여백을 점차 늘려야하므로 여러 개의 텍스트 블록이 있습니다. 수평으로 정렬 된 텍스트 블록 세트를 만드는 현명한 방법이 있습니까? –
XAML 레이아웃과 같은 @Andyj 사운드는이 작업을 수행하는 도구입니다. http://msdn.microsoft.com/en-us/library/windows/apps/xaml/hh465329.aspx – AlexStack