RadioButtons.Header 属性

定义

获取或设置组标头的内容。

public:
 property Platform::Object ^ Header { Platform::Object ^ get(); void set(Platform::Object ^ value); };
IInspectable Header();

void Header(IInspectable value);
public object Header { get; set; }
var object = radioButtons.header;
radioButtons.header = object;
Public Property Header As Object

属性值

Object

Platform::Object

IInspectable

组标头的内容。 默认为 null

示例

此示例演示一个 RadioButtons 组,其 Header 设置为“背景色”。

<!-- xmlns:muxc="using:Microsoft.UI.Xaml.Controls -->
<muxc:RadioButtons Header="Background color">
    <x:String>Red</x:String>
    <x:String>Green</x:String>
    <x:String>Blue</x:String>
</muxc:RadioButtons>

其标头设置为“背景色”的 RadioButtons 组

此示例演示一个 RadioButtons 组,其中包含一个带有图标和文本的复杂标头。

<!-- xmlns:muxc="using:Microsoft.UI.Xaml.Controls -->
<muxc:RadioButtons>
    <muxc:RadioButtons.Header>
        <StackPanel Orientation="Horizontal">
            <SymbolIcon Symbol="Highlight"/>
            <TextBlock Text="Highlight color" Margin="8,0,0,0"/>
        </StackPanel>
    </muxc:RadioButtons.Header>
    <x:String>Yellow</x:String>
    <x:String>Green</x:String>
    <x:String>Pink</x:String>
</muxc:RadioButtons>

其标头设置为“背景色”的 RadioButtons 组

注解

有关详细信息、设计指南和代码示例,请参阅 单选按钮

通常对 标头使用字符串,该标头显示为单选按钮组上方的文本标签。 也可以使用其他对象来代替字符串。

可以使用 HeaderTemplate 属性设置标头的数据模板。 HeaderTemplate如果设置了 属性,则将其用于 标头,并忽略 该Header属性。

适用于

另请参阅