carolzbnbr / OnScreenSizeMarkup.Maui

OnScreenSizeMarkup.MAUI is a XAML markup extension that facilitates the control of UI elements (Views) according to the physical screen size category of a device (such as medium-sized, large-sized devices, etc.). This extension provides a flexible way to tailor your interface to various screen dimensions.
35 stars 2 forks source link

Adding OnPlatform for Grid.RowDefinitions / Grid.ColumnDefinitions along side OnScreenSizeMarkup #6

Closed JudicialCafe closed 4 months ago

JudicialCafe commented 4 months ago

Hello, and thank you for the awesome package.

Currently for many controls I am able to use the OnPlatform feature to do my sizing without any issues. Such as.

This works great. But cant seem to implement the same features for Row / Column definitions in a grid I have tried
carolzbnbr commented 4 months ago

Hi,

Try this on your page.resources:

  <ResourceDictionary>
            <OnPlatform x:Key="SaveButtonRow" x:TypeArguments="GridLength">
                <OnPlatform.Platforms>
                    <On Platform="Android">
                        <markups:OnScreenSize FallbackType="{x:Type GridLength}"
                                              Default="*" 
                                              Medium="80"
                                              Large="80"/>
                    </On>
                    <On Platform="iOS">
                        <markups:OnScreenSize FallbackType="{x:Type GridLength}"
                                              Default="*" 
                                              Medium="60" />
                    </On>
                </OnPlatform.Platforms>
            </OnPlatform>

  </ResourceDictionary>

And then inside the page's content, declare your grid as is:

<Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="{StaticResource SaveButtonRow}"/>
            </Grid.RowDefinitions>

</Grid>
JudicialCafe commented 4 months ago

Thank you soo much.

carolzbnbr commented 4 months ago

Glad it worked.

Closing the issue since everything is working perfectly.