첨부 실행 코드는 나눔고딕코딩 폰트를 사용합니다.
------------------------------------------------------------------------------------------------------------------------------------------------------
728x90
728x170

■ Binding 태그 확장의 Path 속성에서 바인딩 경로를 사용하는 방법을 보여준다.

TestProject.zip
0.15MB

▶ MainPage.xaml

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage x:Class="TestProject.MainPage" x:Name="page"
    xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
    xmlns:globe="clr-namespace:System.Globalization;assembly=netstandard">
    <ContentPage.Resources>
        <Style TargetType="Label">
            <Setter Property="FontSize"                Value="Large"  />
            <Setter Property="HorizontalTextAlignment" Value="Center" />
            <Setter Property="VerticalOptions"         Value="Center" />
        </Style>
    </ContentPage.Resources>
    <StackLayout
        Margin="10"
        HorizontalOptions="Center"
        VerticalOptions="Center">
        <TimePicker x:Name="timePicker" />
        <Label
            Margin="0,10,0,0"
            Text="{Binding Source={x:Reference timePicker},
                Path=Time.TotalSeconds,
                StringFormat='전체 초 수 : {0}'}" />
        <Label
            Margin="0,10,0,0"
            Text="{Binding Source={x:Reference page},
                Path=Content.Children.Count,
                StringFormat='StackLayout 자식 수 : {0}'}" />
        <Label
            Margin="0,10,0,0"
            Text="{Binding Source={x:Static globe:CultureInfo.CurrentCulture},
                Path=DateTimeFormat.DayNames[3],
                StringFormat='주중 요일 : {0}'}" />
        <Label Margin="0,10,0,0">
            <Label.Text>
                <Binding
                    Path="DateTimeFormat.DayNames[3]"
                    StringFormat="프랑스에서 주중 요일 : {0}">
                    <Binding.Source>
                        <globe:CultureInfo>
                            <x:Arguments>
                                <x:String>fr-FR</x:String>
                            </x:Arguments>
                        </globe:CultureInfo>
                    </Binding.Source>
                </Binding>
            </Label.Text>
        </Label>
        <Label
            Margin="0,10,0,0"
            Text="{Binding Source={x:Reference page},
                Path=Content.Children[1].Text.Length,
                StringFormat='두 번째 Label 문자 수 : {0}'}" />
    </StackLayout>
</ContentPage>
728x90
그리드형(광고전용)
Posted by icodebroker
,