layout.width statement location in maui application

Haviv Elbsz 2,151 Reputation points
2022-12-05T15:38:53.147+00:00

Hi all

I put layout.width statement in
page load event

but its value is zero where I can put
this statement so it's give me the
real width of the layout

Thank you very much

Developer technologies | .NET | .NET MAUI
Developer technologies | C#
Developer technologies | C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
{count} votes

Answer accepted by question author
  1. Wenyan Zhang (Shanghai Wicresoft Co,.Ltd.) 36,451 Reputation points Microsoft External Staff
    2022-12-09T10:06:38.75+00:00

    Hello,

    You could try to use Grid, then set three columns(1,8,1), and add the Button on second coumn.

    <Grid.ColumnDefinitions>  
                <ColumnDefinition Width="*" />  
                <ColumnDefinition Width="8*" />  
                <ColumnDefinition Width="*" />  
            </Grid.ColumnDefinitions>  
    

    Best Regards,
    Wenyan Zhang


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.