Power BI

Content by Charles Sterling

Simple XAML Page and Event Handler

Been playing with the Jan CTP of the WinFX SDK on Vista build 5270 and unfortuntely the Visusal Studio 2005 XAML Designer still doesn’t wire up event handlers so i thought i would post a simple page with with corresponding event handler (most of the samples are for older builds or C#)


XAML Page:

<Window x:Class=Window1






<Button VerticalAlignment=Bottom HorizontalAlignment=Stretch Grid.Column=0 Grid.ColumnSpan=1 Grid.Row=0 Grid.RowSpan=1 Margin=115.5,0,107.5,106.02 Width=NaN Height=21.96 Click=HandleClick Name=Button1>Button</Button>



Code Behind for the click event handler:

Imports System

Imports System.Windows

Imports System.Windows.Controls

Imports System.Windows.Data

Imports System.Windows.Documents

Imports System.Windows.Media

Imports System.Windows.Media.Imaging

Imports System.Windows.Shapes

‘ Interaction logic for Window1.xaml

Partial Public Class Window1

Inherits Window

Public Sub New()


End Sub

Sub HandleClick(ByVal Sender As Object, ByVal args As RoutedEventArgs)

Button1.Content = “Hello From Chuck”

End Sub ‘HandleClick

End Class