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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

If datatemplate has stacklayout selection and swiping doesnt work

Thread ID:





127826 Dec 12,2016 12:05 AM UTC Dec 13,2016 01:12 PM UTC Xamarin.Forms 4
Tags: SfDataGrid
Asked On December 12, 2016 12:05 AM UTC

I created a datatemple of sfdatagrid as below. If i use stacklayout within datagrid as datatemplate, selection and swiping doesnt work at all. Is it intended or a bug?


                <Grid BackgroundColor="White" Padding="10" RowSpacing="20">
                    <ColumnDefinition Width="*"></ColumnDefinition>
                    <ColumnDefinition Width="*"></ColumnDefinition>

                    <RowDefinition Height="*"></RowDefinition>
                    <RowDefinition Height="10"></RowDefinition>

                  <StackLayout Orientation="Vertical" Grid.Row="0" Grid.Column="0" >

                    <Label TextColor="Black"  Text="{Binding level}"/>                
                    <Label  TextColor="Black"   Text="{Binding name}" StyleClass="Header"  />                    

                  <BoxView Grid.Row="1"  Grid.Column="0" Grid.ColumnSpan="2"  HorizontalOptions="FillAndExpand" BackgroundColor="Black"></BoxView>                  


Replied On December 12, 2016 01:34 AM UTC

Actually error wasnt stacklayout. I figured out later it is caused by BackgroundColor="White" , I dont know what makes the difference but, when I removed it. It cause this error. 

Divakar Subramaniam [Syncfusion]
Replied On December 12, 2016 05:38 AM UTC

Hi Emil, 
Thanks for contacting Syncfusion Support. 
We have checked your query. The grid you loaded inside a GridTemplateColumn.CellTemplate will always be placed above the rows in SfDataGrid. Hence, even when you select the row, the background color of the grid will be appeared (in your code White) since the grid is loaded as a child of SfDataGrid. 
If you need to the selection should be appeared, then you should not set background color for the child you loaded in the DataTemplate or you can set the background color as “Transparent”. Please refer the below code snippet. 
    <Grid BackgroundColor="Transparent" 
        <StackLayout Orientation="Vertical"> 
            <Label Text="{Binding OrderID}" TextColor="Black" /> 
            <Label StyleClass="Header" 
                   Text="{Binding CUstomerID}" 
                   TextColor="Black" /> 
Also, we have attached a sample for your reference and you can download the same from the below link. 

Replied On December 12, 2016 10:54 AM UTC

thank you for nice explanation. It works fine now

Ashok N [Syncfusion]
Replied On December 13, 2016 01:12 PM UTC

Hi Emil, 

Thanks for your update. Please let us know if your require further assistance on this. 



This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon