Setting Border Thickness & Brush of a particular Row using index
Hi,
I am working with SFDataGrid & have a query regarding setting the BorderThickness & BorderBrush of a particular Row using index.
I have already created RowStyle by which is set BorderBrush & BorderThickness, However on certain occasion the BorderBrush & BorderThickness needs to be changed in a particular Row.
I have tried setting it from StyleSelector, CurrentCellBorderThickness & CurrentCellBorderBrush but to no avail.
Is it possible to do so? If yes can someone please provide a solution for it.
Thanks
SIGN IN To post a reply.
3 Replies
JG
Jai Ganesh S
Syncfusion Team
March 28, 2018 08:27 AM UTC
Hi Nitin,
You can achieve your requirement to set the BorderBrush & BorderThickness for particular row based on the row index by using RowStyleSelector like below,
|
<Syncfusion:SfDataGrid x:Name="datagrid"
RowStyleSelector="{StaticResource styleSelector}"
AllowFiltering="True"
AllowEditing="False"
ItemsSource="{Binding GDCSource}"
AllowSorting="True"
/>
<Style x:Key="rowStyle" TargetType="Syncfusion:VirtualizingCellsControl">
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="BorderBrush" Value="Blue"/>
</Style>
public class CustomRowStyleSelector:StyleSelector
{
public override Style SelectStyle(object item, DependencyObject container)
{
if ((item as DataRow).RowIndex == 5)
return App.Current.Resources["rowStyle"] as Style;
return base.SelectStyle(item, container);
}
} |
Sample: http://www.syncfusion.com/downloads/support/directtrac/general/ze/SfDataGridSample438335770.zip
You can also style the rows and cells by using converter and StyleSelector,
Regards,
Jai Ganesh S
NP
Nitin patel
April 2, 2018 01:25 PM UTC
Hi
Thanks for your reply
I tried the solutions that you recently provided,
However i noted that i cant change it during runtime, my list contains almost 7000 rows,
& at runtime only a single row would have an increase bottom thickness & color change.
That single row will change dynamically based on the selectedIndex.
Can you please provide me a solution based on my query.
Thanks & Regards
JG
Jai Ganesh S
Syncfusion Team
April 3, 2018 04:12 PM UTC
Hi Nitin,
We already have a KB article to set the BorderThickness and BorderBrush for selected row and you can find the KB link from the below location,
Regards,
Jai Ganesh S
SIGN IN To post a reply.
- 3 Replies
- 2 Participants
-
NP Nitin patel
- Mar 27, 2018 01:21 PM UTC
- Apr 3, 2018 04:12 PM UTC