.NET MAUI LABLE 在WINDOWS 10 其 FontSize 實際對應數值 -> Avalonia的TextBlock 資料
.NET MAUI LABLE 在WINDOWS 10 其 FontSize 實際對應數值 -> Avalonia的TextBlock 資料
資料來源: copilot
Default (Body): 14
Caption: 12
Subtitle: 16
Title: 20
Title1: 24
Title2: 21
Headline: 32
Display: 45
Large: 22
Medium: 18
Small: 16
=====================
Avalonia 中 TextBlock 強制換行語法『
』
<Border BorderBrush="White" BorderThickness="1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Background="#2470a0" CornerRadius="5" Margin="2,2,2,2" Grid.Row="1" Grid.Column="5" Grid.RowSpan="2" > <TextBlock x:Name="CarrierBtn" Text="發票
載具" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="White" FontSize="16" /> </Border>
=====================
轉換成Avalonia的TextBlock [自己測試 心得]
Default (Body): 18
Caption: 16
Subtitle: 20
Title: 24
Title1: 28
Title2: 25
Headline: 36
Display: 49
Large: 26
Medium: 22
Small: 20
Micro: 16
<Window xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:vm="using:VPOS_Avalonia.ViewModels" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" x:Class="VPOS_Avalonia.Views.MainWindow" x:DataType="vm:MainWindowViewModel" Icon="/Assets/sys.ico" Title="VPOS_Avalonia" Background="#ff194a6e"> <Design.DataContext> <!-- This only sets the DataContext for the previewer in an IDE, to set the actual DataContext for runtime, set the DataContext property in code (look at App.axaml.cs) --> <vm:MainWindowViewModel/> </Design.DataContext> <Grid x:Name="FullGrid" Margin="3"> <Grid.RowDefinitions> <RowDefinition /> <!--Workspace --> <RowDefinition Height="40" /> <!--status column --> </Grid.RowDefinitions> <Grid x:Name="WorkspaceGrid" Margin="0,2,0,2" Grid.Row="0" Grid.Column="0"> <Grid.ColumnDefinitions> <ColumnDefinition Width="60"/> <!-- Menu --> <ColumnDefinition /> <!-- Content --> </Grid.ColumnDefinitions> <Grid x:Name="MenuGrid" Margin="1,0,1,0" Grid.Row="0" Grid.Column="0"> <Border x:Name="MenuBorder" BorderBrush="#194a6e" BorderThickness="1" CornerRadius="5"> <StackPanel Spacing="5"> <Border BorderThickness="2" BorderBrush="White"> <Image x:Name="SettingsBtn" Source="/Assets/settings.png" PointerPressed="SettingsBtn_Clicked"/> </Border> <Border BorderThickness="2" BorderBrush="White"> <Image x:Name="DevicesBtn" Source="/Assets/device.png" PointerPressed="DevicesBtn_Clicked"/> </Border> <Border BorderThickness="2" BorderBrush="White"> <Image x:Name="SynchronizeBtn" Source="/Assets/synchronize.png" PointerPressed="SynchronizeBtn_Clicked"/> </Border> <Border BorderThickness="2" BorderBrush="White"> <Image x:Name="LogoutBtn" Source="/Assets/logout.png" PointerPressed="LogoutBtn_Clicked"/> </Border> </StackPanel> </Border> <!--MenuBorder--> </Grid> <!--MenuGrid--> <Grid x:Name="ContentGrid" Grid.Row="0" Grid.Column="1" ColumnDefinitions="5.4*,6.6*"> <Border x:Name="LeftContentBorder" Grid.Row="0" Grid.Column="0" BorderThickness="1" BorderBrush="White" CornerRadius="5"> <Grid x:Name="LeftContentGrid" RowDefinitions="3.3*,5.7*,2*"> <Border x:Name="LeftContentBorder00" Grid.Row="0" Grid.Column="0" BorderThickness="1" BorderBrush="White" CornerRadius="5"> <Grid x:Name="ShowInfoGrid" RowDefinitions="1.3*,1.2*,0.8*"> <Grid x:Name="ShowInfoGrid00" Margin="2,0" Background="#1c4a6e" Grid.Row="0" Grid.Column="0" RowDefinitions="0.4*,0.3*,0.3*" ColumnDefinitions="*,*,*,*,*,*" IsEnabled="True"> <TextBlock x:Name="OrderStatusLable" Grid.Row="0" Grid.ColumnSpan="6" Text="訂購中" TextWrapping="WrapWithOverflow" Foreground="#ff7f50" FontSize="26" VerticalAlignment="Center" HorizontalAlignment="Center"/> <TextBlock x:Name="QuantityTextLable" Grid.Row="1" Grid.Column="0" Text="商品數量:" TextWrapping="WrapWithOverflow" Foreground="#ff7f50" FontSize="18" Padding="5,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Left"/> <TextBlock x:Name="QuantityValueLable" Grid.Row="1" Grid.Column="1" Text="10000" TextWrapping="WrapWithOverflow" Foreground="White" FontSize="22" VerticalAlignment="Center" HorizontalAlignment="Left"/> <TextBlock x:Name="DiscountTextLable" Grid.Row="1" Grid.Column="2" Text="優惠金額:" TextWrapping="WrapWithOverflow" Foreground="#ff7f50" FontSize="18" VerticalAlignment="Center" HorizontalAlignment="Left"/> <TextBlock x:Name="DiscountValueLable" Grid.Row="1" Grid.Column="3" Text="10000" TextWrapping="WrapWithOverflow" Foreground="White" FontSize="22" VerticalAlignment="Center" HorizontalAlignment="Left"/> <TextBlock x:Name="ServiceTextLable" Grid.Row="1" Grid.Column="4" Text="服務費:" TextWrapping="WrapWithOverflow" Foreground="#ff7f50" FontSize="18" VerticalAlignment="Center" HorizontalAlignment="Left"/> <TextBlock x:Name="ServiceValueLable" Grid.Row="1" Grid.Column="5" Text="10000" TextWrapping="WrapWithOverflow" Foreground="White" FontSize="22" VerticalAlignment="Center" HorizontalAlignment="Left"/> <TextBlock x:Name="ReceivableTextLable" Grid.Row="2" Grid.Column="0" Text="應收總額:" TextWrapping="WrapWithOverflow" Foreground="#ff7f50" FontSize="18" Padding="5,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Left"/> <TextBlock x:Name="ReceivableValueLable" Grid.Row="2" Grid.Column="1" Text="30000" TextWrapping="WrapWithOverflow" Foreground="White" FontSize="22" VerticalAlignment="Center" HorizontalAlignment="Left"/> <TextBlock x:Name="ChangeValueLable" Grid.Row="2" Grid.Column="2" Grid.ColumnSpan="4" Text="10000" TextWrapping="WrapWithOverflow" Foreground="Red" FontSize="20" VerticalAlignment="Center" HorizontalAlignment="Left"/> </Grid> <Grid x:Name="ShowInfoGrid01" Margin="2,0" Grid.Row="1" Grid.Column="0" RowDefinitions="2,*,*,*" ColumnDefinitions="1.09*,1.99*,1.09*,1.5*,0.9*,0.6*"> <Separator x:Name="ShowInfoLine00" Grid.Row="0" Grid.ColumnSpan="6" Background="White" Height="2"/> <TextBlock x:Name="OrderNoTextLable" Grid.Row="1" Grid.Column="0" Text="訂單編號:" TextWrapping="WrapWithOverflow" Foreground="#ff7f50" FontSize="18" Padding="5,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Left"/> <TextBlock x:Name="OrderNoValueLable" Grid.Row="1" Grid.Column="1" Text="20230927-0001" TextWrapping="WrapWithOverflow" Foreground="White" FontSize="18" VerticalAlignment="Center" HorizontalAlignment="Center"/> <TextBlock x:Name="PickupNoTextLable" Grid.Row="1" Grid.Column="2" Text="取餐號:" TextWrapping="WrapWithOverflow" Foreground="#ff7f50" FontSize="18" VerticalAlignment="Center" HorizontalAlignment="Left"/> <TextBlock x:Name="PickupNoValueLable" Grid.Row="1" Grid.Column="3" Text="00000001" TextWrapping="WrapWithOverflow" Foreground="White" FontSize="18" VerticalAlignment="Center" HorizontalAlignment="Left"/> <TextBlock x:Name="VisitorsTextLable" Grid.Row="1" Grid.Column="4" Text="來客數:" TextWrapping="WrapWithOverflow" Foreground="#ff7f50" FontSize="18" VerticalAlignment="Center" HorizontalAlignment="Left"/> <TextBlock x:Name="VisitorsValueLable" Grid.Row="1" Grid.Column="5" Text="0001" TextWrapping="WrapWithOverflow" Foreground="White" FontSize="18" VerticalAlignment="Center" HorizontalAlignment="Center"/> <TextBlock x:Name="OrderTypeTextLable" Grid.Row="2" Grid.Column="0" Text="訂單類型:" TextWrapping="WrapWithOverflow" Foreground="#ff7f50" FontSize="18" Padding="5,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Left"/> <TextBlock x:Name="OrderTypeValueLable" Grid.Row="2" Grid.Column="1" Text="Uber Eats" TextWrapping="WrapWithOverflow" Foreground="White" FontSize="18" VerticalAlignment="Center" HorizontalAlignment="Center"/> <TextBlock x:Name="TableNoTextLable" Grid.Row="2" Grid.Column="2" Text="桌號:" TextWrapping="WrapWithOverflow" Foreground="#ff7f50" FontSize="18" VerticalAlignment="Center" HorizontalAlignment="Left"/> <TextBlock x:Name="TableNoValueLable" Grid.Row="2" Grid.Column="3" Text="豪華廳A0001" TextWrapping="WrapWithOverflow" Foreground="White" FontSize="18" VerticalAlignment="Center" HorizontalAlignment="Left"/> <TextBlock x:Name="ShopNoTextLable" Grid.Row="2" Grid.Column="4" Text="牌號:" TextWrapping="WrapWithOverflow" Foreground="#ff7f50" FontSize="18" VerticalAlignment="Center" HorizontalAlignment="Left"/> <TextBlock x:Name="ShopNoValueLable" Grid.Row="2" Grid.Column="5" Text="100" TextWrapping="WrapWithOverflow" Foreground="White" FontSize="18" VerticalAlignment="Center" HorizontalAlignment="Center"/> <TextBlock x:Name="MemberNameTextLable" Grid.Row="3" Grid.Column="0" Text="會員名稱:" TextWrapping="WrapWithOverflow" Foreground="#ff7f50" FontSize="18" Padding="5,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Left"/> <TextBlock x:Name="MemberNameValueLable" Grid.Row="3" Grid.Column="1" Text="合用系統有限公司" TextWrapping="WrapWithOverflow" Foreground="White" FontSize="18" VerticalAlignment="Center" HorizontalAlignment="Center"/> <TextBlock x:Name="MemberTelTextLable" Grid.Row="3" Grid.Column="2" Text="會員電話:" TextWrapping="WrapWithOverflow" Foreground="#ff7f50" FontSize="18" VerticalAlignment="Center" HorizontalAlignment="Left"/> <TextBlock x:Name="MemberTelValueLable" Grid.Row="3" Grid.Column="3" Text="04-22216292" TextWrapping="WrapWithOverflow" Foreground="White" FontSize="18" VerticalAlignment="Center" HorizontalAlignment="Center"/> </Grid> <Grid x:Name="ShowInfoGrid02" Margin="2,0" Grid.Row="2" Grid.Column="0" RowDefinitions="2,*,*" ColumnDefinitions="1*,1.3*,0.6*,1.31*,1.19*,0.6*"> <Separator x:Name="ShowInfoLine01" Grid.Row="0" Grid.ColumnSpan="6" Background="White" Height="2"/> <TextBlock x:Name="InvoiceNoTextLable" Grid.Row="1" Grid.Column="0" Text="發票號碼:" TextWrapping="WrapWithOverflow" Foreground="#ff7f50" FontSize="18" Padding="5,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Left"/> <TextBlock x:Name="InvoiceNoValueLable" Grid.Row="1" Grid.Column="1" Text="AB14433816" TextWrapping="WrapWithOverflow" Foreground="White" FontSize="18" VerticalAlignment="Center" HorizontalAlignment="Left"/> <Border BorderBrush="White" BorderThickness="1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Background="#2470a0" CornerRadius="5" Margin="2,2,2,2" Grid.Row="1" Grid.Column="2" Grid.RowSpan="2" > <TextBlock x:Name="TaxIDBtn" Text="客戶
統編" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="White" FontSize="16"/> </Border> <TextBlock x:Name="InvoiceCountTextLable" Grid.Row="1" Grid.Column="3" Text="發票剩餘張數:" TextWrapping="WrapWithOverflow" Foreground="#ff7f50" FontSize="18" VerticalAlignment="Center" HorizontalAlignment="Left"/> <TextBlock x:Name="InvoiceCountValueLable" Grid.Row="1" Grid.Column="4" Text="100" TextWrapping="WrapWithOverflow" Foreground="White" FontSize="18" VerticalAlignment="Center" HorizontalAlignment="Center"/> <Border BorderBrush="White" BorderThickness="1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Background="#2470a0" CornerRadius="5" Margin="2,2,2,2" Grid.Row="1" Grid.Column="5" Grid.RowSpan="2" > <TextBlock x:Name="CarrierBtn" Text="發票
載具" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="White" FontSize="16" /> </Border> <TextBlock x:Name="TaxIDTextLable" Grid.Row="2" Grid.Column="0" Text="客戶統編:" TextWrapping="WrapWithOverflow" Foreground="#ff7f50" FontSize="18" Padding="5,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Left"/> <TextBlock x:Name="TaxIDValueLable" Grid.Row="2" Grid.Column="1" Text="42897648" TextWrapping="WrapWithOverflow" Foreground="White" FontSize="20" VerticalAlignment="Center" HorizontalAlignment="Left"/> <TextBlock x:Name="CarrierTextLable" Grid.Row="2" Grid.Column="3" Text="發票載具:" TextWrapping="WrapWithOverflow" Foreground="#ff7f50" FontSize="18" VerticalAlignment="Center" HorizontalAlignment="Left"/> <TextBlock x:Name="CarrierValueLable" Grid.Row="2" Grid.Column="4" Text="/RZDFEP2" TextWrapping="WrapWithOverflow" Foreground="White" FontSize="16" VerticalAlignment="Center" HorizontalAlignment="Left"/> </Grid> </Grid> </Border> </Grid> </Border> </Grid> </Grid> </Grid> </Window>
One thought on “.NET MAUI LABLE 在WINDOWS 10 其 FontSize 實際對應數值 -> Avalonia的TextBlock 資料”
MAUI Label to Avalonia TextBlock XAML 語法替換
Label -> TextBlock
LineBreakMode -> TextWrapping
"WordWrap" -> "WrapWithOverflow"
TextColor -> Foreground
VerticalTextAlignment -> VerticalAlignment
HorizontalTextAlignment -> HorizontalAlignment
"Start" -> "Left"
FontAutoScalingEnabled="True" ->