Hi Team,
I am using Visual Studio 2019 and Infragistic Ultimate WPF version 20.2.16.
I am creating a simple application where I have two textbox,button and XamGrid on my page. When I press the button the data of two textbox added row in XamGrid.
I have few queries regarding the XamGrid.
Could you please provide with Example of above functionality in XamGrid.
Thanks in advance.
Dinesh
Hello Dinesh,
Thank you for contacting us. We recommend you using the xamDataGrid control instead of the xamGrid control. The xamGrid is almost retired and doesn't provide any more bug fixes.
You can refer to this online help document to understand the difference between the controls :
www.infragistics.com/.../differences-between-xamgrid-and-xamdatagrid
This article is a good point to start using XamDataGrid:
www.infragistics.com/.../xamdatagrid-getting-started-with-xamdatagrid
As for your questions regarding the alternate row colors and the selected row color as well as changing the values of the summaries once the cell values are changed I have prepared a small sample application using XamDataGrid that demonstrates how to achieve this.
In it I have created a style targeting the DataRecordCellArea. There are a few properties that are set with setters such as: BackgroundSelected, BackgroundActive, BackgroundHover, BackgroundAlternate and BorderThickness. With this style both of the requirements you stated above are met – Chnaging the Alternate Row color and the Selected Row color.
To apply RowSummeries, inside the FiledLayout, you need to include SummeryDefinitions and set the type of the summery with the SummeryCalculator, in the case of the sample I am attaching a summery for a Sum is added showing the total price of the “Price” field. Once the user changes the value of a certain cell inside the “Price” field the summary is automatically updated.
Please test the sample on your side and let me know if this is an accurate demonstration of what you are trying to achieve.
Regards, Ivan Kitanov
AlternateRowColorAndSummeries.zip
Hi Thank Ivan for Your replay.
First I tried XamDataGrid but face issue in change scrollbar style.
Could you please provide me example where style of scrollbar changed for XamDataGrid,
Thank You,
In order to add a custom style to Scrollbar of the XamDataGrid, what I can suggest you is to add a Style targeting the scrollbar inside the resources of the XamDataGrid. Inside this style there should be 2 triggers one for the Vertical orientation and one for the horizontal orientation of the scrollbar. Inside those triggers you can add setters for each property you wish to change in order to achieve your desired look. For example in the code below I am increasing the width of the Vertical and the height of the Horizontal scrollbars to 60 as well as changing the background color to LightBlue.
<Style TargetType="{x:Type ScrollBar}"> <Style.Triggers> <Trigger Property="Orientation" Value="Vertical"> <Setter Property="Width" Value="60"/> <Setter Property="Background" Value="LightBlue"/> </Trigger> <Trigger Property="Orientation" Value="Horizontal"> <Setter Property="Height" Value="60"/> <Setter Property="Background" Value="LightBlue"/> </Trigger> </Style.Triggers> </Style>
I am attaching the modified version of the sample that include the changes to the scrollbar stated above.
Please let me know if you have any questions.
Regards,Ivan Kitanov
AlternateRowColorAndSummeries - modified.zip
Thank You Ivan.
I’m glad that you found my suggestion helpful and managed to resolve your issue.
Thank you for using Infragistics!