Dynamic NumericButtonCount

4 posts, 0 answers
  1. Chad
    Chad avatar
    21 posts
    Member since:
    Aug 2013

    Posted 28 Nov 2015 Link to this post

    How can we make the NumericButtonCount adjust based on the width of the data pager? Using a constant value for the button count makes the control very awkward for use as most everything else is sized dynamically in a WPF application.

  2. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 03 Dec 2015 Link to this post

    Hi Chad,

    Please accept my apologies for the late reply.
    You can try to handle SizeChanged event of the pager and based on its width, to decide what NumericButtonCount should be. For example:
    private void OnPagerSizeChanged(object sender, SizeChangedEventArgs e)
        {
            var pager = sender as RadDataPager;
            pager.NumericButtonCount = e.NewSize.Width > 400 ? 6 : 2;
        }

    Will that approach meet your requirements ? 


    Regards,
    Maya
    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
  3. UI for WPF is Visual Studio 2017 Ready
  4. Chad
    Chad avatar
    21 posts
    Member since:
    Aug 2013

    Posted 04 Dec 2015 in reply to Maya Link to this post

    Hi Maya,

    The approach did cross my mind but then a flurry of alarm bells started ringing in my head :).

    As the buttons area is really the only variable size area we should really be able to have it change dynamically with the obvious maxwidth & container constraints. I'm a bit hesitant going the above root for various reasons unless you can provide me with an accurate way to determine button sizes after the various templates and styles have been applied.

    Where can I make a suggestion for an option to have the number of buttons determined dynamically?

     

    Regards,

      Chad

  5. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 08 Dec 2015 Link to this post

    Hello Chad,

    Thanks for the feedback. The thing is the value of NumericButtonCount property can be dynamically set, the size of the buttons can be different based on the theme used or a customization of the template and there is no straightforward and clean way to find buttons' size and calculate the desired count.
    Considering getting the buttons, you can work with ChildrenOfType<T> extension method and find them. Then you will be able to calculate their width.
     


    Regards,
    Maya
    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