WPF —— TextBlock、LineBreak RadioButton控件详解

一:TextBlock

1:TextBlock 简介

<LineBreak/> 换行

显示文本 标签内容和content属性共存

2、TextBlock 常用的属性

    Foreground:TextBlock的文本内容的颜色。

    Background:背景,获取或设置要用于填充内容区域背景的 Brush。

    FontFamily:获取或设置 TextBlock 的首选最常用字体系列。

    FontSize:TextBlock的字体大小。

    FontStretch:获取或设置 TextBlock 的常用字体拉伸特征。

    FontStyle:获取或设置 TextBlock 的顶级字体样式。

3 关于 TextBlock、LineBreak的实例

<TextBlock Text="青海洪水" FontSize="40" FontWeight="Bold" Foreground="Red">
    <LineBreak/>你好
    <LineBreak/>娃哈哈领导人去世了
    <LineBreak/>比亚迪秦15万左右,新款和比亚迪秦一样,
    <LineBreak/>但是价格七八万
</TextBlock>

二 :RadioButton单选框

实现分组的单选框,可以通过一下几种方式进行分组

1 通过groupName设置相同值进行分组
2 通过把单选框添加一个相同父标签

关于RadioButton的实例

        <RadioButton  GroupName="sex" Content="男" FontSize="20" Foreground="blue"
                      VerticalContentAlignment="Center" Width="100" Height="40"
                      HorizontalAlignment="Left" VerticalAlignment="top" 
                      >
        </RadioButton>
        <RadioButton  GroupName="sex" Content="女" FontSize="20" Foreground="blue"
               VerticalContentAlignment="Center" Width="100" Height="40"
               HorizontalAlignment="Left" VerticalAlignment="top" Margin="110,0"
               >
        </RadioButton>
        <RadioButton  GroupName="sex" Content="中" FontSize="20" Foreground="blue"
               VerticalContentAlignment="Center" Width="100" Height="40"
               HorizontalAlignment="Left" VerticalAlignment="top"  Margin="220,0"
               IsChecked="True"      
               >
        </RadioButton>
        <Grid Name="g2">
            <RadioButton   Content="苹果" FontSize="20" Foreground="blue"
         VerticalContentAlignment="Center" Width="261" Height="40"
         HorizontalAlignment="Left" VerticalAlignment="Top"  Margin="0,50,0,0"
         
         >
            </RadioButton>
            <RadioButton   Content="香蕉" FontSize="20" Foreground="blue"
VerticalContentAlignment="Center" Width="472" Height="40"
HorizontalAlignment="Left" VerticalAlignment="Top"  Margin="318,50,0,0"
IsChecked="True"      
>
            </RadioButton>

        </Grid>
        <Button Width="100" Height="40" Content="点击获取" Click="Button_Click">
        </Button>

效果图如下

  • 10
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值