我有这个模板:
<?xml version="1.0" encoding="UTF-8"?>
<ContentView xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Japanese.Templates.PointReductionModeTemplate" x:Name="this">
<StackLayout BackgroundColor="#FFFFFF" Padding="20,0" HeightRequest="49" Margin="0">
<Grid VerticalOptions="CenterAndExpand" x:Name="ABC">
</Grid>
</StackLayout>
</ContentView>
我该如何使用此文本和样式,在C#中将此标签添加到网格中?请注意,我希望能够引用 Source={x:Reference this}
。
<Label Text="{Binding Text, Source={x:Reference this}}" Style="{StaticResource LabelText}" />