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.
Unfortunately, activation email could not send to your email. Please try again.

If datatemplate has stacklayout selection and swiping doesnt work

Thread ID:





127826 Dec 11,2016 07:05 PM Dec 13,2016 08:12 AM Xamarin.Forms 4
Tags: SfDataGrid
Asked On December 11, 2016 07:05 PM

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 11, 2016 08:34 PM

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 12:38 AM

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 05:54 AM

thank you for nice explanation. It works fine now

Ashok N [Syncfusion]
Replied On December 13, 2016 08:12 AM

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.

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.