Skip to content
This repository has been archived by the owner on May 29, 2024. It is now read-only.

It cannot center long texts #155

Closed
FANMixco opened this issue Jun 17, 2021 · 1 comment
Closed

It cannot center long texts #155

FANMixco opened this issue Jun 17, 2021 · 1 comment

Comments

@FANMixco
Copy link

I'm building an app with 3 columns but two of them have long texts:

<dg:DataGrid.Columns>
    <dg:DataGridColumn
        Title="Month"
        PropertyName="Month"
        HorizontalContentAlignment="CenterAndExpand"
        VerticalContentAlignment="CenterAndExpand"
        Width="*"/>
    <dg:DataGridColumn
        x:Name="ColCurrentYear"
        VerticalContentAlignment="CenterAndExpand"
        HorizontalContentAlignment="CenterAndExpand"
        Title="2021 Consumption kWh"
        PropertyName="CurrentYear"
        Width="*"/>
    <dg:DataGridColumn
        x:Name="ColLastYear"
        VerticalContentAlignment="CenterAndExpand"
        HorizontalContentAlignment="CenterAndExpand"
        Title="2020 Consumption kWh"
        PropertyName="PreviousYear"
        Width="*"/>
</dg:DataGrid.Columns>

Then, it looks like this:

Screenshot_1623917796

I tried without the \r\n and the result was the same. I found that in Android you can use this to force the centering: HorizontalTextAlignment="Center" because it seems this is a Xamarin.Forms bug thatI I reported.

@akgulebubekir
Copy link
Owner

You can use LineWrapping option for Column in latest release

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants