简体   繁体   English

无法更改列表视图xamarin.forms中的字体大小

[英]can't change font size in listview xamarin.forms

Why can't change font size in listview 为什么无法在列表视图中更改字体大小

i want increase and decrease font size in all cells in listview but i can't make that by normal code 我想增加和减少列表视图中所有单元格的字体大小,但是我无法通过常规代码来实现

txt.Fontsize = 20;

this my code in xaml 这是我在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>

i found solution by slider value 我通过滑块值找到了解决方案

<Slider Maximum="50" Minimum="20"  x:Name="slider" AbsoluteLayout.LayoutBounds="0.5,0.1,0.6,0.02" AbsoluteLayout.LayoutFlags="All" ></Slider>

and in lable :- 并在标签中:

    <Label  x:Name="txt" FontSize="{Binding Source={x:Reference slider},Path=Value}" HorizontalTextAlignment="End" TextColor="Black" Text="{Binding _text}"></Label>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM