Enabling word wrap and encapsulating a bulletgraph in programatically created RadButton

2 posts, 0 answers
  1. Peter Litsegård
    Peter Litsegård avatar
    1 posts
    Member since:
    Oct 2009

    Posted 04 Apr 2013 Link to this post

    Hi!

    I have a WPF application where I create RadButtons on the fly programatically. The content is set to a text. Is it possible to make this text wrap within the boundaries of the button? Furthermore I'd like to be able to include a BulletGraph together with the text, thus being able to give the user a graphical feedback as of the progress of the work being done in the area to which the button is connected. By pressing a given button the user is taken to another screen within the application where they're able to perform activities and the amount of work that has been done should be visually displayed on the button when the user goes back to the "button screen". I thought the BulletGraph would be a great way of displaying this progress.

    In other words:

    1. Is it possible to allow word-wrap for the RadButton.Content property when the content is text?
    2. Is it possible to programatically populate a programatically created RadButton with a RadBulletGraph together with text?

    Hmmm, hope this makes sense...:)

    Cheers
  2. Pavel R. Pavlov
    Admin
    Pavel R. Pavlov avatar
    1183 posts

    Posted 09 Apr 2013 Link to this post

    Hi Peter,

    Yes, you can achieve your goal in code behind. You can create a StackPanel and add a TextBlock and a RadHorizontalBulletGraph control in its Children collection. Furthermore, you can set this StackPanel as content of the RadButton control. Finally, you can add this button to your "LayoutRoot" element.

    For your convenience I implemented this approach in the attached project. Please take a look at it and let me know if it works for you.

    All the best,
    Pavel R. Pavlov
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. UI for WPF is Visual Studio 2017 Ready
Back to Top