【发布时间】:2018-06-10 14:46:35
【问题描述】:
我正在制作一个在每个屏幕上都有相同标题的应用程序,因此我为应用程序的该部分创建了一个 ControlTemplate,并在其上放置了一些按钮,这样就可以了。我很满意。
三个屏幕的页脚几乎相同,只是文本颜色和图像不同。我为页脚制作了另一个 ControlTemplate,我想根据当前显示的页面来操作带有绑定的图像上的 IsVisible 属性,但我不知道该怎么做。
我知道我需要编写一个转换器,我做到了,这似乎并不复杂,但我无法找到一种方法来实际绑定这些属性中的值。
两个 ControlTemplate 都是在应用程序级别定义的。
这是我如何使用它们的示例,也许这是错误的:
<ContentView ControlTemplate="{StaticResource Header}">
<!--This is the actuall page content-->
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="9*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!--Content of the page!-->
<Label Text="Welcome to Xamarin.Forms!"
VerticalOptions="Center"
HorizontalOptions="Center"
Grid.Row="0"/>
<!--Footer of the page!-->
<ContentView ControlTemplate="{StaticResource BuySellPayFooter}"
Grid.Row="1"/>
</Grid>
</ContentView>
我需要在页脚中绑定一些类的属性。怎么做?可以实现吗?
【问题讨论】:
标签: xamarin binding xamarin.forms controltemplate controltemplates