0
<ContentView x:Name="xoverlay"
                            Margin="0,0,10,0"
                            Padding="0,0,0,0"
                            AbsoluteLayout.LayoutBounds="1,0.71,50,100"
                            AbsoluteLayout.LayoutFlags="SizeProportional"
                            BackgroundColor="{StaticResource ColorBack001}"
                            HeightRequest="500"
                            IsVisible="False"
                            WidthRequest="300">

                            <Ctrl:CtrlBorder BorderColor="{StaticResource ColorBorder000}">
                                <Grid Margin="6,6,6,6" RowSpacing="6">
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="12*" />
                                        <RowDefinition Height="2*" />
                                    </Grid.RowDefinitions>

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

                                    <Ctrl:CtrlBorder Grid.Row="0" BorderColor="{StaticResource ColorBorder000}">
                                        <Ctrl:CtrlListView x:Name="xlstSeriesView"
                                            BackgroundColor="White"
                                            ItemTapped="SeriesItemSelected"
                                            Style="{StaticResource CustomListViewStyle}">

                                            <ListView.ItemTemplate>
                                                <DataTemplate>
                                                    <ViewCell>
                                                        <ViewCell.View>
                                                            <Grid>
                                                                <Grid.ColumnDefinitions>
                                                                    <ColumnDefinition Width="2*" />
                                                                    <ColumnDefinition Width="8*" />
                                                                </Grid.ColumnDefinitions>

                                                                <input:CheckBox
                                                                    Key="{Binding Key}"
                                                                    Grid.Column="0"
                                                                    Margin="20,0,0,0"
                                                                    BorderColor="{StaticResource ColorBorder000}"
                                                                    CheckChanged="SeriesItemCheck"
                                                                    HorizontalOptions="Center"
                                                                    IsChecked="{Binding SeriesVisible}"
                                                                    Scale="1.5"
                                                                    VerticalOptions="Fill"
                                                                    Color="{StaticResource ColorBack004}" />

                                                                <Label
                                                                    Grid.Column="1"
                                                                    FontSize="27"
                                                                    HorizontalOptions="FillAndExpand"
                                                                    HorizontalTextAlignment="Center"
                                                                    Text="{Binding Title}"
                                                                    TextColor="{Binding SeriesColor}"
                                                                    VerticalOptions="FillAndExpand"
                                                                    VerticalTextAlignment="Center" />
                                                            </Grid>
                                                        </ViewCell.View>
                                                    </ViewCell>
                                                </DataTemplate>
                                            </ListView.ItemTemplate>
                                        </Ctrl:CtrlListView>
                                    </Ctrl:CtrlBorder>

                                    <StackLayout
                                        Grid.Row="1"
                                        HorizontalOptions="FillAndExpand"
                                        Orientation="Horizontal">

                                        <input:CheckBox x:Name="xAllSeriesChk"
                                            Grid.Column="0"
                                            Margin="15,0,0,0"
                                            BorderColor="{StaticResource ColorBorder000}"
                                            BoxBackgroundColor="White"
                                            CheckChanged="SeriesAllCheckChanged"
                                            HorizontalOptions="Center"
                                            IsChecked="True"
                                            Scale="2.0"
                                            VerticalOptions="FillAndExpand"
                                            Color="{StaticResource ColorBack004}" />

                                        <Ctrl:CtrlButton
                                            Margin="5,0,0,0"
                                            Clicked="BtnSelectSeriesCancel"
                                            HorizontalOptions="FillAndExpand"
                                            Text="{x:Static Lang:General.Cancel}"
                                            WidthRequest="180" />
                                    </StackLayout>
                                </Grid>
                            </Ctrl:CtrlBorder>


                        </ContentView>

This is a situation where the width and height of the parent window are variable like a split window. I put an AbsoluteLayout in it and created a content view. The problem is that since the size changes proportionally, the content view I created also changes proportionally according to the horizontal height of the parent window.

I want the contentview I created to be fixed regardless of the size of the parent window. What should I do?

enter image description here

enter image description here

  • If you want a fixed size, then don't use `AbsoluteLayout.LayoutFlags="SizeProportional"`. "Proportional" is what makes it a fraction of its container's size. – ToolmakerSteve Jun 29 '23 at 15:42
  • You can try to use the `AbsoluteLayout.LayoutFlags="None"` or `AbsoluteLayout.LayoutFlags="PositionProportional"`. – Liyun Zhang - MSFT Jul 03 '23 at 09:45

0 Answers0