Customize expand/collapse button in NavBarGroup in Devexpress - c#

I have a NavBarControl which contains collection of NavBarGroups.
NavBarGroup have a header and container control. NavBarGroups can be collapsed/expanded.
The button to expand/collapse is on right side. By default it looks like double up/down arrow. I want to customize this button to change its look and feel to indicate collapsed/expanded state.
(using Devexpress in Windows Forms)

For future reference, the self-help and online support at DevExpress is exceptionally thorough, and they will answer questions like this for paid subscribers within 24 hours, usually with a code sample.
In this case there are two ways to achieve your goal (assuming you're on a relatively recent version of DevExpress) as described here.
The "right way" to do what you want is to make a custom skin with your own icons; you can use their skin editor to open your current skin, make changes, and save it. Nearly every aspect of the look & feel of their controls is skinned and you can make pretty significant changes to them.
Deploying custom skins isn't all that complex but it might be a bit overkill for the effect you're trying to achieve. The other option is to custom draw the group caption. There's a sample attached to that post that is a working example of doing so, but you basically implement the CustomDrawGroupCaption event and do your own painting, including whatever icons you want based on the group's state.

Related

How to make a Windows Form to change it height adaptively as controls get added/removed or hidden/shown?

What I need can probably be described as "reverse-anchor", "reverse-dock" or something like that (I have chosen to mention this just because "reverse-anchor" happened to be the first thing to come into my mind as a keyword candidate when searching for questions and answers that might already have been submitted discussing this subject, perhaps this will help people thinking a similar way to find this one in future). WinForms controls implement the Anchor property to set up adaptive resizing on containing control/form size change but I need the opposite - the form to resize adaptively to the controls.
A thing adding a minor bit of complexity to the task is that the controls meant to be added/removed/shown/hidden/enabled/disabled (and resized perhaps - this functionality is not really needed directly so far but I suspect it can turn to be required for compatibility with non-default Windows visual styles and themes that have potential to affect controls sizes unpredictably and can change at any moment of the app running) are not going to be the last ones on the form - a row of buttons will always be in between of the last control of the volatile group and the window lower border.
The actual task is to design a form that will display a collection of objects with a row of controls (a label, a text box and 0-2 buttons) corresponding each of them and it is strongly preferable to use just the very basic "common controls" avoiding grids, lists and stuff like that in this case (wrapping them in an additional container controls like panels is perfectly acceptable though, abstracting them in a separate "user control" can be considered too if this can really make the solution easier, more reliable or otherwise better, using hand-written code manipulating controls and form sizes is perfectly acceptable too (I can hardly expect a "set a magic property and it's done" kind of solution to exist for this task) but I haven't found a reliable algorithm so far (when to change what properties and what formulae to calculate new values with)).
The maximum capacity can be safely limited to something near 10 (or 20, perhaps, but not more - more would be just absolutely unreasonable to display on one form (provided scrolling is not an option)) so both ways are acceptable: to add/remove the controls in runtime or to put them on the form in the designer and just manipulate Visible and/or Enabled properties in the code. By the way I have found a problem with Visible - it gets switched off and back on by the framework internals before the form is rendered and other controls Anchor properties come in the game but I don't think it's a good idea to rely on this to happen always and the same way so just adjusting the form Size property on a control Visible property change does not feel really convenient).
What might be some good ideas relevant to implementing this behaviour?
PS: As far as I know this is a natural feature of WPF but I am to use WinForms to make the app runnable on Macs and, perhaps, other non-Windows platforms with help of Mono.
I'll tell you about some clues may help you:
1- correct to build your own Procedure for manipulating all the matter.
2- i advice to use a Wizard methodology (Next / Back buttons) so if the plate form is small like tablet or smart phone, so the mentioned procedure will decide how many Controls combinations (Label, text box, option button...) will be in each frame of that wizard and keep the remaining for Next button.
3- By the way if you will hide some controls use the original event fires to run the mentioned Procedure. (like a basic button to start the form so don't depend on visible / resize events).
4- Resize the size of each form of the wizard in the last part of the mentioned procedure.
If still a problem exists tell me and i hope i can help :-)

Difference between Panorama and Pivot Control

What is the difference between the winphone 7 Panorama and Pivot Controls? To me they seem very similar, apart from the slightly different visual appearance.
In which situations should one or the other be used?
There is a video on Channel 9 with Amy Alberts and Chad Roberts that talks about the differences between the Panorama and Pivot controls and when you should use each.
In my opinion, the Panorama control is for when you need to create a "hub"-type application (like the Games hub) that acts primarily as a jumping point and offers summary information for the rest of the application. The Pivot is used in much the same way that you would use a tab control on other platforms.
As said above, the Panorama control is really meant for rich Hub type look .. smooth multi-screen scrolling with Parallax effect, ideally including images in the views. The Pivot control is more for presenting slices of the related data to the user or categorizing the content .. the in-built emails & calendar are examples. Both controls are very suited for dynamic data-binding.
Jeff Blankenburg, one of the MSFT evangelists wrote two nice posts explaining their use:
http://www.jeffblankenburg.com/post/31-Days-of-Windows-Phone-7.aspx
Hope this helps!
I would use the Panorama control if the content of your application lends itself to being presented in a format where you think of the screen as being a window into a larger page...one that can loop back around to the beginning. Also, consider whether that content needs to support gestures, especially swipes, because those will cause conflicts between some action intended to take place in a control, for example a map with panning, and the "outer" Panorama control's behavior of scrolling.
I'm also reconsidering using the Pivot control. It has a more distinct division between sections of content than Panorama does and I like both the gesture swiping to switch between pivots and the animation. However, it has caused some tombstoning problems and with the advent of copy-and-paste there could be a conflict between the user trying to select content to copy and the triggering of the swipe gesture to switch pivots. Disabling the Pivot Control swipe gesture talks about a possible work-around, although I haven't tried it and see from the comments below that article that there may be some other issues.

C# Volume mixer like buttons/combo boxes

How would you get a button to look and perform similar to that of the buttons in the volume mixer on Win7?
What I mean is that in the volume mixer there are icons that doesn't look like buttons until you hover them, they also haven't got the standard blueish color when hovered.
So far I haven't found a way to do this directly in visual studio.
I'm guessing that creating a custom user control is the only way to go, but I've had no luck so far, I would appreciate some examples.
In addition, there are also combo boxes in the volume mixer I would like to duplicate. They're hidden except for the text and arrow until they're hovered.
Is there a way to accomplish this?
(Here an image that might help explain what I mean:
http://i53.tinypic.com/2ij409u.png)
For windows application, (and also how they did win7), they used the technology called WPF. I am not specifically answering how you can do this, because in WPF, this is the fundamental that defining skin (via markup called XAML) without touching the implementation code. If you are serious in learning how to do that, I suggest you look for tutorials or good book about WPF.
Here's one of the markup looks like for a button. To modify the button's look, what you need is to define it's XAML, and you don't have to inherit it in the code. The example looks scary long, but Visual Studio could help you.
You could use a third party control library, for example Krypton Toolkit, its free!
There is quite a terrific solution for this button quest. You can paste pictureBoxes on form and handle MouseUp, MouseLeft and MouseDown events. When each of them fires, you need to set specific image (one of tree, in fact) - normal picture, picture of "highlighted" icon and picture of pressed icon. But that's really a hard and useless work, so better don't.
If you need several of such "buttons" in a panel, I remember, I once managed to get the same behaviour by using toolStrip with buttons.

C# Winforms: Efficiently Displaying Many Controls

I'm building a control that comprises 15x15 = 225 buttons, and needs to be resizable. Because it's a grid, anchoring and docking won't work. I've tried both TableLayoutPanel as well as handling the resize event to manually place and size controls. In both cases, resizing is unacceptably slow. Suspend/Resume Layout in the resize function when I'm manually handling the layout doesn't help.
Is there something fundamental that I can change to speed things up, or is this just a limitation of the native controls? I understand I can build a custom control from scratch, handling the clicks and painting myself -- though I'd prefer to stick with the native controls if possible.
Edit
I know it's a lot of buttons. My question is a technical one; not one about UI design.
WinForms doesn't handle displaying this many controls at the same time unfortunately.
If I were in your situation I would first consider if I could split up the form in several pages. In many cases that would be easier to understand for the user as well.
But in your case that doesn't seem to be an option. Are you making something like a minesweeper style game? There you have a grid of buttons that all are clickable. In such a situation I would suggest you go for a custom owner drawn control where you consolidate all the buttons in one control. Don't build a composite control that contains 225 buttons - that won't help at all :-)
A final option could be to switch to WPF. WPF uses hardware accelerated rendering so it may be faster, but with so many controls not even that may help.

WPF - Content section control

I am new to WPF and am trying to find the right control.
I am coding a WPF app that has two sections. The left side is an Outlook like sidebar (Odyssey controls).
For everything else I want a control that I can easily swap the contents of based on what is in the side bar.
So the user selects an option in the side bar and all the controls in the main section would change.
If I was writing this in Windows Forms I could just create a few Panels and then show the one that is relevant (and hide the others). When I try this in WPF you can see the contents of the panel underneath. I know I could make them not visible, but I am getting the feeling that I may be going about this the wrong way.
So here is the question. What is the best way (in WPF) to handle content sections of the app to change.
Based on your example (switching what is shown based on what is selected in a side panel) I'd recommend restyling a TabControl because that's really tab switching even if it doesn't look like it. Check out this for a decent example, set TabStripPlacement to Left and you will have a good start.
Depending on how your data is set up a Master-Detail pattern might be another good choice.
If you want to switch everything programmatically you'll want to use a ContentPresenter and DataTemplates for the UI "panels". This article by Josh Smith is about MVVM but his example application is basically the pattern you'll be looking for.

Categories

Resources