【发布时间】:2020-08-31 14:01:38
【问题描述】:
我正在尝试更新我在 xaml 代码中创建的 cs 文件 (c#) 中的按钮样式。
我搜索了很多解决方案,但没有一个奏效。
<flv:FlowListView FlowColumnCount="3" SeparatorVisibility="None" HasUnevenRows="true"
FlowItemTappedCommand="{Binding ItemTappedCommand}" FlowLastTappedItem="{Binding LastTappedItem}"
FlowItemsSource="{Binding MyCategories}" >
<flv:FlowListView.FlowColumnTemplate>
<DataTemplate>
<Button Text="{Binding Name}"
TextColor="White"
x:Name="CategoryButtons"
Clicked="ButtonSelected"
ContentLayout="Top"
BackgroundColor="Transparent"
BorderColor="White"
BorderWidth="2"
CornerRadius="6"
Margin="5,5,5,10" />
</DataTemplate>
</flv:FlowListView.FlowColumnTemplate>
</flv:FlowListView>
public void ButtonSelected(object sender, EventArgs e)
{
}
【问题讨论】:
-
@LarryTang 我看到了那个解决方案,但它太令人困惑了,可能有更好的解决方案,而不是那个令人困惑的解决方案,这就是我正在寻找的。我希望更新不在我的 c# 文件中创建。
-
您是否有理由不希望在
Xaml中声明/使用该样式? -
@TaylorD 我希望在我的 Xaml 文件中声明我的样式,因为 FlowListView 代码,但如果它更好,我可以在 ResourceDictionary 中删除一些样式。我只是希望能够通过 cs 文件(c#)更改我的按钮样式。 (抱歉耽搁了)
标签: c# xaml xamarin.forms