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

Row Selection Issue

Thread ID:

Created:

Updated:

Platform:

Replies:

143526 Mar 25,2019 12:42 PM UTC Apr 4,2019 06:50 AM UTC WPF 6
loading
Tags: SfDataGrid
Brijesh
Asked On March 25, 2019 12:42 PM UTC

Hi Team

I am using Sfdatagrid in which I have GridTemplateColumn in which we have some buttons when I am clicking on a button then in single click not working but On double click, my view is opening on any button. I think first time click it is focusing on Sfdatagrid row selection later template column button. please help on this with an appropriate solution.

I have attached an image for your reference below.

Thanks 
Harshul


Attachment: ViewImage_a3d80504.zip

Deivaselvan Y [Syncfusion]
Replied On March 27, 2019 11:20 AM UTC

Hi Brijesh, 

Thank you for contacting Syncfusion support. 

We have analyzed your query to focus the button load in GridTemplateColumn in single click and you can achieve your requirement by setting Syncfusion.FocusManagerHelper.FocusedElement as true to the button as like below code snippet 

<syncfusion:GridTemplateColumn HeaderText="GrandTotal" MappingName="GrandTotal" > 
   <syncfusion:GridTemplateColumn.CellTemplate> 
     <DataTemplate> 
        <Grid> 
          <Grid.ColumnDefinitions> 
             <ColumnDefinition/> 
             <ColumnDefinition/> 
          </Grid.ColumnDefinitions> 
          <Button x:Name="button1" Grid.Column="0" Click="button1_Click" Height="20" syncfusion:FocusManagerHelper.FocusedElement="True" Margin="2" Content="B1"/> 
          <Button x:Name="button2" Grid.Column="1" Click="button2_Click" Height="20" syncfusion:FocusManagerHelper.FocusedElement="True" Margin="2,0,0,0" Content="B2"/> 
         </Grid> 
     </DataTemplate> 
   </syncfusion:GridTemplateColumn.CellTemplate> 
</syncfusion:GridTemplateColumn> 

Sample Link : 

Also please refer to the below KB article and UG link for more details 
KB Link: 

UG Link: 

Please let us know, if you need any further assistance on this. 

Regards, 
Deivaselvan 


Brijesh
Replied On March 27, 2019 12:11 PM UTC

Hi 

I am already using Syncfusion.FocusManagerHelper.FocusedElement as true but still it's not working. please check this issue again.

This is my code snippet:- 
<syncfusion:GridTemplateColumn Width="150" HeaderText="ACTION" ShowToolTip="False">
<syncfusion:GridTemplateColumn.CellTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<Button FontFamily="{StaticResource IcomoonFont}" Content="{StaticResource AddIcon}" syncfusion:FocusManagerHelper.FocusedElement="True"  Width="Auto" Background="Transparent" BorderThickness="0" Foreground="#03A8CD" FontSize="25" Click="AddWLClick" MouseRightButtonDown="AddBtnMouseRightButtonDown" ToolTip="Add to Market Watch" Padding="3"/>
<Button FontFamily="{StaticResource IcomoonFont}" Content="{StaticResource DetailIcon}" syncfusion:FocusManagerHelper.FocusedElement="True" Width="Auto" Background="Transparent" BorderThickness="0" Foreground="{DynamicResource MaterialDesignBodyLight}" FontSize="25" Click="DetailClick" Padding="3"/>
<Button FontFamily="{StaticResource IcomoonFont}" Content="{StaticResource BuyIcon}" syncfusion:FocusManagerHelper.FocusedElement="True" Width="Auto" Background="Transparent" BorderThickness="0" Foreground="{StaticResource PositiveTrend}" FontSize="25" Click="BuyClick" Padding="3"/>
<Button FontFamily="{StaticResource IcomoonFont}" Content="{StaticResource SellIcon}" syncfusion:FocusManagerHelper.FocusedElement="True" Width="Auto" Background="Transparent" BorderThickness="0" Foreground="{StaticResource NegativeTrend}" FontSize="25" Click="SellClick" Padding="3"/>
</StackPanel>
</DataTemplate>
</syncfusion:GridTemplateColumn.CellTemplate>
</syncfusion:GridTemplateColumn>

Thanks
Harshul

Deivaselvan Y [Syncfusion]
Replied On April 1, 2019 07:02 AM UTC

Hi Brijesh,

Thank you for the update.

We are unable to reproduce the reported issue with the given code example. Kindly provide more details on whether you have implemented any customization to the template column renderer and details on DataGrid settings. If possible, modify the sample which we shared earlier with you to reproduce the reported issue at our end, thereby we could analyze and update you with the appropriate solution at the earliest.

Regards,
Deivaselvan
 


Brijesh
Replied On April 1, 2019 11:39 AM UTC

Hello,

I have tried the sample given. But the sample also has the same problem. B1 when clicked, has the focus and works on the first click. But B2 does not work on the first click as how B1 works. B2 first gets row selection then on 2nd click it works. Kindly share a solution where both buttons work on the 1st click.

Thanks
Harshul

Dinesh Babu Yadav [Syncfusion]
Replied On April 2, 2019 01:26 PM UTC

Hi Harshul, 
 
We regret for the inconvenience caused.  
 
We are able to reproduce the reported “Button in TemplateColumn does not focus on first click” issue from our end. We are currently validating the mentioned issue and we will update you with further details on 4th April,2019. 
 
We will appreciate your patience until then. 
 
Regards, 
Dinesh Babu Yadav. 


Sabaridass Ramamoorthy [Syncfusion]
Replied On April 4, 2019 06:50 AM UTC

Hi Harshul, 

Thanks for your patience.  

We have analyzed the reported focusing issue with button inside template column and you can resolve this by customizing “SetFocus” method in renderer of Template column. Please refer to the following code example. 

this.dataGrid.CellRenderers.Remove("Template"); 
this.dataGrid.CellRenderers.Add("Template", new CustomGridCellTemplateRenderer()); 
 
public class CustomGridCellTemplateRenderer : GridCellTemplateRenderer 
{ 
   protected override void SetFocus(FrameworkElement uiElement, bool needToFocus) 
   { 
       if (!needToFocus) 
          DataGrid.Focus(); 
   } 
} 

Please find sample for the same from the below link. 

Please let us know, if you need any further assistance on this. 

Regards, 
Sabaridass R 
 


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.

Please sign in to access our forum

This page will automatically be redirected to the 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

;