layout.width statement location in maui application

Haviv Elbsz 2,071 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

.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
3,487 questions
C#
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.
10,915 questions
{count} votes

Accepted answer
  1. Wenyan Zhang (Shanghai Wicresoft Co,.Ltd.) 31,166 Reputation points Microsoft Vendor
    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 Answers by the question author, which helps users to know the answer solved the author's problem.