Is there a standard .NET control for what I call "a two pane picker", or do I have to code it by hand?
Two pane picker:
The left pane has a list of items.
The user can pick items from the left pane to put them in the right pane using buttons between the two panes.
Picked items in the right pane can be reordered with buttons.
An example of the "two pane picker" can be found by right clicking the Quick Access toolbar in Word 2007 and clicking "Customize Quick Access Toolbar..."
Note: If applicable, VB.NET answers preferred, but C# answers are acceptable too.
There's no standard control for that. Sounds like an excellent case for a custom user/composite control.
There are no .NET Framework controls which create the functionality you describe, however it is fairly easy to implement. Here's some examples I was able to find (not tested):
https://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=1253&lngWId=10
http://www.dotnetspider.com/resources/18324-Content-Transfer-between-Two-listboxes.aspx
http://social.msdn.microsoft.com/Forums/en-US/vbgeneral/thread/2082caa0-5ece-4ad8-8077-8c7170fa6f9f
There is no standard picker. You have to build it yourself or find a third party control.
I don't know of anything like that, but its trivial to implement with two ListBoxes and some buttons. When 'Add' is clicked, do .Remove with the item at the selectedIndex from the left and .Add it to the ListBox on the right.
Related
I want to add a custom menu item to the menu that appears when a user selects some text and right clicks. I searched a lot but did not get any answer. Maybe I did not put in the right keyword.
Is it possible to do this?
If this is possible, I want to do this for all applications in windows whenever the user selects text. Is there a universal way to do it or will have to write code specific to the application?
I am using C#.
I don't think you can do that universally in all windows apps. But it is certainly possible to do in your own app using a popup menu.
I've also tried a way to add an item to the standard ContextMenu and failed. From my point of view, the only solution is to set the TextBox's ContextMenuStrip property to an instance of the ContextMenuStrip class and implement both standard and your custom menu items. It is easy to mimic standard operation, since the TextBox class provides all required methods: Cut, Copy, Paste, SelectAll.
The universal way is basically writing a "custom shell extension".
There is an article on CodeProject about how to do this.
http://www.codeproject.com/Articles/174369/How-to-Write-Windows-Shell-Extension-with-NET-Lang
The other way to do this is to build this into your application. For example you might have a text editor and you'll want to highlight a word and get a definition for that word. To do this you'll need to implement a context menu.
The VERY BASIC concept is detailed over on CodeReview.StackExchange.
https://codereview.stackexchange.com/questions/3983/c-programatically-creating-context-menu
I'm programming an application in WPF using the Ribbon menu, part of the requirements for the application is that I need a commands tab, but this tab should be visible at all times and depending on the active document I would enable/disable the appropriate commands.
My question is, does anyone know a way to split the ribbon menu so that the commands tab is always visible on the right side of the menu?
I'm sure there's an easy answer for this, I just haven't found it yet.
Thanks & Regards!
It's not within the functionality of the ribbon. Why not build a grid with 2 columns, and have the ribbon in the left pane and the custom control on the right? Then you can just style the custom control to match the ribbon.
You can get the source code for the ribbon from CodePlex so you would be able to get the exact style.
It might not be what you wanted to hear, but I think it would be ideal.
I'm looking to have a Windows Forms toolbar overflow its buttons onto a second toolbar another level down rather than having the dropdown menu. We find that it is not obvious to our users that they need to click the dropdown to see more tools. Suggestions?
Break your toolbar up into several smaller toolbars, like how MS Office does it. This way you can arrange them on as many rows as you like.
If breaking this into multiple toolbars will not provide the user experience that you want (although it is clearly the best practice), I believe you can listen to the Resize event, and then move all items from the Items collection that have IsOnOverflow set to true to a second tool strip.
I am trying to create a panel which will have a set of "buttons" on it.
These buttons should have the following behaviour:
Appear similar to a tag (with
rounded edges)
Contain a red
cross to remove the filter/tag from
the panel, similar to the way internet
explorer tabs have an embedded cross to close the individual tab.
allow the user to click
on the tag and respond like a normal
button (as long as the click is not
in the red cross)
Number 1 is no problem, this is just appearance, however, regarding numbers 2 and 3, I am not sure if there is already code out there do to something similar...and I dont really want to reinvent the wheel if I can avoid it!
My question is: Does anyone know if there is something out there in infragistics which will do this simply, or will I need to write this myself by subclassing winform buttons?
Thanks in advance!
Is this new development or maintenance of an existing project?
If it is maintenance, you have a somewhat tougher time ahead. You'll implement a UserControl, probably segmented into two buttons. Use docking to get the behavior as correct as possible. The far right button would contain your cross image; the left (which would need to auto-expand as you resize the control) would contain your primary button behavior. Play with the visual styles until you get them right (EG, removing borders, etc).
If this is new development, and you haven't gotten too far into it, you might consider using Windows Presentation Framework (WPF) instead of WinForms. It will be easier to build the control and get it to look exactly how you want it. WPF includes an extremely powerful control compositing system which allows you to layer multiple controls on top of each other and have them work exactly as you'd expect, and it carries the added advantage of allowing full visual control out-of-the-box.
Either way, this is more work than dropping in an external component ... I've used Infragistics for years, and I can't think of anything they have which is comparable. The closest, but only if you're building an MDI application and these controls are for window navigation, is the Tabbed MDI window management tools -- and there, only the tabs (which replace window title bars) have this behavior.
I don't think that infragistics can do something like this. The UltraButton control can't.
Implementing a own control wouldn't be that hard.
your probably going to have to make a costume control for this type of work.
Has anybody got any suggestions for a custom tabcontrol implemented in C# and which adheres to these criteria:
Allows the tabs to be placed along the side of the control.
Tab text must read horizontally.
Allow custom colouring.
Open source or no cost.
I prefer not to get my hands dirty with ownerdrawing if a solution already exists.
You probably don't have a need for this anymore but anyone else who stumbles upon it might find it useful.
I found this tabcontrol on CodeProject it is also very easy to Draw your own tabs with it, they even give you a example on the site.
Y(et)A(nother)TabControl
A couple more tab controls.
TabStrip Control
TabStrips: A TabControl in the Visual Studio 2005 way!
The tab control in WPF fulfills all of your requirements. You can override the template and go to town on it.