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.

How do change BorderStyle of a row with StyleSelector

Thread ID:

Created:

Updated:

Platform:

Replies:

120151 Sep 5,2015 07:05 AM Sep 17,2015 04:27 AM WPF 3
loading
Tags: SfDataGrid
SXTrader
Asked On September 5, 2015 07:05 AM

Hello,
I've got a Datagrid. At the moment I'm changing the background of a row if a certain value is changing. I do it this way:

xmlns:sfgrid="clr-namespace:Syncfusion.UI.Xaml.Grid;assembly=Syncfusion.SfGrid.WPF"


<Style x:Key="gridRowBet" TargetType="sfgrid:VirtualizingCellsControl">

            <Style.Triggers>

                <DataTrigger Binding="{Binding HasBet}" Value="True">

                    <Setter Property="Background" Value="Red"/>

                </DataTrigger>

            </Style.Triggers>

</Style>


I
I'm not satified with the solution and want following behaviour instead: I've the DataTrigger changes I want to Border of the row become thicker and change color.
How can I do this.

Thanks

Markus
       

Ashok N [Syncfusion]
Replied On September 7, 2015 08:23 AM

Hi Markus,

Thank you for contacting Syncfusion support.

We have analyzed your query and we have prepared the sample to change the Background of the row based on the CellValue by using RowStyleSelector. You 

can download the sample from the below sample location

Sample location: http://www.syncfusion.com/downloads/support/forum/120151/ze/SimpleApplication_(2)-1508463314 

Please refer the below UG link to get more details regarding styles-and-templates in SfDataGrid

http://docs.syncfusion.com/wpf/sfdatagrid/styles-and-templates 

Please let us know if you require further assistance on this.

Thanks,

Ashok


SXTrader
Replied On September 16, 2015 04:04 PM

Hi Markus,

Thank you for contacting Syncfusion support.

We have analyzed your query and we have prepared the sample to change the Background of the row based on the CellValue by using RowStyleSelector. You 

can download the sample from the below sample location

Sample location: http://www.syncfusion.com/downloads/support/forum/120151/ze/SimpleApplication_(2)-1508463314 

Please refer the below UG link to get more details regarding styles-and-templates in SfDataGrid

http://docs.syncfusion.com/wpf/sfdatagrid/styles-and-templates 

Please let us know if you require further assistance on this.

Thanks,

Ashok


Hello,
thanks for your reply.
As I said I'm using XAML-Style Triggers. Now I've encountered a problem I couldn't explain yet. I'm trying to change the Forecolor of the Text in a Grid Row with Data Triggers. For some reasons it does not work.

I've tried the Row Style and the Cell Style for manipulation.

I've attached an example project to this post.

Could you please give me a hint what I'm doing wrong as I haven't found the solutions in the documentation yet.

Attachment: SXTippster_example_background_1c38151a.zip

Ganeshkumar Lingappan [Syncfusion]
Replied On September 17, 2015 04:27 AM

Hi ­­Markus,
Sorry about the inconvenience caused
We have analyzed your query. SkinManager applies styles for all Microsoft controls and Syncfusion Tools and shared controls. GridCell is a ContentControl which loads TextBlock as its Content. Even though if you set Foreground to GridCell, Still the TextBlock will load with the style applied via SkinManager. We can overcome this problem by writing style for TextBlock as in the following code example and refer to the modified sample in the mentioned location
Code-Example

<Window. Resources>

        <Style x:Key="gridRowBet" TargetType="sfgrid:VirtualizingCellsControl">

            <Style.Triggers>

                <DataTrigger Binding="{Binding HasBet}" Value="True">

                    <Setter Property="Background" Value="Green"/>                   

                </DataTrigger>

            </Style.Triggers>

            <Style.Resources>

                <Style TargetType="{x:Type TextBlock}">

                    <Setter Property="Foreground" Value="White" />

                </Style>

            </Style.Resources>

        </Style>


        <Style x:Key="gridCellBet" TargetType="syncfusion:GridCell">

            <Style.Triggers>

                <DataTrigger Binding="{Binding HasBet}" Value="True">

                    <Setter Property="Background" Value="Green"/>                   

                    <Setter Property="FontWeight" Value="ExtraBold" />

                </DataTrigger>

            </Style.Triggers>

            <Style.Resources>

                <Style TargetType="{x:Type TextBlock}">

                    <Setter Property="Foreground" Value="White" />

                </Style>

            </Style.Resources>

        </Style>
</Window.Resources>


Sample-Link: http://www.syncfusion.com/downloads/support/forum/120151/ze/SXTippster_example_background767644525
Regards,
Ganeshkumar



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.

;