Hi All,
How to highlight the XamGrid row programmaticaly (through c# code) ?
Regards
Sufyan
Please keep in mind i am using MVVM. Please help me with sample application.
Hello Sufyan,
Thank you for your post. I have been looking into it and I created a sample project with the functionality you want. Basically I have a bool Property in the ViewModel called IsHighlighted and by using DataTrigger in the CellControl’s Style I set the Background of the Cells which Row’s object has this Property set to true. You can just edit the column in the Grid to see how the functionality works. You can also hide IsHighlighted Column from the Grid if you want. Please let me know if this helps you or you need further assistance on this matter.
Looking forward for your reply.
I have been looking into your post and I can say that when you change the DataSource of the Grid you are able to save the ActiveItem as MyActiveItem Property, but when you set a new DataSource if it doesn’t contain MyActiveItem you are not able to set it as XamGrid’s ActiveItem. You are able to do so only if the datasource contains the very same instance. A possible solution is to set MyActiveItem to an item from the newly added collection based on the previously saved item.
Hope this helps you.
Hello Stefan,
Not understand exactly, it is possible to prepare a solution for me i really very appreciate for this favor.
Regards,
I have modified the sample I sent you before, so now it works as you want.
I am looking your previous sample. First time when the page is loaded Grid display the records i select the row from grid to modify and press click button here not opened the other user control for modification assume through user control we modify that record and after modification we assign the collection again to grid, before the button clicked DataContext have the MyActiveItem property and Grid Data collection. When i press the button "this.DataContext = Data.GetData(10, 0, 10); " this will again assign the data to DataConext but grid not shown that records and after that i do not have MyActiveItem property, only Data collection is here but not display that records in grid. Please look into it, How can i assign the data again to grid and where i set the MyActiveItem property ?
The GetData method that I used generates random objects every time it is called, so when you set the DataContext to it the objects are new and the MyActiveItem Property is set to its default value. The approach I gave you is just a guidance, which you can use as basis to achieve the functionality you want. Also you if you need to implement any custom scenarios, as the ability to rotate the 3D chart, you can contact our Consulting Team. You can read more detailed information regarding this here in our web site:
http://ko.infragistics.com/consulting/