I am binding a custom class of items to the DataGrid and while the data is bound, for each row, I want to be able access the data in the individual cells and changes the colour/style of the cell based on the value of the cell.
Not sure where that is explained at http://www.telerik.com/help/windows-8-xaml/datagrid-propertiesandconfigurations.html as I was unable to find it.
Also when my data source gets bound to the DataGrid the columns are ordered in alphabetical order, how can I change the order they get displayed in?
9 Answers, 1 is accepted
The ordered part works fine if I create the columns first hand.
Another issue with the width of the DataGrid, is that I have the device display set to Auto and the RadDataGrid extends beyond the screen, making it scroll horizontally.
How can I wrap the text so that it extends the cells vertically instead of horizontally?
You can change the style of each cell depending on its value through the CellContentStyleSelector or CellDecorationStyleSelector properties of the column. Through this approach you can also change the TextWrapping of the DataGridTextColumn. For columns where you do not need selectors you can use the CellContentStyle property.
Please, let me know if this helps.
Regards,
Ivaylo Gergov
Telerik
Hi Ivaylo,
How may I access each cell or row of the RadDataGrid programmatically?
As each row of the RadDataGrid represents a business item, the only way to make changes is either through the supported EditMode, or through modifying the business item itself.
Please, let me know should you need further assistance.
Regards,
Ivaylo Gergov
Telerik
Hi Ivaylo. Yes I have done it through the business object.
One other query, how do I set these values in codebehind:
CellDecorationStyleSelector="{StaticResource BackgroundSelector}"
CellContentStyleSelector="{StaticResource ForegroundSelector}"
Not sure on the syntax, they work fine from XAML but I need them dynamically.
The width of the columns can not be changed via user interaction. All supported scenarios are listed in the referred documentation article.
Let us know if you have any other questions.
Regards,
Rosy Topchiyska
Telerik
Thanks Rosy.
Is there a way to set the width to auto so that the width of the grid can automatically be set based on whether the display is windows phone or desktop?
In the Windows 8 Universal API I believe this was an option but cannot find it for Win 10 Universal
Could you please provide some more information about your setup:
- Target platform
- Telerik controls suite + version
Please, note that the latest official release of UI for Windows Universal suite targets Windows Universal (Windows 8.1 + Windows Phone 8.1). Currently, our suite is not fully compatible with the new programming model (UWP). Our plan is to release version that targets Windows 10 in the end of September.
We have issued an early adopters program where you can subscribe to receive bits that targets UWP, just send an email to universalwindows@telerik.com. Not all controls available in UI for Windows Universal suite are available in the bits yet (including the RadDataGrid).
Telerik