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:

Created:

Updated:

Platform:

Replies:

127826 Dec 11,2016 07:05 PM Dec 13,2016 08:12 AM Xamarin.Forms 4
loading
Tags: SfDataGrid
Emil
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?

  <sfgrid:GridTemplateColumn.CellTemplate>

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

                  </Grid.ColumnDefinitions>
                  <Grid.RowDefinitions>
                    <RowDefinition Height="*"></RowDefinition>
                    <RowDefinition Height="10"></RowDefinition>
                  </Grid.RowDefinitions>

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

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

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

            </sfgrid:GridTemplateColumn.CellTemplate>

Emil
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. 
<DataTemplate> 
    <Grid BackgroundColor="Transparent" 
          Padding="10" 
          RowSpacing="20"> 
 
        <StackLayout Orientation="Vertical"> 
 
            <Label Text="{Binding OrderID}" TextColor="Black" /> 
            <Label StyleClass="Header" 
                   Text="{Binding CUstomerID}" 
                   TextColor="Black" /> 
 
        </StackLayout> 
    </Grid> 
</DataTemplate> 
   
Also, we have attached a sample for your reference and you can download the same from the below link. 
 
Regards, 
Divakar. 


Emil
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. 

Regards, 
Ashok 


CONFIRMATION

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.

;