|
36 | 36 | The <xref:System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonDown%2A> method marks the <xref:System.Windows.UIElement.MouseLeftButtonDown> event as handled. To respond to the <xref:System.Windows.UIElement.MouseLeftButtonDown> event, attach an event handler to the <xref:System.Windows.ContentElement.PreviewMouseLeftButtonDown> event, or call <xref:System.Windows.UIElement.AddHandler%28System.Windows.RoutedEvent%2CSystem.Delegate%2CSystem.Boolean%29> with `handledEventsToo` set to `true`.
|
37 | 37 |
|
38 | 38 | ## Customizing the Button Control
|
39 |
| - To apply the same property settings to multiple <xref:System.Windows.Controls.Button> controls, use the <xref:System.Windows.FrameworkElement.Style%2A> property. You can modify the default <xref:System.Windows.Controls.ControlTemplate> to give the control a unique appearance. For more information about creating a <xref:System.Windows.Controls.ControlTemplate>, see [Customizing the Appearance of an Existing Control by Creating a ControlTemplate](/dotnet/framework/wpf/controls/customizing-the-appearance-of-an-existing-control). To see the parts and states that are specific to the <xref:System.Windows.Controls.Button>, see [Button Styles and Templates](/dotnet/framework/wpf/controls/button-styles-and-templates). |
| 39 | + To apply the same property settings to multiple <xref:System.Windows.Controls.Button> controls, use the <xref:System.Windows.FrameworkElement.Style%2A> property. You can modify the default <xref:System.Windows.Controls.ControlTemplate> to give the control a unique appearance. For more information about creating a <xref:System.Windows.Controls.ControlTemplate>, see [How to create a template for a control](/dotnet/desktop/wpf/controls/how-to-create-apply-template). To see the parts and states that are specific to the <xref:System.Windows.Controls.Button>, see [Button Styles and Templates](/dotnet/framework/wpf/controls/button-styles-and-templates). |
40 | 40 |
|
41 |
| - Dependency properties for this control might be set by the control's default style. If a property is set by a default style, the property might change from its default value when the control appears in the application. The default style is determined by which desktop theme is used when the application is running. |
| 41 | + Dependency properties for this control might be set by the control's default style. If a property is set by a default style, the property might change from its default value when the control appears in the application. The default style is determined by which desktop theme is used when the application is running. |
42 | 42 |
|
43 | 43 | [!INCLUDE[setting-a-visual-property](~/includes/visual-property-note.md)]
|
44 | 44 |
|
45 | 45 | ## Examples
|
46 | 46 | The following example shows three buttons that respond to clicks in three different ways.
|
47 | 47 |
|
48 |
| -- Hover: the first button changes colors when the user hovers with the mouse over the button. |
49 |
| -
|
50 |
| -- Press: the second button requires that the mouse be pressed while the mouse pointer is over the button. |
51 |
| -
|
52 |
| -- Release: the third does not reset the background color of the buttons until the mouse is pressed and released on the button. |
| 48 | +- Hover: the first button changes colors when the user hovers with the mouse over the button. |
| 49 | +- Press: the second button requires that the mouse be pressed while the mouse pointer is over the button. |
| 50 | +- Release: the third does not reset the background color of the buttons until the mouse is pressed and released on the button. |
53 | 51 |
|
54 | 52 | :::code language="xaml" source="~/snippets/csharp/System.Windows.Controls/Button/Overview/Pane1.xaml" id="Snippet1":::
|
55 | 53 |
|
|
250 | 248 | <format type="text/markdown"><![CDATA[
|
251 | 249 |
|
252 | 250 | ## Remarks
|
253 |
| - The <xref:System.Windows.Controls.Button.IsDefaulted%2A> property is `true` when the <xref:System.Windows.Controls.Button.IsDefault%2A> property is set to `true` and the control that has focus does not accept ENTER as input. For example, in the **Run** dialog box, the **OK** button is the default button. When focus is on the text box, <xref:System.Windows.Controls.Button.IsDefaulted%2A> on the **OK** button is `true` because a user can activate the button by pressing ENTER. |
| 251 | + The <xref:System.Windows.Controls.Button.IsDefaulted%2A> property is `true` when the <xref:System.Windows.Controls.Button.IsDefault%2A> property is set to `true` and the control that has focus does not accept ENTER as input. For example, in the **Run** dialog box, the **OK** button is the default button. When focus is on the text box, <xref:System.Windows.Controls.Button.IsDefaulted%2A> on the **OK** button is `true` because a user can activate the button by pressing ENTER. |
254 | 252 |
|
255 | 253 | > [!NOTE]
|
256 | 254 | > If the default button has focus, <xref:System.Windows.Controls.Button.IsDefaulted%2A> is `false`. This is because the <xref:System.Windows.Controls.Primitives.ButtonBase.OnKeyDown%2A> method handles ENTER, and it is not necessary for <xref:System.Windows.Controls.Button.IsDefaulted%2A> to be set to `true`.
|
|
0 commit comments