버튼 컨트롤 스타일이 있고 데이터 바인딩 된 버전이 2 픽셀 오프셋이 필요한 그림 문자를 조정하기 위해 무엇이든간에 패딩을 변경하고 싶습니다.WPF 내에서 "math"할 수 있습니까? 데이터 바인딩 된 스타일
<Style x:Key="SimpleButton" TargetType="{x:Type Button}" BasedOn="{x:Null}">
<Setter Property="FocusVisualStyle" Value="{DynamicResource SimpleButtonFocusVisual}"/>
<Setter Property="Background" Value="{DynamicResource NormalBrush}"/>
<Setter Property="BorderBrush" Value="{DynamicResource NormalBorderBrush}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<!-- We use Grid as a root because it is easy to add more elements to customize the button -->
<Grid x:Name="Grid">
<Border x:Name="Border" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Padding}"/>
<!-- Content Presenter is where the text content etc is placed by the control. The bindings are useful so that the control can be parameterized without editing the template -->
<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" RecognizesAccessKey="True"/>
</Grid>
...
</Setter.Value>
</Setter>
</Style>
는 내가하고 싶은 것은 몇 가지 추가 마진을 추가 할 경우 패딩 = "{TemplateBinding이다 : 나는 (... 트리거 코드가 간결하게 제거 된 곳이다) 예를 들어 SimpleStyles.xaml에서 SimpleButton을 사용합니다 심}". Padding = "{TemplateBinding Padding} + 2,0,0,0"과 같은 것입니다.
거기에 XAML 구문이 있습니까? 그렇지 않다면 코드 (Decorator?)에서이를 수행 할 때 가장 좋은 방법이 있습니까?
당신의 예를 제공 할 수 있습니다 가치 계산기를 사용하여이 수학을 해보십시오 - 오용과 같은 것처럼 보입니다. –