RadDataGrid Access Programmatically

10 posts, 0 answers
  1. Silviu
    Silviu avatar
    50 posts
    Member since:
    Feb 2015

    Posted 10 Aug 2015 Link to this post

    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?

  2. Silviu
    Silviu avatar
    50 posts
    Member since:
    Feb 2015

    Posted 10 Aug 2015 in reply to Silviu Link to this post

    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?

  3. Ivaylo Gergov
    Admin
    Ivaylo Gergov avatar
    661 posts

    Posted 13 Aug 2015 Link to this post

    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
  4. Silviu
    Silviu avatar
    50 posts
    Member since:
    Feb 2015

    Posted 14 Aug 2015 Link to this post

    Hi Ivaylo,

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

  5. Ivaylo Gergov
    Admin
    Ivaylo Gergov avatar
    661 posts

    Posted 18 Aug 2015 Link to this post

    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
  6. Silviu
    Silviu avatar
    50 posts
    Member since:
    Feb 2015

    Posted 18 Aug 2015 in reply to Ivaylo Gergov Link to this post

    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.

  7. Silviu
    Silviu avatar
    50 posts
    Member since:
    Feb 2015

    Posted 18 Aug 2015 in reply to Silviu Link to this post

    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
  8. Rosy Topchiyska
    Admin
    Rosy Topchiyska avatar
    550 posts

    Posted 21 Aug 2015 Link to this post

    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
  9. Silviu
    Silviu avatar
    50 posts
    Member since:
    Feb 2015

    Posted 24 Aug 2015 in reply to Rosy Topchiyska Link to this post

    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

  10. Rosy Topchiyska
    Admin
    Rosy Topchiyska avatar
    550 posts

    Posted 27 Aug 2015 Link to this post

    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
Back to Top