This is a migrated thread and some comments may be shown as answers.

RadDataGrid Access Programmatically

9 Answers 66 Views
DataGrid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Silviu
Top achievements
Rank 1
Silviu asked on 10 Aug 2015, 11:05 AM

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

Sort by
0
Silviu
Top achievements
Rank 1
answered on 10 Aug 2015, 11:49 AM

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?

0
Ivaylo Gergov
Telerik team
answered on 13 Aug 2015, 07:41 AM
Hi Silviu,

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
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Silviu
Top achievements
Rank 1
answered on 14 Aug 2015, 10:36 AM

Hi Ivaylo,

 How may I access each cell or row of the RadDataGrid programmatically?

0
Ivaylo Gergov
Telerik team
answered on 18 Aug 2015, 09:07 AM
Hi Silviu,

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
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Silviu
Top achievements
Rank 1
answered on 18 Aug 2015, 12:23 PM

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.

0
Silviu
Top achievements
Rank 1
answered on 18 Aug 2015, 02:59 PM
Does the RadDataGrid have any options for the user to resize the columns by dragging them? I haven't been able to find anything at http://docs.telerik.com/windows-universal/controls/raddatagrid/columns/how-to/datagrid-howto-setcolumnswidthusingsizemode
0
Rosy Topchiyska
Telerik team
answered on 21 Aug 2015, 11:12 AM
Hello Silviu,

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
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Silviu
Top achievements
Rank 1
answered on 24 Aug 2015, 05:22 PM

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

0
Rosy Topchiyska
Telerik team
answered on 27 Aug 2015, 12:20 PM
Hello Silviu,

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).

Regards, Rosy Topchiyska
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
DataGrid
Asked by
Silviu
Top achievements
Rank 1
Answers by
Silviu
Top achievements
Rank 1
Ivaylo Gergov
Telerik team
Rosy Topchiyska
Telerik team
Share this question
or