Xamarin 我可以为模板创建样式并将其作为参数传入吗?

Xamarin 我可以为模板创建样式并将其作为参数传入吗?,xamarin,xamarin.forms,Xamarin,Xamarin.forms,我有这个模板: <?xml version="1.0" encoding="utf-8"?> <StackLayout xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"              xmlns:local="clr-namespace:Japanese;assembly=Japanese

我有这个模板:

<?xml version="1.0" encoding="utf-8"?>
<StackLayout xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" 
             xmlns:local="clr-namespace:Japanese;assembly=Japanese" 
             x:Class="Japanese.Templates.FooterTemplate" 
             x:Name="this" BackgroundColor="#efeff4"
             HorizontalOptions="FillAndExpand" 
             Orientation="Vertical" Spacing="0" Margin="0">
    <StackLayout HeightRequest="1" Orientation="Vertical" 
                 Spacing="0" Margin="0"
                 IsVisible="{Binding FooterType, Converter={StaticResource Type0BoolConverter}, Source={x:Reference this}  }" >
        <BoxView HeightRequest="1" HorizontalOptions="FillAndExpand" BackgroundColor="#FF0000" Margin="0" />
        <BoxView HeightRequest="1" HorizontalOptions="FillAndExpand" BackgroundColor="#00FF00" Margin="0" />
        <BoxView HeightRequest="1" HorizontalOptions="FillAndExpand" BackgroundColor="#0000FF" Margin="0" />
    </StackLayout>
</StackLayout>

        
        
        
    
我想用我作为参数传入的样式来决定三个BoxView的背景色


有没有人能告诉我这是否可行,如果可能的话,请给出一些建议。

看看这是否能帮助您:您需要通过xaml在模板上应用样式吗?未将术语通行证作为参数获取。