Ellipse as mask for a label - wpf

I'm making a toggle button with a new design "material design" like. I have a problem with animation. I'm using an ellipse that expands and changes the color of the button where the mouse clicked. With color it works well but I want to make visible label as ellipse is over it and invisible the second one. I have an image to make it simplier to understand:
so the second image shows that where the green is it stills writes "Toggled" where it should already write "Untoggled" but still where blue color is, there should be writed "Toggled" then radialy changes. I have tried to use Opacity Mask but I couldn't get it to work. Anyone could help me?

Ok I did it animating EllipseGeometry, settings the label I want to display on top of the old one and clipping the top one to the EllipseGeometry.

Related

Control appearance of OnOff Switch

I have an OnOffSwitch in my UI. It has its UUID set to a specific style.
when I modify the colors of this style, the full OnOffSwitch is affected. How can I make it so the sliding piece has one background color and the area inside the full box has another? I'd like a green square with a black border sliding over a transparent background with a slightly thicker black border.
You will have to make your own OnOffSwitch images, 3 of them:
switchOffImage = the off state image (In your case, a slightly thicker black border image)
switchOnImage = the on state image (In your case, a green square with a black border)
switchMaskImage = A square transparent mask image
To get an idea of what the 3 images should be like, open your GUI Builder -> Select Theme -> switch to constants tab at the UIID section and you will find the 3 UIID mentioned above there. If they're not, click add and look for them in the dropdown, then add them all.
After finishing designing your switch images, replace the default images. Keep modifying and testing until your OnOffSwitch flow smoothly.

Need overlapping button in round cornered Winform

Need a quick suggestion for styling a WinForm. I made it with rounded corners even when re-sized. Now trying to add a close button with a image (ControlBox=false), overlapping or clipped to top right corner. This is what I could end with.
But I wish to make it more like in this example image.
How could I achieve this in WinForm.
Here's the trick : your window doesn't just end with the white part. It extends a little bit further. The close button comes under the 'extra' part. The other sides where the window appears to not be there is actually transparent...or in the case of the image, semi-transparent.
The glow effect is provided by the window. Set the TransparencyKey property of the window to Color.Magenta (its a convention as Magenta is the color least likely to be used in a window). Then set the background image to a white background with a little bit of Magenta in the edges. The Magenta will appear transparent when set as the background image.
Fiddle around with TransparencyKey and you'll understand what I mean
Winforms itself cannot provide this for you without outside manipulation of the windows,
because it still uses win32 windows classes in the background.
If you want transparancy in windows: see articles like:
Cool, Semi-transparent and Shaped Dialogs with Standard Controls
And the method in Win32 to do it:
SetLayeredWindowAttributes

silverlight slider flow direction for vertical orientation

Is there a way to change the flow direction of the slider for the vertical orientation? If not, is there a way to change the background color to a color without it having that weird shaded effect? I want the bright color of the slider to be on top and the shaded portion to be on the bottom.
Thanks for all the great responses, but I ended up solving this one on my own. After much research, I finally discovered that I should edit the slider's template and that it can be easily done in Expression Blend. I found a pretty good tutorial for editing templates here. Once I started editing the template, I went to the vertical fill portion of the vertical slider and changed the transparency to 20% and changed the vertical track portion of the the vertical slider to 100%. This is where the shaded effect comes from. Then, I just switched the Fill properties for the vertical fill and the vertical track, so that the top part would be referenced by the slider's Foreground property and the bottom (now shaded part) would be referenced by the slider's Background property.

VisualStateManager: How to make the 'current' color lighter in MouseOver?

1) Imagine a DataGridColumnHeader control is meant to be in Green color by default.
2) If I click on it, it would activate the Sorting to "Sorted Ascending", this is when it should become Orange. Clicking again on it would change it to "Sorted Descending", which still should remain in Orange color.
The two cases above are easy to do with VSM. However the following two scenarios seem to me impossible without a Multi-trigger (which we dont have in Silverlight)
1b) Whenever I hover with the mouse over the non-sorted control, it should become light green.
I hover away, it should go back to base green.
2b) Whenever I hover with the mouse over the sorted control, it should become light orange.
I hover away, it should go back to base Orange.
How should I determine within
MouseOver state, in which mode sorted
state is, in order to choose light
orange or light green accordingly?
Alternatively is it possible to
lighten the current color up, without
knowing what color it actually is?
The easiest would probably be to just make the opacity lower when mouse over, effectively making both green and orange lighter.
Or alternatively you could create a visual state group for sorted states, set it with a data trigger and change the colour of the mouse over element accordingly.

WPF: Changing the look of a Surface Listbox "click-effect"

I'm changing the look of some Controls that I use in my Microsoft Surface Application at the moment. And today I'm working on a SurfaceListBox.
I have the template for it and already changed background and borders and other stuff.
But I really cannot find where I can change the color of the rectangle that appears on the ListBoxItem when you touch the ListBox. At the moment it's just white and I want to change that.
It's not something like the effect that you can see when the item is selected. I already found that and changed that so my selected item now appears in a different color. But the effect in the second when you touch the item stays white.
So where can I change this effect?
If you mean the bright, white highlight that happens when you press your finger against an item you should look into the SurfaceShadowChrome. It's used by (almost) all surface controls to give feedback when the user is pressing on a control.
It does have a Color property that you can modify to suit your needs. Apart from the color, and the tweaking of corner radius and shadow offset, it's not a very flexible decorator. But hopefully, you'll be able to make it do what you need.

Resources