2016-03-03 51 views
0

我有一个应用程序将轻微定制为不同的租户(主要服务层和轻的用户界面变化),所以我设计了一个核心项目与租户项目必须承继的基础应用程序类。所述基本应用程序类具有与一些隐含的应用程序范围样式相关联的应用程序XAML,但是看起来应用程序不会选择它们,因为控件以完全本地样式呈现。Xamarin表单是否支持基本应用程序资源?

它真的不被支持,或者我在这里做错了什么?

这是XAML

<Application 
    xmlns="http://xamarin.com/schemas/2014/forms" 
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" 
    xmlns:branding="clr-namespace:AT.UI.Common.Branding;assembly=AT.UI.Common" 
    x:Class="AT.UI.Common.BaseATApplication"> 

    <!-- TODO: Find out how to make this work for subclasses --> 
    <Application.Resources> 
    <ResourceDictionary> 
     <Style TargetType="Button"> 
      <Setter Property="BackgroundColor" Value="{x:Static branding:UIBranding.StandbyButtonBackgroundColor}" /> 
      <Setter Property="TextColor" Value="{x:Static branding:UIBranding.ButtonForegroundColor}" /> 
     </Style> 
     </ResourceDictionary> 
    </Application.Resources> 
</Application> 

BaseATApplication的构造具有所需的InitializeComponent()调用。

回答

0

我认为,他们需要被明确提到

<Style x:Key="ButtonStyle" TargetType="Button"> 
      <Setter Property="BackgroundColor" Value="{x:Static branding:UIBranding.StandbyButtonBackgroundColor}" /> 
      <Setter Property="TextColor" Value="{x:Static branding:UIBranding.ButtonForegroundColor}" /> 
</Style> 

<Button Style="{StaticResource ButtonStyle}" /> 
+0

我会尝试,但它应该捡起来作为隐含的,而我可能击中类似https://bugzilla.xamarin.com/错误show_bug.cgi?ID = 27659。接得好 – Machinarius

相关问题