我有以下UserControl
。这是一个TextBox
有Button
:如何实现与WPF中的清除按钮的文本框?
<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,
RelativeSource={RelativeSource AncestorType=UserControl},
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中,我有以下问题:
关于如何解决这个问题的任何想法?如果我让背景透明再有就是与按钮没有问题,但文字得到下面的按钮,看起来怪怪的。
如果我这样做,那么在W7的按钮比文本更小,当你胡佛/点击它看起来太丑陋:( –
尝试博客文章我联系。 – Mario