how to change the wpf window's icon size? - wpf

I would like to change the size of the window's icon in the xaml window.
I know that I can hide the window's title bar and create a custom title bar, but is there
any way to change the icon size alone ?
I was looking for many forums and couldnt find a proper solution.
How do I change WPF Menu's icon column size?
The above link explains for menu's icon size but I want for the window's icon

The standard window chrome is handled by the Windows.
I guess the reason for that is consistency across applications which is also the reason why I dislike the Office/Ribbon replacement of the standard chrome.
In Windows 8 Metro applications there will be no window chrome so all UI will be up to you.
In Windows 8 desktop applications (and Windows 7 applications) you will need to replace the entire chrome completely.

To save yourself some coding time, check out this solution over at CodePlex:
http://wpfwindow.codeplex.com/

Related

A window with no taskbar icon, no appearance in Alt-Tab and *without* using the ToolWindow extended style

I have a problem that appears to be new to Windows 10.
I want to create a form that is visible to the user, but with no task bar icon and that does not appear in Alt+Tab.
This is perfectly doable if one is happy to sacrifice the normal styling of a window by following the accepted solutions here for either WPF or Windows Forms.
The general advice for both WPF and Windows Forms is:
Set ShowInTaskbar to false
Enable the ToolWindow styling (either through setting the border style in WinForms or the WindowStyle in WPF)
However, this has a new, practical problem in Windows 10 when using Virtual Desktops: the moment you do the above, the WPF or WinForms window will appear in every virtual desktop. See my example application with a red background:
This affects both the Task View switching screen and the actual desktop itself. No matter where you go, the form is there!
Is there any way to show a form - or even just a bitmap - on Windows without anything appearing in the taskbar, without anything appearing in Alt+Tab and without duplicating the window on every virtual desktop?
I have spent two days researching every possible option, trying every example online, reading MSDN documentation on window styles etc. but all resort to the same method, either through P/Invoke calls or directly, but either way the result is the same.

Custom Window Bar

I'm not sure that's the right way to say it, but what I want is to for my wpf main window to have it's own bar that will behave like a taskbar, and any children windows that will be open from the main one will be placed in that bar in a similar way like the taskbar works in windows - a rectangle showing the window name for example, on click it opens you the window, if you click minimize it will minimize it to the bar, and with some option, to get it out of the main window and move it to the real windows taskbar, with another option for putting it back in. The problem is I don't know if this is even possible, and I don't know the name of such an element, so if anyone can give me any tips I'll be really thankful.
I worked on an application years ago (.NET 3.0: first WPF release!) that did exactly that. We ran into a lot of issues getting it to work, but we were pretty successful in the end. One thing we didn't support was moving it to the Windows taskbar.
The best option would be to set an attached property on each Window. This would register a Window with your custom taskbar, so if you wanted to move the Window out of your custom bar, you'd set the property to false. Setting the property to true would add it to the collection of application windows, as well as register event handlers to track the state of the Window.
One of the major pain points for us was getting the Window animations correct. If you're not running in XP, this probably less of an issue, as the animations in Vista (or is it 7?) and above aren't really showing where a Window is going on minimize. In the end, we had to do a lot of low level Win32 (p/Invoke) work for this.
Take a look at AvalonDock and WPF MDI:
http://avalondock.codeplex.com/
http://wpfmdi.codeplex.com/

How can I style the border and title bar of a window in WPF? [duplicate]

This question already has answers here:
How to create custom window chrome in wpf?
(5 answers)
Closed 6 months ago.
We are developing a WPF application which uses Telerik's suite of controls and everything works and looks fine. Unfortunately, we recently needed to replace the base class of all our dialogs, changing RadWindow by the standard WPF window (reason is irrelevant to this discussion). In doing so, we ended up having an application which still looked pretty on all developer's computers (Windows 7 with Aero enabled) but was ugly when used in our client's environment (Terminal Services under Windows Server 2008 R2).
Telerik's RadWindow is a standard user control that mimicks a dialog's behaviour so styling it was not an issue. With WPF's Window though, I have a hard time changing its "border". What I mean by "border" here is both the title bar with the icon and the 3 standard buttons (Minimize, Maximize/Restore, Close) and the resize grip around the window.
How can I change the looks of these items:
Title bar color
3 standard buttons
Window's real border color
With round corners if possible.
Those are "non-client" areas and are controlled by Windows. Here is the MSDN docs on the subject (the pertinent info is at the top).
Basically, you set your Window's WindowStyle="None", then build your own window interface. (similar question on SO)
You need to set
WindowStyle="None", AllowsTransparency="True" and optionally ResizeMode="NoResize"
and then set the Style property of the window to your custom window style, where you design the appearance of the window (title bar, buttons, border) to anything you want and display the window contents in a ContentPresenter.
This seems to be a good article on how you can achieve this, but there are many other articles on the internet.
I found a more straight forward solution from #DK comment in this question, the solution is written by Alex and described here with source,
To make customized window:
download the sample project here
edit the generic.xaml file to customize the layout.
enjoy :).
Such statements as “you can't because only Windows can control the non-client area” are not quite true — Windows lets you specify the dimensions of the non–client area.
The downside is this is only possible by calling Windows' kernel methods, and since you're in .NET, which is not native code, you'll need P/Invoke. (Remember, the whole of the Windows Form UI and console application I/O methods are offered as wrappers that make system calls under the hood.) Hence, as documented in MSDN, it is completely possible to use P/Invoke to access those methods that are needed to set up the non–client area.
Update: Simpler than ever!
As of .NET 4.5, you can just use the WindowChrome class to adjust the non-client area. Get started here and here, a guide to changing the window border dimensions. By setting it to 0, you'll be able to implement your custom window border in place of the system's one.
I suggest you to start from an existing solution and customize it to fit your needs, that's better than starting from scratch!
I was looking for the same thing and I fall on this open source solution, I hope it will help.

Silverlight 3 oob window border

I was wondering if I can customise the look and feel of the OOB window of my SL app? I want it to look different than the standard windows frame (maybe at least change the visible buttons like minimise or maximise...)
thanks
You can only change the Window's Height, Width, and Title. You can't modify the window chrome.
Window Settings on MSDN
One of many blog entries pointing out that there's no windows chrome customization
This feature is showing up as a common feature request for Silverlight 4, though.
In Silverlight 4, you can choose to remove the window chrome for OOB applications and produce controls to trigger your own window moving/resizing/minimizing/maximizing functionality.
http://blogs.msdn.com/olivers/archive/2010/03/15/silverlight-4-out-of-browser-enhancements.aspx

Intuitive scroll for embedded browser in WPF

I am working on a project built in WPF, which includes an embedded WebBrowser. The Browser that comes with WPF did not meet our needs, so we are using a WinForms WebBrowser in a WindowsFormsHost element.
This all works fine, except the application is to be used on a touch screen, and the users are having a hard time using the tiny standard scrollbar supplied by IE.
I know how to scroll programmatically, but how would you supply a more user-friendly scrolling mechanism? Only constraint is that I cannot overlay anything over the WebBrowser, and there is no room beside it.
There's a old Code Project article that shows a way to modify scroll bar size. The article is in C++, I think it might be possible to adapt the technique by subclassing the browser window using winAPI, but I don't think it's going to be easy.
ResizeScrollbar - How to change width of built-in scroll bars
Also there's the possibility to modify the scrollbar size at system level ...

Resources