没有xaml的WPF
出于强迫症,我查了一下文档弄明白了WPF脱离xaml应该怎么搞。当然其实本质是为了MaxScript里使用做准备。
using System; using System.Windows; using System.Windows.Controls; using System.Windows.Input; namespace SimpleWPF { public static class Program { [STAThread] public static void Main() { Window theWindow = new Window(); theWindow.Height = 600; theWindow.Width = 800; Button theButton = new Button(); theButton.Content = "Button"; theButton.Click += delegate(object sender, RoutedEventArgs e) { MessageBox.Show("Click"); }; theWindow.Content = theButton; Application theApplication = new Application(); theApplication.Run(theWindow); } } }