Skip to content

Instantly share code, notes, and snippets.

@hilapon
Created January 14, 2015 08:04
Show Gist options
  • Save hilapon/270ab7961e5ebf9d1dba to your computer and use it in GitHub Desktop.
Save hilapon/270ab7961e5ebf9d1dba to your computer and use it in GitHub Desktop.
WPF の Hello world (その3)
using System;
using System.Windows;
using System.Windows.Controls;
namespace ConsoleApplication3 {
class Program {
[STAThread]
static void Main(string[] args) {
var window = new Window() {
Content = new TextBlock() {
Text = "Hello world"
}
};
window.ShowDialog();
}
}
}
@hilapon
Copy link
Author

hilapon commented Jan 14, 2015

Window.Content に TextBlock を指定したサンプル。Window.Content プロパティには FrameworkElement 型のインスタンス以外にも、String や 値型のインスタンス、ヌル値等、様々なオブジェクトを設定できる。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment