WPF Rounded window corners with semitransparent blurred background still blur even with window transparent - wpf

I want rounded window corners (more specifically, only on the top two),
however my window background is semitransparent blurred of whatever is behind it, and I'm trying to use the usual method of having a round corner border, which works, but the window, even though transparent, still gives off a blur effect.
Here's what's happening (showing one corner)

you need to set WindowStyle to WindowStyle.None, which will remove the chrome, then you can allow transparency which is an attribute int the Window element, and set the background color to transparent. All of this can be done as attributes to the window tag.
WindowStyle="None"
AllowsTransparency="True"
Background="Transparent"
To make the corners rounded, use a border and set the cornerRadius property

Related

static text - rounded rectangle border mfc

I have a static control in a dialog to show some messages in a dialog. By default it is as rectangle box. I want to make it as rounded corned rectangle to get good appearance, similar to that of a button. Any properties can be changed to make it as rounded corner rectangle

Crop WPF control

I have to crop some control to show only a half of it but the rest should be transparent and clickable so it is not enough to cover the control with something. The result should give a control with only half of the content (for example 50% of top) and the rest should be cropped (not hidden) so some other control below should be visible and not overlapped by cropped part. New control should also scale when window is scaled. How to do this in WPF?
I have finally did the trick using Border around the control and Clip property of this border was set to Multibinging that was generating Rectangle basing on ActualWidth and ActualHeight of my control
Maybe GridSplitter:
http://www.wpf-tutorial.com/panels/gridsplitter/
Can be used to split views horizontally/vertically, and can be responsive.

WP7 max circle size for orientation

In my WP7 app, I have a user control, with a grid, and an ellipse in the layout root:
<Grid x:Name="LayoutRoot">
<Grid x:Name="grdCircle">
<Ellipse x:Name="elCircle" Stroke="#FFB91515" Margin="5"/>
</Grid>
</Grid>
I drop this on my main page in the WP7 app, and it looks fine in landscape mode, but when I switch to portrait the width expands and the height contracts, so it is no longer a circle. What I want is for the circle to be the max size it can be regardless of the orientation and still stay a circle.
I've tried putting SizeChanged event on LayoutRoot, and setting the grdCircle width/height to whatever was smaller - the LayoutRoot actual width or the LayoutRoot actual height, but as soon as I do that, changing the orientation doesn't fire the SizeChanged event of LayoutRoot anymore because LayoutRoot also becomes smaller. How can I ensure that my ellipse is always a circle and grows/shrinks based on the orientation?
Edit:
By default, the LayoutRoot grid should have horizontal and vertical alignment set to stretch with margins of 0, so shouldn't the LayoutRoot grid always grow to the size of its container?
Maybe you should take adventage of OrientationChanged event of a Page?
Updated
I think that your control is filling all space that is available. If you change orientation then the amount of space is changing - as a result your control is not a square any more. That fact implicates that the ellipse changes its shape from circle to ellipse, because your ellipse is also trying to fill in all available space. To avoid this you can set Stretch property of an ellipse to Uniform. This should resolve your problem.

Create a fully transparent WPF window to capture mouse events

I'm trying to trap mouse events in WPF by using a topmost, transparent non-modal window. I'm finding that this works fine if the opacity of the window is 0.01 or greater and it has a background color, but when the opacity is set to 0 it no longer receives mouse messages. Is there a way make this window look fully transparent and still get mouse input?
As far as I know, no.
When a Control or Window is fully transparent, it can then be clicked through. This is the case if you set your Window.Background="Transparent", or Opacity="0". As far as I know, this is by design in WPF.
When using an opacity of 0.01, you should barely see the window, if at all. This is likely your best bet at achieving the functionality.
Edit: Another solution, which I tried and does work, is to set the background color to an almost-transparent color. I used Background="#01000000", thus giving an alpha value of 1. This makes your window background transparent-looking, but allows you to place controls on it with the window at full opacity.
In Visual Studio 2010:
Select your window in your design view.
Set the properties of your window to:
AllowsTransparency : check it
Background : Transparent
WindowStyle : None
Just set Background=Brushes.Transparent instead of Background=null.
You don't need to use opacity at all (ie. just leave it at 100% opacity).
For example i think your control name is MyGrid and you want it be Transparent and always get MouseOverEvent.....
If (window AllowsTransparency is True and the window Background is Transparent) Then
use a color like #01777777 for MyGrid Background Or 0.01 for MyGrid Opacity.
Else
use something like #00777777 for MyGrid Background Or 0.00 for MyGrid Opacity.
Setting the opacity to 100% (or any non-zero value), and the background to Transparent (instead of null) should make most controls hittable.
Make sure to set IsHitTestVisible to true. Not all controls can be hit, even if the opacity is 100% and the background is transparent.
You might find it simpler to use Mouse.Capture.
https://msdn.microsoft.com/en-us/library/ms771301.aspx
When an object captures the mouse, all mouse related events are treated as if the object with mouse capture perform the event, even if the mouse pointer is over another object.

Showing Tooltip of WPF control under the decrative touches

I have a window with a number of controls upon it, each control with a Tooltip associated. In an effort to jazz up the window a little, I have overlayed some semi-transparent ellipses which gives the whole window a glossy finish, however, in some cases the positioning of these ellipses are preventing the hit-test getting down to my controls.
How can I have the ellipses visible, but transparent from a hit-test point-of-view?
IsHitTestVisible = false

Resources