Удаление ненужных пробелов - PullRequest
0 голосов
/ 19 февраля 2020

У меня есть два представления Listview: общий счет-фактура и одно, содержащее все детали товаров, которые были в счете (элементы корзины)

Вы заметите огромный пробел между Основной порядок и список предметов, я не могу избавиться от пробелов, не устанавливая жестких значений, которых я бы хотел избежать. У кого-нибудь есть идеи?

Является ли Listview просто занимающим место для другого элемента, но может содержать только один, может быть?

Просто для пояснения, я могу дать верхнему Listview запрос высоты, скажем, около 310, чтобы получить интервал верно, но я ищу способ, который не требует от меня установки. жесткое значение, которое может искажать некоторые телефоны

  <ContentPage.Content>
        <StackLayout BackgroundColor="Transparent" Spacing="0" Opacity="1" HorizontalOptions="FillAndExpand"
                     Margin="4,0,4,0" VerticalOptions="StartAndExpand">
            <Label Text="Main Order" TextColor="White" HeightRequest="30" HorizontalOptions="Center"
                   VerticalOptions="Center" FontSize="Title" FontAttributes="Bold" />

            <ListView x:Name="SingleOrderList"
                      BackgroundColor="Transparent"
                      HasUnevenRows="True"

                      VerticalOptions="Start"
                      HorizontalOptions="FillAndExpand"
                      SeparatorVisibility="Default">
                <ListView.ItemTemplate>
                    <DataTemplate>
                        <ViewCell>
                            <ViewCell.View>
                                <Frame CornerRadius="20" BackgroundColor="White" Margin="4,0,4,0" Padding="27">
                                    <StackLayout BackgroundColor="Transparent" Orientation="Vertical" Spacing="0">


                                        <Label HorizontalTextAlignment="Center" TextColor="Black">
                                            <Label.FormattedText>
                                                <FormattedString>
                                                    <Span Text="ID:" FontAttributes="Bold" FontSize="Large" />
                                                    <Span Text="{ Binding id }" FontAttributes="Bold" FontSize="Large" />
                                                </FormattedString>
                                            </Label.FormattedText>
                                        </Label>
                                        <Label HorizontalTextAlignment="Center" TextColor="Black">
                                            <Label.FormattedText>
                                                <FormattedString>
                                                    <Span Text="Mail:" />
                                                    <Span Text="{ Binding billing.email }" FontAttributes="Bold"
                                                          FontSize="Medium" />
                                                </FormattedString>
                                            </Label.FormattedText>
                                        </Label>
                                        <Label HorizontalTextAlignment="Center" TextColor="Black">
                                            <Label.FormattedText>
                                                <FormattedString>
                                                    <Span Text="Date:" />
                                                    <Span Text="{ Binding date_created }" FontAttributes="Bold"
                                                          FontSize="Medium" />
                                                </FormattedString>
                                            </Label.FormattedText>
                                        </Label>
                                        <Label HorizontalTextAlignment="Center" TextColor="Black">
                                            <Label.FormattedText>
                                                <FormattedString>
                                                    <Span Text="Status:" />
                                                    <Span Text="{ Binding status }" FontAttributes="Bold"
                                                          FontSize="Medium" />
                                                </FormattedString>
                                            </Label.FormattedText>
                                        </Label>
                                        <Label HorizontalTextAlignment="Center" TextColor="Black">
                                            <Label.FormattedText>
                                                <FormattedString>

                                                    <Span Text="{ Binding total, StringFormat='Total R:{0,5:#,0.00}' }"
                                                          FontAttributes="Bold" FontSize="Medium" />
                                                </FormattedString>
                                            </Label.FormattedText>
                                        </Label>
                                    </StackLayout>
                                </Frame>
                            </ViewCell.View>
                        </ViewCell>
                    </DataTemplate>
                </ListView.ItemTemplate>
            </ListView>
            <Label Text="ITEMS" TextColor="White" HeightRequest="30" HorizontalOptions="Center"
                   VerticalOptions="Center" FontSize="Title" FontAttributes="Bold" />
            <ListView BackgroundColor="Transparent"
                      x:Name="Lineorders"
                      HasUnevenRows="True"
                      VerticalOptions="FillAndExpand"
                      HorizontalOptions="FillAndExpand"
                      SeparatorVisibility="Default">
                <ListView.ItemTemplate>
                    <DataTemplate>
                        <ViewCell>
                            <ViewCell.View>
                                <Frame CornerRadius="20" BackgroundColor="White" Margin="10" Padding="20">
                                    <StackLayout
                                        Spacing="0"
                                        BackgroundColor="Transparent"
                                        VerticalOptions="FillAndExpand"
                                        HorizontalOptions="FillAndExpand">
                                        <Label HorizontalTextAlignment="Center" TextColor="Black">
                                            <Label.FormattedText>
                                                <FormattedString>
                                                    <Span Text="Product:" FontAttributes="Bold" FontSize="Large" />
                                                    <Span Text="{ Binding name }" FontAttributes="Bold"
                                                          FontSize="Large" />
                                                </FormattedString>
                                            </Label.FormattedText>
                                        </Label>
                                        <Label HorizontalTextAlignment="Center" TextColor="Black">
                                            <Label.FormattedText>
                                                <FormattedString>
                                                    <Span Text="Price:" />
                                                    <Span
                                                        Text="{ Binding price,StringFormat={}{0:0.####################}}"
                                                        FontAttributes="Bold" FontSize="Medium" />
                                                </FormattedString>
                                            </Label.FormattedText>
                                        </Label>
                                        <Label HorizontalTextAlignment="Center" TextColor="Black">
                                            <Label.FormattedText>
                                                <FormattedString>
                                                    <Span Text="Sku:" />
                                                    <Span Text="{ Binding sku }" FontAttributes="Bold"
                                                          FontSize="Medium" />
                                                </FormattedString>
                                            </Label.FormattedText>
                                        </Label>
                                        <Label HorizontalTextAlignment="Center" TextColor="Black">
                                            <Label.FormattedText>
                                                <FormattedString>

                                                    <Span
                                                        Text="{ Binding total , StringFormat='Total R:{0,5:#,0.00}' }"
                                                        FontAttributes="Bold" FontSize="Medium" />
                                                </FormattedString>
                                            </Label.FormattedText>
                                        </Label>
                                        <Label HorizontalTextAlignment="Center" TextColor="Black">
                                            <Label.FormattedText>
                                                <FormattedString>
                                                    <Span Text="Quantity:" />
                                                    <Span Text="{ Binding quantity }" FontAttributes="Bold"
                                                          FontSize="Medium" />
                                                </FormattedString>
                                            </Label.FormattedText>
                                        </Label>
                                    </StackLayout>
                                </Frame>
                            </ViewCell.View>
                        </ViewCell>
                    </DataTemplate>
                </ListView.ItemTemplate>
            </ListView>
        </StackLayout>
    </ContentPage.Content>

