Glossy shiny square button in WPF - XAML - wpf

I am trying to find rectangle buttons with gloss effect.
all examples are relevant for round buttons. (and when editing the code, the gloss effect is not suit the rectangle.
Do anyone know about xaml examples for button like in the images below?

It is possible to do this with XAML. There is a great XAML resource page for such things called xamalot.com. I have taken one button as a reference: http://xamalot.com/asset/0fc669c8-35f8-49c0-bceb-0d07f1d63691 :
The whole thing to draw with XAML is not that easy, but there are tools out there which allow you to draw and export like Microsoft's Expression Design.

The best way to accomplish this is with an image as content for the button.
<Button BorderThickness="0">
<Image Source="http://i.stack.imgur.com/XAgzU.jpg"/>
</Button>
You can use shading to get the effect in the second image or reflection to get the effect in the first image

You can create these kind of graphics with Illustrator easily, and Expression Blend has a feature to convert Illustrator vector files to XAML.
This option is the best in terms of quality, of course, since your graphics.
As an alternative, Expression Blend can do this too, maybe even faster.
I did do this type of thing once and I just drew the basic shape with a color, then drew another shape there, changed the scale + converted the shape to a path in Blend so I could move the points, then just applied a white color with lower alpha, and that's it.
I didn't provide much details in this answer so for any further information just leave me a comment.
Important tip: put your XAML graphics in a Viewbox!

Related

Rectangular shaped Gradient Fill

I'm currently looking to achieve a gradient effect a bit like the rectangle in http://pjnicholson.com/Fireworks/fillgradients.htm
If I compromise a little I can get close to this using RadialGradientBrush... but is there any (not too painful) way to achieve the rectangular effect?
Use an ImageBrush instead and use this image (or a similar image generated using some image editor) for the background of your rectangle.
One solution a colleague and I came with was to derive a new Panel that used a WriteableBitmap as the source for its background.
The panel will give you the dimensions you need to make your WriteableBitmap. Using whatever algorithm you want you can fill it appropriately. In our case, we needed a radial or cone gradient, but the same concept applies.
Additionally, you can create several properties on your new control to specify the colors for the gradient. We adapted a LinearGradientBrush for our needs, but if you're working on just two colors, simple properties may suffice.
I don't have the code handy but will try to find it and post an update later. But the above should get you going.

How to build the following visual

I am not a real designer and I would like to know if anyone have an idea how can I build the following visual :
The idea is to get 2 rings where inside I will draw secific number of pie represented as "Interactive shape or button". Base on the number of shape, they should cover the whole circle.
In addition to that, I need to be able to interact with each pie shape, and inside and oustide edge of those shape should be a perfect arc based on the circle diameter.
As I am not a perfect designer, how can I represent this visual ?
I was thinking of using a custom panel but then how to draw each panel shape in order that they gets perfect inside and ouside arc and offer interactivity with each of them ?
Thanks for your help
I would appreciate samples as well
Theres actually a Silverlight tutorial on making something exactly like this.
If you didnt want to use that, you could always do it in javascript. Here's an example using Rapheal js
I would recommend looking into WPF Geometry and how you can create custom controls (such as the Circular Gauge Custom Control over on CodeProject) using said Geometry.
I've never created a control quite like what your suggesting, but I would image you would define some form of area that can contain children and style it so that it forms the circular shape you want. Then, adding interactive regions should be as simple as adding controls to standard containers.
Here's a link to a "generic radial panel that can be used to host any items" which subclasses Panel.

Silverlight 4: how to highlight control on mouse over

My aim is to get fine control "animation" when it is mouse-over-ed. For example, I have a "map" of controls (game map that represent different type of terrain), each of them is an image with trees/rocks/hills on the green grass or water (lake or see) image of blue/cyan color. When user point any image with mouse it should get shiny: either get more bright background or get a shiny border.
It is hard to say what exactly I want to have (either background change or border), I would like to try each of them and see what is the most appropriate for me.
I am going to have a custom control (MapTile) that will represent a map tile. I know how to catch MouseEnter/MouseLeave events, but not sure how to change control style and if it is a good idea to work with control style in CodeBehind, probably there are better XAML-based solutions.
Could you please help with a solution that provide few goals:
Goal1: Add highlighted border around the control (it will be squares/rectangles, or circles; use what is easier) on mouse enter, remove border on move leave;
Goal2: Change some properties of my CustomControl (for example, background color).
Thank you very much!
1. How to han
You might find it easiest to get hold of Expression Blend and use it to create a custom template for your control.
The Learn Expression Blend page would be a good place to start. Look for tutorials on customising buttons and this is the same sort of thing that you want to do.
You need to use an attached behavior on your control. You don't need to learn Blend for this.
Check this one as an example, but you can search the site for Mouse Over for other examples.
http://gallery.expression.microsoft.com/en-us/MouseOver3D

Simulate a handwritten signature in Silverlight: (e.g. A pen progressively draws the lines)

I'd like to have Silverlight draw the blue "L" and "C" in the image below, preferably in a way that the thickness of the line is maintained and speeds/up slows/down at the correct locations to simulate a handwritten signature.
(source: lamontconsulting.com)
Can anyone point me to the right way to do this? Thanks!
The first this is to take this raster graphic and turn it vector. There are different ways to do that, but I find Adobe Illustrator to be the best. It's got a feature called LiveTrace that will do this for you (PDF file). After you've got that, you could import that into Expression Blend and turn it into XAML (a PathGeometry). Once in Blend, you can animate any which way you like. What you'd want for this is a key frame animation.

Making a "Fuzzy border" in Silverlight 3.0

I would like to have fuzzy looking border around my Canvas control. Basically, I am creating a Print Preview screen, and I want it to look almost exactly like the one in Word 2010. In this, there is a thin gray line, a thin orange line and then a fuzzy gradient around the outside of the page. Check it out and you will see what I mean.
Can anyone tell me how I can do this with my Canvas control?
Answer was in the comments. Thanks!
Here it is:
Does SL3 support BitmapEffects or ShaderEffects? If so, just drop a border on the bottom and give it a fuzzy effect. Just make sure not to put anything IN the border, just lay it on top of the border inside the canvas.

Resources