WPF textbox 圆角制作

在app.xaml中加入以下节点,全局设置textbox圆角

<Style TargetType="{x:Type TextBox}">
            <Setter Property="VerticalAlignment" Value="Center"/>
            <Setter Property="HorizontalAlignment" Value="Center"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type TextBox}">
                        <Grid>
                            <Rectangle RadiusX="3" RadiusY="3" Fill="{TemplateBinding Background}" Stroke="#7e94a9"/>
                            <ScrollViewer x:Name="PART_ContentHost" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden" Padding="{TemplateBinding Padding}" Focusable="false">
                            </ScrollViewer>
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

posted on 2013-06-28 10:48  认真的我  阅读(1934)  评论(0编辑  收藏  举报