none
Why does VSTO have a Drop Down box and a Combo Box when neither of them are much use at all? RRS feed

  • Question

  • Just wondering... and what's wrong with them:

    Combo Box - well this looks okay, until you realise you can't make it into a simple combo box, so there is no way to prevent users from typing whatever they like into it.

    Drop Down - so the moment of realisation, there isn't an option on Combo Box to make it behave like a Drop Down Combo Box, nope, there's a new control just for this... and it doesn't work like a standard .NET control, no Text property.  If you want to assign values then you have three options:

    - set them in the designer - this doesn't work - just comes up with lots of missing object reference errors;
    - set them in code - this is hideous!  You have to create a new RibbonDropDownItem object for each item and set the Label property to the Text value you want... why!!??
    - bind them - well at least this seems to work, shame I never bind my controls.

    Why couldn't we just have a Combo Box, like the standard Combo Box that just works nicely - is this because Excel doesn't support combo boxes properly?

    Thursday, September 29, 2011 4:34 PM

Answers

  • Hi Diksta

    <<Oh, and it turns out my problem with setting the items was some sort of corruption in my project.>>

    Ah. Thank you for mentioning that. If it's happened once, it will happen again...

    <<However, even this is weird as it doesn't function anything like a normal Combo Box where you just type a list of items, one per line.>>

    Mmm, yes, the problem is that the VSTO tool has to "wrap things up" in a special way in order to pass them across the interface as valid Ribbon XML, along with any/all possible attributes available for the "item element" in a list for a Ribbon XML combobox. Very different, under the covers, from a .NET control.

    <<Seriously though, is there any chance that this might be improved upon in a future version of Office/ VSTO?>>

    Any change would have to come from the Office side, and it would have to be an extension of or addition to the current concept (backwards compatibility - you can't break the thousands of Ribbons already in use). It's very difficult to deposit "wishes" or "complaints" for something like that. If you (or any of your compatriots with who you're in contact) is in a special kind of "partner" program with Microsoft, that might be the best conduit to deposit such a concern.


    Cindy Meister, VSTO/Word MVP
    • Marked as answer by Diksta Friday, September 30, 2011 8:54 AM
    Friday, September 30, 2011 6:46 AM
    Moderator

All replies

  • Hi Diksta

    I think you need to tell us where you're finding these controls and how you're trying to use them.

    VSTO uses standard WinForms controls, usually placed in a UserControl.

    You seem to be talking about the Ribbon? this isn't part of VSTO, this comes from Office. VSTO can only work with what Office provides.

    Actually, what Office provides is Ribbon XML: you have to type out the XML then type out the callbacks to do any dynamic work. VSTO "wraps" some of the more standard functionality in the Designer, which is much more comfortable to use for most .NET Developers. But the controls are not .NET controls.

    the Ribbon does not provide any extensibility that allows someone (including VSTO) to create their own controls.

    I can't recall ever having any problems setting the items for a dropdown or combo in the Designer. How did you try doing this, exactly? I click on the little "..." button next to the text Collection in the Properties window and "Add" each item. Runs with no problems.


    Cindy Meister, VSTO/Word MVP
    Thursday, September 29, 2011 5:14 PM
    Moderator
  • Hi Cindy,

    I was hoping you might answer this!

    Yes, my title is misleading - I am talking about the Ribbon of course.  The standard WinForms controls work great and I am more than happy with this part of VSTO.  However, the Office bit does seem weird with two similar controls that are most definitely NOT like anything in .NET.  I know this is just VSTO exposing what is available in Office and there isn't anything I can do about it.  This is why I am whining... sorry!

    I guess I can get by with what is there but me and a few other developers were discussing this today and the general consensus was that this is one of the worst parts of developing a UI using the Office Ribbon.

    Oh, and it turns out my problem with setting the items was some sort of corruption in my project.  I fixed this and now I CAN use the elipsis to add items.  However, even this is weird as it doesn't function anything like a normal Combo Box where you just type a list of items, one per line.

    Seriously though, is there any chance that this might be improved upon in a future version of Office/ VSTO?

     

     

    Thursday, September 29, 2011 5:33 PM
  • Hi Diksta

    <<Oh, and it turns out my problem with setting the items was some sort of corruption in my project.>>

    Ah. Thank you for mentioning that. If it's happened once, it will happen again...

    <<However, even this is weird as it doesn't function anything like a normal Combo Box where you just type a list of items, one per line.>>

    Mmm, yes, the problem is that the VSTO tool has to "wrap things up" in a special way in order to pass them across the interface as valid Ribbon XML, along with any/all possible attributes available for the "item element" in a list for a Ribbon XML combobox. Very different, under the covers, from a .NET control.

    <<Seriously though, is there any chance that this might be improved upon in a future version of Office/ VSTO?>>

    Any change would have to come from the Office side, and it would have to be an extension of or addition to the current concept (backwards compatibility - you can't break the thousands of Ribbons already in use). It's very difficult to deposit "wishes" or "complaints" for something like that. If you (or any of your compatriots with who you're in contact) is in a special kind of "partner" program with Microsoft, that might be the best conduit to deposit such a concern.


    Cindy Meister, VSTO/Word MVP
    • Marked as answer by Diksta Friday, September 30, 2011 8:54 AM
    Friday, September 30, 2011 6:46 AM
    Moderator