using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media;
public class MainClass : Window
{
[STAThread]
public static void Main()
{
Application app = new Application();
app.Run(new MainClass());
}
public MainClass()
{
SizeToContent = SizeToContent.WidthAndHeight;
GroupBox group = new GroupBox();
group.Header = "Window Style";
group.Margin = new Thickness(96);
group.Padding = new Thickness(5);
Content = group;
StackPanel stack = new StackPanel();
group.Content = stack;
RadioButton radio = new RadioButton();
radio.Content = "No border or caption";
radio.Tag = WindowStyle.None;
radio.Margin = new Thickness(5);
stack.Children.Add(radio);
radio = new RadioButton();
radio.Content = "Single-border window";
radio.Tag = WindowStyle.SingleBorderWindow;
radio.Margin = new Thickness(5);
radio.IsChecked = (WindowStyle.SingleBorderWindow == WindowStyle);
stack.Children.Add(radio);
AddHandler(RadioButton.CheckedEvent, new RoutedEventHandler(RadioOnChecked));
}
void RadioOnChecked(object sender, RoutedEventArgs args)
{
RadioButton radio = args.Source as RadioButton;
WindowStyle = (WindowStyle)radio.Tag;
}
}
|