Nested Button content : Button « Windows Presentation Foundation « VB.Net Tutorial






<Window x:Class="WpfApplication1.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="WpfApplication1" Height="300" Width="300" WindowStartupLocation="CenterScreen">
  <StackPanel>
    <Button Name="btnClickMe" Height="75" Width = "250" Click ="btnClickMe_Clicked">
      <StackPanel Orientation ="Horizontal">
        <Label Height="50" FontSize ="20">Fancy Button!</Label>
        <Canvas Height ="50" Width ="100" >
          <Ellipse Name = "outerEllipse" Fill ="Green" Height ="25" 
                   MouseDown ="outerEllipse_MouseDown"
                   PreviewMouseDown ="outerEllipse_PreviewMouseDown"
                   Width ="50" Cursor="Hand" Canvas.Left="25" Canvas.Top="12"/>
          <Ellipse Name = "innerEllipse" Fill ="Yellow" Height = "15" Width ="36"
                        Canvas.Top="17" Canvas.Left="32"/>
        </Canvas>
      </StackPanel>
    </Button>
  </StackPanel>
</Window>
//File:Window.xaml.vb

Imports System
Imports System.Collections.Generic
Imports System.Text
Imports System.Windows
Imports System.Windows.Controls
Imports System.Windows.Data
Imports System.Windows.Documents
Imports System.Windows.Input
Imports System.Windows.Media
Imports System.Windows.Media.Imaging
Imports System.Windows.Shapes


Namespace WpfApplication1
  Public Partial Class MainWindow
    Inherits System.Windows.Window
    Public Sub New()
      InitializeComponent()
    End Sub

    Public Sub btnClickMe_Clicked(sender As Object, e As RoutedEventArgs)
      Console.WriteLine("Button Click event fired!")
    End Sub

    Public Sub outerEllipse_MouseDown(sender As Object, e As RoutedEventArgs)
      Console.WriteLine("MouseDown event fired!")
      e.Handled = False
    End Sub

    Public Sub outerEllipse_PreviewMouseDown(sender As Object, e As RoutedEventArgs)
      Console.WriteLine("PreviewMouseDown event fired!")
      e.Handled = False
    End Sub
  End Class
End Namespace
WPF Nested Button Content








16.6.Button
16.6.1.Rotated ButtonsRotated Buttons
16.6.2.Pendulum ButtonPendulum Button
16.6.3.Set Button Content with element valueSet Button Content with element value
16.6.4.Set Button Width,Height and Content String by using AttributesSet Button Width,Height and Content String by using Attributes
16.6.5.Use Button.Content to set the content for a ButtonUse Button.Content to set the content for a Button
16.6.6.Adding image to a ButtonAdding image to a Button
16.6.7.Button with no position and sizeButton with no position and size
16.6.8.Button with Property AttributesButton with Property Attributes
16.6.9.Button with Property ElementsButton with Property Elements
16.6.10.Button with default Xml namespaceButton with default Xml namespace
16.6.11.Button with named NamespaceButton with named Namespace
16.6.12.Button Based On StyleButton Based On Style
16.6.13.Property Trigger for ButtonProperty Trigger for Button
16.6.14.Layout TranformLayout Tranform
16.6.15.Using alternate elements as the content of a ButtonUsing alternate elements as the content of a Button
16.6.16.Button's Background = ImageBrush. The resulting button has an image as its backgroundButton's Background = ImageBrush. The resulting button has an image as its background
16.6.17.A rotated ButtonA rotated Button
16.6.18.Using Button.Content to set content for ButtonUsing Button.Content to set content for Button
16.6.19.A button that has been skewed and rotatedA button that has been skewed and rotated
16.6.20.Button PreviewMouseDown action and MouseDown actionButton PreviewMouseDown action and MouseDown action
16.6.21.Add CommandTarget for ButtonAdd CommandTarget for Button
16.6.22.Adding graphics to a ButtonAdding graphics to a Button
16.6.23.Button with image and text, use grid to layout Button contentButton with image and text, use grid to layout Button content
16.6.24.Canvas with Button onCanvas with Button on
16.6.25.Resizing ButtonsResizing Buttons
16.6.26.To add a button control and a text block to the canvasTo add a button control and a text block to the canvas
16.6.27.A simple template for a round buttonA simple template for a round button
16.6.28.Load style defined in Xaml and apply to the ButtonLoad style defined in Xaml and apply to the Button
16.6.29.Nested Button contentNested Button content
16.6.30.Two repeat buttons that increase and decrease a numerical value.Two repeat buttons that increase and decrease a numerical value.
16.6.31.Set button properties with Linq styleSet button properties with Linq style
16.6.32.Simple Custom ButtonSimple Custom Button
16.6.33.Button VerticalAlignment=Top HorizontalAlignment=LeftButton VerticalAlignment=Top  HorizontalAlignment=Left