User Tools

Site Tools


notes:uwp:buttons

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

notes:uwp:buttons [2017/01/09]
admin
notes:uwp:buttons [2020/08/26]
Line 1: Line 1:
-====== Buttons in XAML ====== 
- 
-//ButtonBase// is the base class for all button controls. 
- 
-<code text> 
-Object 
- └─DependencyObject 
-   └─UIElement  
-     └─FrameworkElement  
-       └─Control 
-         └─ContentControl 
-           └─ButtonBase 
-             ├─Button 
-             ├─HyperlinkButton 
-             ├─RepeatButton 
-             └─ToggleButton 
-               ├─CheckBox 
-               └─RadioButton 
-</code> 
- 
- 
-====Button==== 
- 
-Example: A simple button: 
-<code xml> 
-<Button Content="OK" Click="Button_Click" /> 
-</code> 
- 
-Example: A button with a //Flyout//: 
-<code xml> 
-<Button Content="Submit" Click="SubmitButton_Click"> 
-    <Button.Flyout> 
-        <Flyout Placement="Top" > 
-            <StackPanel Background="White"> 
-                <TextBlock>Submit</TextBlock> 
-                <TextBlock>More info...</TextBlock> 
-            </StackPanel> 
-        </Flyout> 
-    </Button.Flyout> 
-</Button> 
-</code> 
- 
-<code csharp> 
-private void Button_Click(object sender, RoutedEventArgs e) 
-{ 
-    // ... 
-} 
-</code> 
- 
-//Button// vs. event bubbling: //PointerPressed// and //PointerReleased// events get swallowed when they originate within a //Button//. If the goal is to detect taps anywhere on a Page, attach a handler to the //Tapped// event instead of //PointerReleased//. 
- 
- 
-====CheckBox==== 
- 
-<code xml> 
-<CheckBox Content="Keep alive" IsThreeState="False" Checked="CheckBox_Checked" /> 
-</code> 
- 
-<code csharp> 
-private void CheckBox_Checked(object sender, RoutedEventArgs args) 
-{ 
-    // ... 
-} 
-</code> 
- 
- 
-====HyperlinkButton==== 
- 
-Example: A //HyperlinkButton// with a //Click// event handler: 
-<code xml> 
-<HyperlinkButton Click="Button_Click"> 
-    <TextBlock Text="Show more..." /> 
-</HyperlinkButton> 
-</code> 
- 
-Example: A //HyperlinkButton// for navigation to a web page: 
-<code xml> 
-<HyperlinkButton Content="Go to Wiki" NavigateUri="http://www.wbswiki.com" /> 
-</code> 
- 
- 
-====RadioButton==== 
- 
-Group //RadioButtons// by putting them inside the same parent container or by setting the //GroupName// property on each //RadioButton// to the same value. 
- 
-<code xml> 
-<StackPanel> 
-    <RadioButton x:Name="Option1" GroupName="Group1" IsThreeState="False" /> 
-    <RadioButton x:Name="Option2" GroupName="Group1" IsThreeState="False" /> 
-</StackPanel> 
-</code> 
  
notes/uwp/buttons.txt · Last modified: 2020/08/26 (external edit)