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

Dynamic NumericButtonCount

3 Answers 72 Views
DataPager
This is a migrated thread and some comments may be shown as answers.
Chad
Top achievements
Rank 1
Chad asked on 28 Nov 2015, 11:37 PM

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.

3 Answers, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 03 Dec 2015, 08:20 AM
Hi Chad,

Please accept my apologies for the late reply.
You can try to handle SizeChanged event of the 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  


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
0
Chad
Top achievements
Rank 1
answered on 04 Dec 2015, 06:02 AM

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

0
Maya
Telerik team
answered on 08 Dec 2015, 04:29 PM
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
Tags
DataPager
Asked by
Chad
Top achievements
Rank 1
Answers by
Maya
Telerik team
Chad
Top achievements
Rank 1
Share this question
or