ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

NumericTextBoxDouble MinWidth does not adjust spin button sizes

When MinHeight=23 I think the spin buttons are too small. If I change to MinHeight=25 the input box is increased in height but the spin buttons remain small.

 

Now I can solve this by setting Height=25, the spin buttons are then enlaged, but then the input box will not grow if the a larger font is used. I have also noticed that, if Height=Auto, a lager pont will enlage the spin buttons.

 

How can I have a NumericTextBoxDouble with automatically adjusted height but with buttons at least as large as when Height=25?

0 Kudos
Message 1 of 3
(5,462 Views)

I was able to reproduce the sizing behavior you are seeing, and have created a task to fix the issue. It appears the buttons only size correctly when height is specified explicitly.


As a workaround, here is a custom text box that automatically sets its height to the desired value:


    public class CustomTextBox : NumericTextBoxDouble {
        protected override Size MeasureOverride( Size constraint ) {
            Size desiredSize = base.MeasureOverride( new Size( double.PositiveInfinity, double.PositiveInfinity ) );

            double desiredHeight = Math.Ceiling( desiredSize.Height );
            if( Height != desiredHeight )
                Dispatcher.BeginInvoke( new Action<double>( v => Height = v ), desiredHeight );

            return desiredSize;
        }
    }


Note that this does not work with the minimum height, but will respond to changes in font size, and should improve the default sizing behavior.

~ Paul H
0 Kudos
Message 2 of 3
(5,450 Views)

Just wanted to let you know this issue (#478586) was fixed in the Measurement Studio 2015 release.

~ Paul H
0 Kudos
Message 3 of 3
(4,358 Views)