We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Duvida sobre posicionamento dos menus no SFlistview

Boa Tarde, Estou tentando montar um menu usando SFListview, mas estou tendo muita dificuldade com os espaços entre os menus e nas margens, vejo um exemplo de como esta hoje.

Example

2 Replies

SF Sidival Felisberto December 26, 2019 12:24 AM UTC

this work for me.

<?xml version="1.0" encoding="UTF-8"?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:local="using:EasyCom"
x:Class="EasyCom.MasterPage"  
             Padding="20,100,30,120"  
IconImageSource="hamburger.png"
             xmlns:syncfusion="clr-namespace:Syncfusion.ListView.XForms;assembly=Syncfusion.SfListView.XForms"
             xmlns:dataSource="clr-namespace:Syncfusion.DataSource;assembly=Syncfusion.DataSource.Portable"
             BackgroundImage="menu_e_cardapio.jpg"
Title="Personal Organiser">

    <ContentPage.Resources>
        <ResourceDictionary>
            <local:GroupHeaderConverter x:Key="TemplateConverter"/>
            <OnPlatform x:TypeArguments="x:String" x:Key="FFF_Tusj">
                <On Platform="Android" Value="FFF_Tusj.ttf#FFF_Tusj" />
                <On Platform="UWP" Value="/Assets/FFF_Tusj.ttf#FFF_Tusj" />
                <On Platform="iOS" Value="FFF_Tusj" />
            </OnPlatform>
        </ResourceDictionary>
    </ContentPage.Resources>

    <ContentPage.BindingContext>
        <local:ViewModel />
    </ContentPage.BindingContext>

    <ContentPage.Content>
        <Grid CascadeInputTransparent="True" >
            <syncfusion:SfListView x:Name="listView" 
                                   Grid.Row="0" 
                                   ItemSize="50" 
                                   AllowGroupExpandCollapse="True" 
                                   RowSpacing="0" 
                                   SelectionMode="Single" 
                                   DragStartMode="OnHold"
                                   ItemSpacing="1" 
                                   AutoFitMode="Height" 
                                   GroupHeaderSize="15"
                                   ItemsSource="{Binding BookInfo}" 
                                                                     >
                <syncfusion:SfListView.DataSource>
                    <dataSource:DataSource>
                        <dataSource:DataSource.GroupDescriptors>
                            <dataSource:GroupDescriptor PropertyName="menuOptionlevel" />
                        </dataSource:DataSource.GroupDescriptors>
                    </dataSource:DataSource>
                </syncfusion:SfListView.DataSource>

                <syncfusion:SfListView.Behaviors>
                    <local:Behavior/>
                </syncfusion:SfListView.Behaviors>

                <!-- Menu Pai -->
                <syncfusion:SfListView.GroupHeaderTemplate>
                    <DataTemplate>
                        <ViewCell>
                            <ViewCell.View>
                                <StackLayout Spacing="0"
                                             BackgroundColor="Transparent"
                                             Padding="0,0,0,0">

                                    <Label Text="{Binding Key}" 
                                           FontSize="15" 
                                           FontAttributes="Bold" 
                                           TextColor="Red" 
                                           FontFamily="{StaticResource FFF_Tusj}"
                                           VerticalOptions="Center" 
                                           HorizontalOptions="Start"/>
                                </StackLayout>
                            </ViewCell.View>
                        </ViewCell>
                    </DataTemplate>
                </syncfusion:SfListView.GroupHeaderTemplate>

                <!-- Menu Filho -->
                <syncfusion:SfListView.ItemTemplate >
                    <DataTemplate>
                        <ViewCell>
                            <ViewCell.View>
                                <StackLayout Spacing="0"
                                             BackgroundColor="Transparent"
                                             Padding="15,0,0,0">

                                    <Image Source= "ic_1.png"
                                                       VerticalOptions="Center"
                                                       HorizontalOptions="StartAndExpand"
                                                       HeightRequest="10"/>

                                    <Label LineBreakMode="NoWrap"
                                                       TextColor="White" 
                                                       HorizontalOptions="StartAndExpand"
                                                       VerticalOptions="Start" 
                                                       Text="{Binding menuOptionName}"
                                                       FontAttributes="Bold" 
                                                       FontFamily="{StaticResource FFF_Tusj}" />
                                </StackLayout>
                            </ViewCell.View>
                        </ViewCell>
                    </DataTemplate>
                </syncfusion:SfListView.ItemTemplate>
            </syncfusion:SfListView>
        </Grid>
    </ContentPage.Content>
</ContentPage>



GP Gnana Priya Namasivayam Syncfusion Team December 30, 2019 05:35 AM UTC

Hi Sidival, 

Thanks for using Syncfcusion products. 

We glad that reported issue have been resolved at your end. Please let us know if you need any further assistance from us. We are glad to help you out as always. 

Regards, 
Gnana Priya N 


Loader.
Live Chat Icon For mobile
Up arrow icon