Custom Combo box height issue in Silverlight - c#

In my Custom control, i have issue with drop down menu height. If Combo box items are more, I want scroll mouse many times because of small height of Drop down menu. I want to increase the height of Drop down menu.
FYI - I have generate Custom Control using Generic.xaml file and behavior's of the control are defined in TextBox.cs file (inherited from the Text Box Class).
Thank You..!!

You can use the MaxDropDownHeight Property of your ComboBox to set the desired maximum height you want for it, when unfolded that is.

Related

How to extend ComboBox to allow an overlayed button

I need to create a combo box with an overlayed button like the one in the Toolbox panel of Visual Studio:
I created a control derived from System.Windows.Forms.UserControl with a PictureBox onto a System.Windows.Forms.ComboBox.
The problem is that when the text is too long, it starts scrolling after the PictureBox, going under it. I tried setting the MaxLength property of the ComboBox appropriately, but in this way the user would be limited in the number of characters he could enter because the text doesn't scroll.
What can I do to achieve the desired functionality?

How do you make buttons re sizable at run time?

I want to make it so that my buttons change size based on the text inside them. Kind of like a Label with it's height and width set to "Auto", but I would like to start with a pre-determined dimension.
Is there a way to place a button, size it, and allow for re-sizing based on run-time text changes? If so, how do I do this?
I've looked at this example:
http://social.msdn.microsoft.com/Forums/vstudio/en-US/188c196e-90d8-4584-bc62-38d7e008cf5c/how-do-i-resize-button-text-upon-button-resize
It has to do with inserting a textblock on top of the button, but when the text adjusts sometimes the new text becomes too small because the text does not wrap for some reason...
Thank you.
You can set the MinWidth and MinHeight properties so that you start with a predetermined size and the button will be able to grow with text.
Unfortunately this would not allow the button to get smaller.
You will need to size it based on its content, then. That is, have no XAML defined size.
Elements on the page normally size themselves to their children.

How to center vertically items on Toolstrip (Flow mode)?

In my Winforms application I have a toolbar that contains many items (buttons with icon 32px, labels and comboboxes).
I decided to set the Toolstrip.LayoutStyle property from the default HorizontalStackWithOverflow to Flow in order to allow the toolbar split automatically on more rows when user have a very low resolution monitor or he/she resize the window.
The problem is that all labels and comboboxes are aligned to the top of Toolstrip when I change the LayoutStyle.
Does exist a property or any other workaround that allow me to center them vertically?
I think I see what you mean, the label isn't as tall as, say, a button. And it gets aligned improperly with LayoutStyle = Flow. Ugh. You can work around it by changing the Padding property of the label. To do this properly, you should however do this in the form's OnLoad() method override, the label will be taller when you run on a machine with a higher video DPI setting.

width of the dropdown arrow

So in winforms, every dropdown combobox has this little arrow thingy to the right that tells the user it's a dropdown, kinda like this:
Now how do I figure out how wide that is in pixels? Reason is, I'm using ControlDrawToBitmap, this doesn't draw the text properly for the combo boxes, and I can redraw the contents, I just whack some of the arrows (which are drawn properly).
First idea that comes to mind: Check to see if the combobox button width tracks with the scrollbar width. The scrollbar width can be modified in user preferences. Use GetSystemMetrics() API to get the width of the various scrollbar pieces. If you change your system scrollbar width and it does not affect the size of a normal combobox, then ignore this.
Second idea: use the edit control's formatting rect to find out what the edit control thinks is the usable display area (minus the combo box). See EM_GETRECT in MSDN.
However, it sounds like this is just a hack workaround for your real problem: If you could get the controls to draw correctly to bitmap, then you wouldn't need this hackery.
I calculated it to be 9 pixels wide in photoshop

Manage layout of a list of controls that change in size

I'm displaying a number of controls (all the same custom type) that can change their height in response to user input. The controls are being placed on a panel that's configured to automatically create a scrollbar if needed. The controls are arranged as a single column list.
What's the best way to reposition them when something changes in height? Can I set something in the designer to do this automatically, or will I have to manually move all controls below the one that's size changes manually?
I suspect using a FlowLayoutPanel instead of a regular panel and refreshing after the child control changes height should do the trick.

Categories

Resources