WPF: Examples of using a Style on a Window - wpf

I have created a borderless window style wherein I draw the chrome (Borders, TitleBar, Min, Max, Close, SystemMenu, etc) and I would like to check it against an existing example. Specifically for the SystemMenu but also in case I missed something. Does anyone have or know of similar examples?

Recommended reading:
http://blogs.msdn.com/wpfsdk/archive/2008/09/08/custom-window-chrome-in-wpf.aspx
The accompanying sample contains a couple of templates that you can compare against yours.

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 Create a Dockable Tab like IE9 or chrome

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.

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

Styling WPF slider background

I'm trying to apply a specific style to a slider control and I'm having trouble figuring out what I need to do for the slider's background. What do I need to do to get something like this triangle to show in the background of my slider?
I initially thought I would define a GeometryDrawing and set something in the tickbar tag to it - but I can't find anything suitable.
This is what I'm looking for. Thanks for any ideas.
Slider background http://img16.imageshack.us/img16/690/slider.png
Check out my Intuipic project, which does something similar (only horizontally):
you need to investigate a bit more into styling and templatiting in wpf. I would expect the easiest way would be to define a Control Template but you 'might' be able to achieve this with just styling
Check out this page on msdn for starters. There is probably loads of other resources out there. Big sections on it in the book i'm reading at the moment - pro wpf in c# 2008
Sorry i'm not coming up with an example... you'd be better off doing a bit of background reading and then coming back with any specific issues.

Resources