如何在 App.xaml Xamarin Forms for CustomButton 中定义样式?

用户8938509

如何在 App.xaml 中为 CustomButton 定义样式?

应用程序.xaml

 <Style x:Key="CustomButtonSmall" TargetType="CustomButton">
     <Setter Property="FontSize" Value="14" />
 </Style>

我的页面.xaml

<local:CustomButton Text="{i18n:Translate CreateAccountButton}"  
      Grid.Column="0" Command="{Binding CreateAccountCommand}" 
      Type="Normal" Style="{StaticResource CustomButtonSmall}" />
阿西什·库马尔

在 App.xaml 中

给 CustomButton 整个路径,如 TargetType="Control:CustomButton" 并在顶部定义 Control

 xmlns:Control="clr-namespace:xyz" 

 <Style x:Key="CustomButtonSmall" TargetType="Control:CustomButton">
            <Setter Property="FontSize" Value="14" />
        </Style>

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

如何在XAML中制作单选框(Xamarin Forms PCL)

如何在Prism中(Xamarin Forms)后面的XAML页面代码中访问视图模型实例

如何从Xamarin Forms中的C#中的App.xaml访问颜色?

无法从app.xaml访问Xamarin Forms中的StaticResource

如何在Xamarin.forms xaml中水平显示ListView中的项目?

iOS App(Xamarin)与iOS XAML App(Xamarin.Forms)与跨平台之间的区别是什么

如何在Xamarin.Forms XAML中绘制路径

XAML中的Xamarin.Forms ListView AutoHeight

如何重用Xamarin.Forms的父ContentView中定义的样式

Xamarin.Forms长按效果-如何在隐藏代码中设置命令(NO XAML)

如何在Xamarin Forms中从父项调用子项xaml中的方法?

Xamarin.Forms中的XAML绑定问题

如何在Xamarin Forms App中拦截Android设备的音量增大/减小按钮以打开相机?

如何在Xamarin Forms中创建带有注释区域的xaml和叠加层

如何在XAML [Xamarin.Forms]中使用String以外的Type设置自定义属性值

如何在xamarin.forms中的app.xaml.cs中处理System.TypeLoadException?

Xamarin Forms-CommandParameter-如何通过XAML传递自定义对象?

如何在Xamarin Forms iOS-App中接收ASPN令牌

App.xaml.cs中的Xamarin Forms Update值

Xamarin Forms Switch XAML

如何在Azure Mobile App for Xamarin Forms中处理用户令牌?

如何在xamarin-forms基于xaml的视图类中绑定到此

如何在xamarin.forms上使用xaml在主详细信息页面中显示页面标题?

如何在 xamarin.forms 中的 xaml 中大写/小写 resx 绑定?

如何从 Xamarin Forms 的 ContentPage 保存 App.xaml 中的资源?

Xamarin Forms - 如何在 xaml 中创建水平 ListView?

Xamarin Forms 如何在 Android 和 iOS 的 XAML 文件中调用不同的渲染器

Xamarin.Forms 如何将代码中的数据绑定到滑动视图(在 xaml 中工作)

如何在 Xamarin Forms 中以秒為單位延遲隨機圖像並顯示為 XAML?