我有以下的UserControl.它是一个带有按钮的TextBox
<Grid> <TextBox Grid.Column="0" Text="{Binding Text,RelativeSource={RelativeSource AncestorType=UserControl},UpdateSourceTrigger=PropertyChanged}" x:Name="TextBox" /> <Button Background="{Binding Background,ElementName=TextBox}" Grid.Column="1" Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" HorizontalAlignment="Right" Visibility="{Binding IsClearButtonVisible,Converter={StaticResource BooleanToVisibilityConverter}}" Command="{Binding ClearTextCommand,RelativeSource={RelativeSource AncestorType=UserControl}}" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" > <Button.Content> <Image Source="{StaticResource Delete2}" Stretch="None" RenderOptions.BitmapScalingMode="NearestNeighbor" VerticalAlignment="Center" HorizontalAlignment="Center" /> </Button.Content> </Button> </Grid>
在Windows 7中看起来不错,但在Windows XP中我有以下问题:
关于如何解决这个问题的任何想法?如果我使背景透明,那么按钮没有问题,但文本在按钮下方看起来很奇怪.
解决方法
使按钮更小和/或添加一个小边距以“缩小”可视背景.
编辑:周围看一点(想知道这没有被添加为一些新功能)我发现了this article with step-by-step instructions you could give a try.