0
나는 아래의 "POSITION ', 버튼의 내용과 같은 동일 TextBlock의의 텍스트를 만들 수 있는지, 다음과 같은 이미지 버튼의 스타일을 가지고? Thanks.`버튼 콘텐츠를 이미지 버튼의 텍스트 블록에 동적으로 바인딩 하시겠습니까?
<Style x:Key="TopButtonStyle" TargetType="Button">
<Setter Property="Padding" Value="0"/>
<Setter Property="Button.BorderBrush" Value="SteelBlue" />
<Setter Property="Button.BorderThickness" Value="0" />
<Setter Property="ContentTemplate">
<Setter.Value>
<DataTemplate>
<Grid Background="SteelBlue">
<Image Source="images/blue_button_up.png" HorizontalAlignment="Center" Margin="0,0,0,0" Height="Auto" Width="Auto" Stretch="UniformToFill"/>
<TextBlock Text="POSITION" HorizontalAlignment="Center" Foreground="White" Margin="5,5,0,0"/>
</Grid>
</DataTemplate>
</Setter.Value>
</Setter>
</Style>`
그래도 이미지 버튼의 ControlTemplate을 만들면 .... – NewDTinStackoverflow
아니요, 단지'Text = "{Binding}"'이 콘텐츠 인 'DataContext'에 바인딩됩니다. 'ControlTempl 'Content'는 텍스트에 제한이 없기 때문에,'ContentPresenter'를 사용해야합니다.) –
네, 멋지 네요. 감사.... – NewDTinStackoverflow