[WinUI 3][RatingControl] キャプションを表示する

スポンサーリンク

RatingControl には、ユーザーの評価やテキストを表示することができます。

この記事では RatingControl のテキスト表示方法について説明します。

環境

開発環境 Microsoft Visual Studio Professional 2019 Preview
Version 16.11.0 Preview 3.0
Framework Microsoft .NET Framework Version 4.8.04084
その他 Microsoft.Project Reunion 0.8.0-preview
Microsoft.ProjectReunion.Foundation 0.8.0-preview
Microsoft.ProjectReunion.WinUI 0.8.0-preview
Microsoft.UI.Xaml 2.6.1

テキストを表示する

RatingControl にユーザー評価やテキストを表示するには Caption プロパティを使用します。

Caption は星の右側に表示されます。

以下は Caption に「Your rating」という文字列を表示する例です。

XAML

<Window
    x:Class="WinUISample.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:WinUISample"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">

    <StackPanel Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Center">
        <RatingControl x:Name="myRating"
                       Caption="Your rating"/>
    </StackPanel>
</Window>

C#

public MainWindow()
{
    this.InitializeComponent();
    myRating.Caption = "Your rating";
}
Caption の使用例

Caption の使用例

Please follow and like us:

コメント

タイトルとURLをコピーしました