为什么无法在listview中更改字体大小
我希望在listview的所有单元格中增加和减少字体大小 但我无法通过普通代码实现这一目标
txt.Fontsize = 20;
这是我在xaml中的代码
<ListView AbsoluteLayout.LayoutBounds="0,0,1,0.865" AbsoluteLayout.LayoutFlags="All" x:Name="listview" BackgroundColor="White" HasUnevenRows="true" ItemsSource="{Binding names}" ><ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<StackLayout Padding="10" VerticalOptions="Center" >
<Label x:Name="txt" HorizontalTextAlignment="End" TextColor="Black" Text="{Binding _index} "></Label>
</StackLayout>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
答案 0 :(得分:0)
我通过滑块值找到解决方案
<Slider Maximum="50" Minimum="20" x:Name="slider" AbsoluteLayout.LayoutBounds="0.5,0.1,0.6,0.02" AbsoluteLayout.LayoutFlags="All" ></Slider>
和标签: -
<Label x:Name="txt" FontSize="{Binding Source={x:Reference slider},Path=Value}" HorizontalTextAlignment="End" TextColor="Black" Text="{Binding _text}"></Label>