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

AutoFitMode="Height" doesnt work using frame in datatemplate

I am using frame inside datatemplate as show below, but this is not auto fitting for height, is there any limitation for frame or I do something wrong?

     <sfListView:SfListView.LayoutManager>
                        <sfListView:LinearLayout   />
                    </sfListView:SfListView.LayoutManager>
                    <sfListView:SfListView.ItemTemplate>
                        <DataTemplate>
                            <Frame  OutlineColor="Silver" HasShadow="True" Margin="5,0" Padding="1" BackgroundColor="Transparent" VerticalOptions="FillAndExpand">
                                <Grid    InputTransparent="True">
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="2*"></ColumnDefinition>
                                        <ColumnDefinition Width="*"></ColumnDefinition>
                                    </Grid.ColumnDefinitions>
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="35"></RowDefinition>
                                        <RowDefinition Height="15"></RowDefinition>
                                        <RowDefinition Height="15"></RowDefinition>
                                        <RowDefinition Height="15"></RowDefinition>
                                    </Grid.RowDefinitions>

                               
                            </Frame>

                        </DataTemplate>
                    </sfListView:SfListView.ItemTemplate>

2 Replies

EM Emil July 9, 2017 11:54 PM UTC

when I add a margin as  5,5 which makes margin buttom and up as 5, then frame appears correctly if buttom and upper margin is 0, frame doesnt fit on screen

   <Frame  OutlineColor="Silver" HasShadow="True" Margin="5,5" Padding="1" BackgroundColor="Transparent" VerticalOptions="FillAndExpand">




DB Dinesh Babu Yadav Syncfusion Team July 10, 2017 11:30 AM UTC

Hi Emil, 
 
Thank you for contacting Syncfusion Support. 
 
Query 
Response 
SfListView does not AutoFit the items when template is loaded within the Frame 
We have checked the reported issue “SfListView does not AutoFit the items when template is loaded within the Frame” at our end and we would like to let you know that if you define a size to element which is loaded in ItemTemplate property, then SfListView will returns that size as item size of each item. We have update this in our UG, for more information refer the below link, 
 

Also, in the given code snippet, you have defined a Height and Width for to the the ColumnDefintion and RowDefiniton in the Grid, so its doesn’t auto fit to content. So, we recommend you to define the Height and Width as “Auto”. Please refer the below sample, 

 
We have certain limitations while enabling the AutoFitMode and you can refer the following UG documentation link for more reference. 
 

Could you please check with the above sample and limitations in SfListView? If the issue still persist at your end, we request you to modify the above sample to replicate the reported issue and revert us with the replication procedure or in video link. So, that we could able to analyze the issue better and update you an appropriate solution. 

Defining Margin property within the ItemTemplate 
Instead of adjust the margin of element which defined in the ItemTemplate property, you use the ItemSpacing property of SfListView which generates the spacing around each item in the list as similar to Margin property. 
 
Please refer the following UG documentation link for more reference. 

 
Please let us know if you require further assistance. 
 
Regards, 
Dinesh Babu Yadav

Loader.
Live Chat Icon For mobile
Up arrow icon