xaml - 按钮文本在网格中被切断

标签 xaml xamarin xamarin.forms xamarin.android xamarin.ios

如果我在 StackLayout 中有一个按钮,我可以编写任意多的文本,并且按钮会自动变大。但是,如果我在网格中有两个相邻的按钮,则它将不起作用并且文本会被切断。

<StackLayout>
                        
                        <Button
                            FontSize="Large"
                            Style="{DynamicResource PrimaryColorFullButton}"
                            Text="{resources:TranslateExtensions ErrorConnectionMessage}"
                            Command="{Binding ExecuteLoginCommand}" />
                    
                        <Grid
                            RowDefinitions="*,50"
                            ColumnDefinitions="*,*">
                    
                            <Button
                                Grid.Row="0"
                                Grid.Column="0"
                                Text="{resources:TranslateExtensions NewAccount}"
                                Command="{Binding ExecuteRegistrationCommand}"
                                Style="{DynamicResource TransparentFullButtonStyle}">
                            </Button>
                    
                            <Button 
                                Grid.Row="0"
                                Grid.Column="1"
                                Text="{resources:TranslateExtensions LoginForgotten}"
                                Command="{Binding ExecuteForgotPasswordCommand}"
                                Style="{DynamicResource TransparentFullButtonStyle}">
                            </Button>
                    
                        </Grid>    
                    </StackLayout>    

enter image description here

如何防止文本被截断?

最佳答案

从网格的 RowDefinitions 中删除 ,50

<Grid 
    RowDefinitions="*" 
    ColumnDefinitions="*,*">

它在 StackLayout 可用空间的底部保留一个高度为 50 的空白/白色矩形,这会切断第 0 行上的按钮。

关于xaml - 按钮文本在网格中被切断,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/71739139/

相关文章:

mvvm - Xamarin Forms 自定义可绑定(bind)命令类型不匹配

c# - 了解是否尚未在 XAML 中设置 DependencyProperty

c# - XAML、C# : How to Set ListView Visibility to Collapse/Visible on Checkbox value toggle?

android - 保存 pdf 而不向用户显示打印对话屏幕

android - 如何更改 Drawable 中的形状颜色?

visual-studio - Mac 上的 IPA 在哪里(当它用作构建服务器时)?

c# - 修改 XAML 文件

wpf - 基于成员变量的不同 View /数据模板

xamarin.forms - 触发Xamarin.Forms选择器

android - 主页和导航设置 : iOS and Android