enter image description here

Что я ищу без HeightRequest

enter image description here

1 Ответ

0 голосов
/ 19 февраля 2020

enter image description here

<ContentPage.Content>
            <StackLayout
                Margin="4,0,4,0"
                BackgroundColor="Transparent"
                HorizontalOptions="FillAndExpand"
                Opacity="1"
                Spacing="0"
                VerticalOptions="StartAndExpand">
                <Label
                    FontAttributes="Bold"
                    FontSize="Title"
                    HeightRequest="30"
                    HorizontalOptions="Center"
                    Text="Main Order"
                    TextColor="White"
                    VerticalOptions="Center" />

                <ListView
                    x:Name="SingleOrderList"
                    BackgroundColor="Transparent"
                    HasUnevenRows="True"
                    HorizontalOptions="FillAndExpand"
                    SeparatorVisibility="Default"
                    VerticalOptions="FillAndExpand">
                    <ListView.ItemTemplate>
                        <DataTemplate>
                            <ViewCell>
                                <ViewCell.View>
                                    <Frame
                                        Margin="4,0,4,0"
                                        Padding="5,10,5,5"
                                        BackgroundColor="White"
                                        CornerRadius="20">
                                        <StackLayout
                                            BackgroundColor="LightSeaGreen"
                                            Orientation="Vertical"
                                            Spacing="0">
                                            <Label HorizontalTextAlignment="Center" TextColor="Black">
                                                <Label.FormattedText>
                                                    <FormattedString>
                                                        <Span
                                                            FontAttributes="Bold"
                                                            FontSize="Large"
                                                            Text="ID:" />
                                                        <Span
                                                            FontAttributes="Bold"
                                                            FontSize="Large"
                                                            Text="23" />
                                                    </FormattedString>
                                                </Label.FormattedText>
                                            </Label>
                                            <Label HorizontalTextAlignment="Center" TextColor="Black">
                                                <Label.FormattedText>
                                                    <FormattedString>
                                                        <Span Text="Mail:" />
                                                        <Span
                                                            FontAttributes="Bold"
                                                            FontSize="Medium"
                                                            Text="{Binding billing.email}" />
                                                    </FormattedString>
                                                </Label.FormattedText>
                                            </Label>
                                            <Label HorizontalTextAlignment="Center" TextColor="Black">
                                                <Label.FormattedText>
                                                    <FormattedString>
                                                        <Span Text="Date:" />
                                                        <Span
                                                            FontAttributes="Bold"
                                                            FontSize="Medium"
                                                            Text="{Binding date_created}" />
                                                    </FormattedString>
                                                </Label.FormattedText>
                                            </Label>
                                            <Label HorizontalTextAlignment="Center" TextColor="Black">
                                                <Label.FormattedText>
                                                    <FormattedString>
                                                        <Span Text="Status:" />
                                                        <Span
                                                            FontAttributes="Bold"
                                                            FontSize="Medium"
                                                            Text="{Binding status}" />
                                                    </FormattedString>
                                                </Label.FormattedText>
                                            </Label>
                                            <Label HorizontalTextAlignment="Center" TextColor="Black">
                                                <Label.FormattedText>
                                                    <FormattedString>

                                                        <Span
                                                            FontAttributes="Bold"
                                                            FontSize="Medium"
                                                            Text="{Binding total, StringFormat='Total R:{0,5:#,0.00}'}" />
                                                    </FormattedString>
                                                </Label.FormattedText>
                                            </Label>
                                        </StackLayout>
                                    </Frame>
                                </ViewCell.View>
                            </ViewCell>
                        </DataTemplate>
                    </ListView.ItemTemplate>
                </ListView>
                <Label
                    FontAttributes="Bold"
                    FontSize="Title"
                    HeightRequest="30"
                    HorizontalOptions="Center"
                    Text="ITEMS"
                    TextColor="Black"
                    VerticalOptions="Center" />
                <ListView
                    x:Name="Lineorders"
                    BackgroundColor="Transparent"
                    HasUnevenRows="True"
                    HorizontalOptions="FillAndExpand"
                    SeparatorVisibility="Default"
                    VerticalOptions="FillAndExpand">
                    <ListView.ItemTemplate>
                        <DataTemplate>
                            <ViewCell>
                                <ViewCell.View>
                                    <Frame
                                        Margin="10"
                                        Padding="5,10,5,5"
                                        BackgroundColor="White"
                                        CornerRadius="20">
                                        <StackLayout
                                            BackgroundColor="Red"
                                            HorizontalOptions="FillAndExpand"
                                            Spacing="0"
                                            VerticalOptions="FillAndExpand">
                                            <Label HorizontalTextAlignment="Center" TextColor="Black">
                                                <Label.FormattedText>
                                                    <FormattedString>
                                                        <Span
                                                            FontAttributes="Bold"
                                                            FontSize="Large"
                                                            Text="Product:" />
                                                        <Span
                                                            FontAttributes="Bold"
                                                            FontSize="Large"
                                                            Text="{Binding name}" />
                                                    </FormattedString>
                                                </Label.FormattedText>
                                            </Label>
                                            <Label HorizontalTextAlignment="Center" TextColor="Black">
                                                <Label.FormattedText>
                                                    <FormattedString>
                                                        <Span Text="Price:" />
                                                        <Span
                                                            FontAttributes="Bold"
                                                            FontSize="Medium"
                                                            Text="{Binding price, StringFormat={}{0:0.####################}}" />
                                                    </FormattedString>
                                                </Label.FormattedText>
                                            </Label>
                                            <Label HorizontalTextAlignment="Center" TextColor="Black">
                                                <Label.FormattedText>
                                                    <FormattedString>
                                                        <Span Text="Sku:" />
                                                        <Span
                                                            FontAttributes="Bold"
                                                            FontSize="Medium"
                                                            Text="{Binding sku}" />
                                                    </FormattedString>
                                                </Label.FormattedText>
                                            </Label>
                                            <Label HorizontalTextAlignment="Center" TextColor="Black">
                                                <Label.FormattedText>
                                                    <FormattedString>

                                                        <Span
                                                            FontAttributes="Bold"
                                                            FontSize="Medium"
                                                            Text="{Binding total, StringFormat='Total R:{0,5:#,0.00}'}" />
                                                    </FormattedString>
                                                </Label.FormattedText>
                                            </Label>
                                            <Label HorizontalTextAlignment="Center" TextColor="Black">
                                                <Label.FormattedText>
                                                    <FormattedString>
                                                        <Span Text="Quantity:" />
                                                        <Span
                                                            FontAttributes="Bold"
                                                            FontSize="Medium"
                                                            Text="{Binding quantity}" />
                                                    </FormattedString>
                                                </Label.FormattedText>
                                            </Label>
                                        </StackLayout>
                                    </Frame>
                                </ViewCell.View>
                            </ViewCell>
                        </DataTemplate>
                    </ListView.ItemTemplate>
                </ListView>
            </StackLayout>
        </ContentPage.Content>
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...