I am getting up to speed on the new Microsoft Ribbon for WPF. I am creating a Ribbon with a Quick Access Toolbar. I have six items in the QAT--I'd like to show four of them and put the other two in the overflow button. At this point, all six buttons are showing, with no overflow button. How do I set the number of visible QuickAccess buttons? Thanks for your help.
As per current development is concerned, I think IsOverflowItem is Readonly. So you dont have the ability to specify for the item to be Overflown or not. It depends totally on how much space you have for the buttons. If you resize the window a bit smaller, you might eventually see the buttons being automatically populated in the menu as the menu will be dynamically created.
So based on the current implementation, you can only specify
<ribbon:RibbonQuickAccessToolBar IsOverflowOpen="True">
to make sure that the QuickAccessToolbar overflows when there is no room for the button.
I wrote an article on Ribbon Control which might help you a bit. Take a look
http://www.abhisheksur.com/2010/08/introducing-ribbon-ui-control-for-wpf.html
Thanks.
Related
I'm making a custom dropdown button (since the one included in wpf requires too much hacking to style right). Now that i got the button bit out of the way i need to add the drop down part.
My first thought was to add a stackpanel and use that to contain the items but it gets cut off if it leaves the borders of the grid that the button is in. Next up was the popup primitive, it gets on top of everything nicely enough but position wise it just free floats and i haven't figured out how to make it follow the button it was spawned by. I also tried using contextmenu but that seems to have no positioning controls at all and just sits where the mouse made it..
Anyways wpf is a big package and I'm just getting into it, anybody know which direction i might find what I'm looking for?
Preferred approach normally is to use a Popup. You got two very important properties with a Popup
PlacementTarget and Placement
Setup a binding for PlacementTarget on the Popup to your custom Button and then use Placement to position the Popup accordingly w.r.t to the PlacementTarget(Button)
Placement accepts an enum of type PlacementMode which gives you quite a few options to position the Popup.
I have implemented the Microsoft WPF Ribbon in a WPF browser .NET application.
It is a pretty simply layout with tabs, groups and buttons in the groups. There are however a LOT of groups and buttons and users are having a tough time using the Ribbon on smaller displays. Some of the groups convert the buttons to small image buttons with no text which the users don't like. They have to hover over each button to see it's purpose.
Other groups collapse completely and change to drop down buttons. This they want as standard. Each group to be represented as a drop down button by default and when clicking on it a list of the items as menu items.
To get an idea of what I am after, you can simply reduce the window size until the groups collapse to this drop down effect with menu items.
Can someone help?
The buttons are bound to the ribbon dynamically as are the tabs and groups.
Is there a reason the RibbonMenuButton doesn't suffice?
<r:RibbonMenuButton
Label="Clicking"
SmallImageSource=".."
LargeImageSource="..">
<r:RibbonMenuItem
Header="Click Me 1"
ImageSource=".."/>
<r:RibbonMenuItem
Header="Click Me 2"
ImageSource=".."/>
<r:RibbonMenuItem
Header="Click Me 3"
ImageSource=".."/>
<r:RibbonMenuItem
Header="Click Me 4"
ImageSource=".."/>
</r:RibbonMenuButton>
I think your problem might not be technical, but rather conceptual.
If you take a look at Microsoft's guidelines on ribbons, you'll notice that ribbons are not necessarily the best choice if you have too many commands:
Is there a large number of commands? Would using a ribbon require more than seven core tabs? Would users constantly have to change tabs to perform common tasks? If so, using toolbars (which don't require changing tabs) and palette windows (which may require changing tabs, but there can be several open at a time) might be a more efficient choice.
Maybe you should consider splitting your command groups on several tabs, grouping them logically so that actions that take place together often remain together, while actions that seldom take place together are on separate tabs. For example, changing page size and margins would remain together, while changing font size would go on a separate tab.
You can also consider using contextual tabs that will only appear under certain conditions, and therefore will only show commands related to what the user is doing at the moment.
You can control which buttons are displayed in a RibbonBar when they have been resized (internally by the bar). You can use the RibbonGroup.GroupSizeDefinitions and RibbonTab.GroupSizeReductionOrder properties to define how each RibbonGroup should be displayed. See this Ribbon Layout and Resizing page on MSDN for more information.
Our app has a tab control that shows a variable number of tabs. Most of the time, there are a handful of tabs, and the "tabbed" metaphor is simple and easy to use.
But on rare occasions (when working with certain types of data), we might need many more tabs than will fit across the screen. When that happens, the trusty tab control is no longer a good user experience. Whether you do multiple rows of tabs, or the little scroll buttons, finding the tab you want becomes a huge headache.
Visual Studio's editor can handle this situation with relative grace. It only shows a limited number of tabs at a time (however many will fit across the screen); and if you want something that's not currently visible, there's a dropdown button that shows the complete list. Are there any third-party WinForms tab controls that offer similar functionality -- a few tabs at a time, plus a dropdown?
There will actually be times when even the dropdown list would be too long to fit on the screen, so it would be helpful to know how any tab controls deal with that. A scrollbar (where you can drag the thumb quickly to the right neighborhood) would be great; so would incremental searching using the keyboard.
For purposes of this question, assume that replacing the tabs with some other UI metaphor (e.g. a listbox down the left side) is not an option. (We are exploring that, but that's not what this question is about.)
Telerik have a commercial Winforms control library which has a control called RadPageView. This can behave similar to what you describe when in StripView mode. The library is costly just for this one control though.
DevExpress also have one as part of their XtraEditors library called XtraTabControl. This has an "Additional paint style emulating the Visual Studio 2005 tabbed interface", although there are no screen shots of what that looks like. There is a screen shot on this page, although it doesn't look like what you require.
Infragistics has a WinTab control that can be customized to do this. If you set ShowTabListButton to True, you get the dropdown button that shows a list of all the tabs; and if you set ScrollButtons to None and ShowPartialTab to False, it will only show as many tabs as will fit.
It's also very performant -- I can add 750 tabs in less than a second (as opposed to 6 seconds for the standard WinForms TabControl, and 43 seconds for the DevExpress XtraTabControl). It even supports content that's shared across all the pages, which happens to be something our app needs.
The only downside is, when you click the "tab list" dropdown, it shows the list in a dropdown menu. This menu doesn't support incremental searching with the keyboard; and if the menu is taller than will fit on the screen, there's no way to scroll quickly -- you just get "scroll up" and "scroll down" buttons, which scroll painfully slowly. So when the list is longer than will fit on the screen, this dropdown menu is just as unusable as scrolling horizontally through a long list of tabs.
On the other hand, there's a SpaceAfterTabs property, which lets you leave blank space to the right of the last tab. It would be possible to put a combo box, or some other sort of dropdown control, in that blank space, and roll your own, better-behaved overflow "menu".
i am trying to create a wpf app and have different parts in user controls.
in the navigation i have some buttons (now using the ribbon ctp). is it possible to change the main user control when different buttons are pressed in xaml. or is this just a bad way to do things?
sorry, really new to xaml and im trying to get my head arround it.
Further to what Carlo has said,
The way we do it is to have a blank grid in the place you want your controls to all appear and then use BlankGrid.Children.Clear() and BlankGrid.Children.Add() to set up which control is visible in this position.
We found that was the nicest programatically as we have a large number of custom controls, but Carlo's method would work nicely if you wanted to use the designer.
I think this is a pretty regular procedure in WPF. In my experience, me and other programmers put the controls where we want to show them and make their visibility hidden, collapsed or visible depending on what we want to show the user.
The problem is fairly simple, but is best illustrated visually. Note that all screen shots are from the Visual Studio 2005 design surface. I've noticed no difference when I actually run the application.
Here is my user control (let's call this UC-1):
The buttons on the control are set to anchor to Bottom + Right.
Here is what it looks like when placed onto a particular parent user control (UC-A):
Please disregard the difference in colors and such. Some styling is done in the user control's constructor.
Notice the bottom of the control is getting clipped. The instance of the consumed control on the parent is set with a "FixedSingle" border. Notice also that the consumed control is taller than the original, indicating that the buttons bottom anchor settings are being respected, but are essentially overshooting where it should be.
To confirm this is definitely a problem on the parent control, notice another user control (UC-2) containing a data grid view when placed on the same parent:
Again, the instance of the consumed control is set with a "FixedSingle" border which helps illustrate the clipping. The datagrid is properly anchored to the Bottom Right. To reinforce the perplexity of this problem, here's the first user control (UC-1) when placed on a different parent user control (UC-B):
alt text http://i38.tinypic.com/2rnyjd0.png
Here's the second "consumed" control (UC-2) when consumed by a form:
Notice, no clipping this time.
I have spent many hours searching and experimenting to resolve this. I have exhausted the various settings of margins, padding, sizes (min/max), locations, anchors... etc. I can not for the life of me figure out why this one user control is causing child user controls to clip like this.
Another strange thing I noticed was that when I do an UNDO on the parent user control design surface (where the controls are misbehaving), the clipped user control instances actually shift location even though the undo action is unrelated to those controls. For example, if I make the main containing control larger, then undo, a couple of the child user controls jump up. They appear to move about as far as they are being clipped. Very suspicious.
Does anyone have any idea what is going on??
A very interesting problem!
Does your problem parent (UC-A) override any of the methods around sizing or client areas?
Or has UC-A got a negative value for the bottom value of Padding or Margin ?
Is there anything else docked at the bottom edge of UC-A? Perhaps, something that has a negative size?
Or, does UC-A set the constraints of its child controls? If the minimum height of the panel is forced too large, you would get this result.
Hope this is helpful! If not, is there any chance you post the source to UC-A ?
I was having the exact same problem and found your post while searching for a possible solution. Although I'm pretty sure that this is a bug in winforms, I found a bit of a workaround. Just put everything in your user control inside a panel, dock the panel to full, and do your anchoring inside the panel. This seems to alleviate the problem, although my button does tend up to show up at a slightly different size than it should in the parent control. Very weird. I compensated by making the button smaller in the designer, and it stretches wider by a few pixels in the parent control for some unknown reason. Hope this helps.
Assuming the parent control in question is not a standard .NET framework type, but a custom one, I'd guess that it is mixing up client and screen co-ordinates somewhere in it's logic. But that's just a guess.