How to Create a Dockable Tab like IE9 or chrome - wpf

i want to implement a UI look like IE9 or chrome.
i like the dockable tab,it can be dragged out into a new window.
and the window can also be put into as a tab.
is anyone can give me an idea how to implement it, or a library,or an example?
thank you .
AvalonDock is very good, but not quite like I wanted.

There is no dock control that comes out of the box in WPF (which is a damn shame). You can have a look at Sofa Docking, which is an open-source docking library based on AvalonDock.
I'm using DevExpress' docking control (not free). It's not perfect, but their customer support is one of the best out there, and that's a very big thing to me. I found it very hard to find any resources and answers regarding AvalonDock and SofaDock.

You could look at the Infragistics xamDockManager:
http://www.infragistics.com/dotnet/netadvantage/wpf/xamdockmanager.aspx#Overview
If you do this, you would use a DocumentContentHost:
http://help.infragistics.com/NetAdvantage/WPF/Current/CLR4.0/?page=xamDockManager_Add_Panes_to_the_DocumentContentHost_Object.html
Then you would want to disable docking of the ContentPanes on the right, left, top and bottom and there is a boolean property that can be set to control this like AllowDockingLeft:
http://help.infragistics.com/NetAdvantage/WPF/Current/CLR4.0/?page=InfragisticsWPF4.DockManager.v11.2~Infragistics.Windows.DockManager.ContentPane~AllowDockingLeft.html

Shell
{
List<Content> Contents
}
Drag: use PopUp/adorn/visualbrush to create a content thumbnail.
Drop: if out of the parent shell, creat a new shell, and add the
drag-content to the Contents List.remove it from origin parent
shell.

Related

Custom Tooltip Formatting

I am working in plain old native C on Windows. No other platforms, no C++. (Yes, I'm a dinosaur.)
I am trying to find an example of what I think of as an "owner draw tooltip control" but that does not appear to exist. At least not for the standard Windows tooltip control. I have tried to search for a library or source that implements a custom tooltip control, but all I can find is things that extend controls in .NET (or in other environments that are not where I am working.)
My hope is to support markdown (or something like it) for the text in the tooltip window. Mostly, I want to clearly differentiate the title from the content, and have some limited formatting of the content (bold, italics, color, and columns, mostly.)
I don't expect a full solution here, I am just hoping that someone else has already found a solution and can point me to where they found it. Please?
Tooltips cannot be owner drawn, but they can be "custom drawn".
Custom drawn Win32 controls allow you to override the built-in drawing by receiving and responding to the NM_CUSTOMDRAW notification. You can read about custom draw here.
You can refer to the specific documentation on the tooltip control, see:
NM_CUSTOMDRAW (tooltip) notification code
Finally, here is a good tutorial demonstrating the whole thing in C.

How to put a close button in main window menu?

I'm looking to add a 'close' button to my main window's menu. An example can be found in the picture here: http://ifyoucodeittheywill.com/img/crimson-editor.png
(So, there's the normal close button in the window caption area, but, there's also a close button in the window's menu bar -- on the far right).
I'm using basic win32 API's, though an example using MFC would also be fine.
Does anyone know how to do this?
Thanks,
Andrew
These buttons usually come with MDI windows. However I'm pretty sure the depicted application uses either its own, or more probably some advanced third party toolkit. Because, to be honest, what the Windows API and MFC (which is just a classed wrapper around the windows API) give you for GUI programming is unbareably limited.
If you want to design neat UIs steer clear from MFC and better have a look at something like Qt, wxWidgets or the like.
A really simple way of doing this is to use a regular menu item, using AppendMenu, but use the following flags:
MF_BITMAP with a close button bitmap, or MF_OWNERDRAW or to draw it yourself
MF_HELP (aka WM_RIGHTJUSTIFY), a not-very-well documented flag, which will justify the item to the right.
Here's one reference to MF_HELP that I found on msdn - it's actually about using the Win32 API to right-justify a menu item, but using Visual Basic.
MF_HELP (defined in winuser.h) is something of a holdover from Win16 days, back then, the convention was to right-justify the Help menu item, so it would stand apart. It was 'renamed' - an additional #define added with the same value - to WM_RIGHTJUSTIFY around Win95.
Note that bitmap menu items aren't accessible (eg. to users that are relying on a screenreader to read out where they are on the screen); if taking this approach, then at least add a regular 'Close' menu item elsewhere in the menus (eg. under File), so that a user doesn't have to rely on this item, and can also close it through usual means. Also be sure to implement the Ctrl-F4 shortcut, which is what most applications that support multiple documents or tabs use to close the current item.
By all means do not try to create this behaviour yourself. This is functionality that you get "for free" if you are using the MDI architecture of MFC. The close button "next to the menu" as you call it closes the active MDI child window. If you are not using the MDI architecture then there is no point in trying to add a close button there. Can you explain if you are using the MDI architecture?

WPF: Custom window, standard min/max/close buttons

I would like to create a custom WPF window (WindowStyle = None, AllowsTransparency = True). However, I would like the min/max/close buttons to look identical to those on standard windows. Is this possible?
You might want to have a look at GlassWindow in FluidKit at CodePlex
http://fluidkit.codeplex.com/
The source code has a custom Window Style looking like this. It's pretty easy to modify to however you want it to look. I've used it once and it works good
You'll need to "draw" them yourself, since you're using WindowStyle=None. When choosing this option, you'll need to render your own Chrome as desired.

WinForms "mini-windows"

I need to create some mini-windows, like the ones shown in the image bellow, in my winform main form.
It would be nice if they could be draggable, resizable, and, mainly, closable.
How can I approach this design? Has anybody already seen some control (with code available) implementing something similar?
alt text http://img716.imageshack.us/img716/5765/imagea.png
A normal Form works fine for this. Set its FormBorderStyle to either FixedToolWindow or SizableToolWindow as desired.
If you want to keep your floating windows inside your main window, use MDI (Multiple Document Interface). Here is a tutorial (Google can find you many more).
Have you tried just setting the FormBorderStyle property to SizeableToolWindow?
Is that what you're after?
You can create them as resizable and draggable custom controls.
You could use my example at:
http://hourlyapps.blogspot.com/2008/07/resizable-and-movable-controls-c-net.html

WPF search windows - like tabPages in tab control

I have idea to implement my wpf windows like TabPages in tab control. It is possible to do that dynamically in c# code.
In Example i have Menu in main window. Some Menu items calls search type windows. Is it possible to do such a thing in C# code (SomeMenuItem_Click): this code adds new tab in tabControl of main window.
If there are no search windows called -there is no tab's shown, if there are many search windows called - there are many tab's.
So how do I code this?
And whats the technique with the windows? I suppose that my search type windows must be implemented like some UserControls. I think its no a good idea to implement that like simple wpf windows. I have tried to do that by using Marlon grech "Blend like UIs using DOCKY", find at:
http://marlongrech.wordpress.com/2008/01/29/create-blend-like-uis-using-docky/
But I failed, dont find the way how to add controlls in code dynamically, not in xaml.
I would appreciate code examples to illustrate how to achieve this.
Is it possible to do such a thing in C# code (SomeMenuItem_Click): this code adds new tab in tabControl of main window.
Yes. The basic pattern is:
TabItem newItem = new TabItem();
tabControl.Items.Add(newItem);
You'll obviously need to set the relevant properties of your tab item (such as the Header and Style) but that should get you started.
You'll then need to create any controls you want to show and add them to the tab item itself (or more correctly - a container within the tab item).

Resources