Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The first thing I would suggest is creating the circle using an <strong>Ellipse</strong> rather than a Border with rounded edges. That way you won't need to keep tweaking CornerRadius if you decide the button needs to be a different size. You can overlap the Ellipse and the ContentPresenter in a Grid like so:</p> <pre><code>&lt;ControlTemplate TargetType="Button"&gt; &lt;Grid Background="Transparent"&gt; &lt;Ellipse HorizontalAlignment="Stretch" VerticalAlignment="Stretch"/&gt; &lt;ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/&gt; &lt;/Grid&gt; &lt;/ControlTemplate&gt; </code></pre> <p>To change how the button reacts visually to touch, you should use Visual States in Blend. With the button template opened, click on the <strong>States</strong> tab (or go to Window | States if not visible).</p> <p>If you have the button template opened, you should see several built-in visual states for you to edit. Select the <strong>Pressed</strong> state, and you will go into <strong>Recording</strong> mode. Any changes to the template you make will appear when the button is pressed. You can tell you're in recording mode because of the red outline and notification around the main content window.</p> <p>In this state, change what you want to see when the button is pressed. In your case, set the ellipse opacity to 100% and set the <em>Scale Transform</em> on the Grid to something smaller that fits your needs.</p> <p>Make sure you click the <strong>Base</strong> state in the States tab to exit recording mode.</p> <p>Now, when you press the button during runtime, the changes you recorded should show up. They'll also be instantaneous. To make a nice transition between states, go back to the <strong>States</strong> tab. and click the <strong>Add Transition</strong> button next to the <strong>Pressed</strong> state.</p> <p><img src="https://i.stack.imgur.com/Bs3UF.png" alt="enter image description here"></p> <p>Add a transition for <em>->Pressed, and Pressed-></em>. These are the transitions that will play when you enter and leave the pressed state. Here you can edit the transitions duration and easing function. </p> <p><img src="https://i.stack.imgur.com/oiUmf.png" alt="enter image description here"></p> <p>Personally I usually do something around 0.2s, with Quadratic Ease In/Out. Now when you press the button, there should be a slight animation between different visual states.</p> <p>Good luck!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload