You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
878 B
C#

Page Loaded event
<Page x:Class="WpfApplication1.StartPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Loaded="Init" />
//File:Window.xaml.cs
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Navigation;
namespace WpfApplication1
{
public partial class StartPage : Page
{
TextBlock txtElement;
StackPanel rootPanel;
Button aButton;
void Init(object sender, EventArgs args)
{
rootPanel = new StackPanel();
txtElement = new TextBlock();
aButton = new Button();
aButton.Content = "Press me";
rootPanel.Children.Add(txtElement);
rootPanel.Children.Add(aButton);
}
}
}