首页 > 代码库 > WPF 在TextBox 中添加Button

WPF 在TextBox 中添加Button

<Grid Margin="5, 5, 10, 5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<TextBox
x:Name="SearchBoxView"
HorizontalAlignment="Right"
Width="200"
FontSize="16"
KeyUp="SearchBoxKeyDown"
Text="{Binding SearchText, Mode=TwoWay}"
Grid.Column="0" Margin="0,115,212,164"
TextChanged="TextBox_TextChanged"/>
<Button
Background="{Binding Backgound, ElementName=SearchBoxView}"
HorizontalAlignment="Right"
HorizontalContentAlignment="Center" VerticalContentAlignment="Center"
Click="SearchBoxViewButtonClick" Height="29" VerticalAlignment="Bottom" RenderTransformOrigin="5.324,3.824" Width="34" Margin="0,0,214,166">
<Button.RenderTransform>
<TransformGroup>
<ScaleTransform ScaleX="-1"/>
<SkewTransform/>
<RotateTransform/>
<TranslateTransform X="-328.032"/>
</TransformGroup>
</Button.RenderTransform>
<Button.Template>
<ControlTemplate>
<Border HorizontalAlignment="Center" VerticalAlignment="Center">
</Border>
</ControlTemplate>
</Button.Template>
</Button>
</Grid>

WPF 在TextBox 中添加Button