using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
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()
{
ToggleButton btn = new ToggleButton();
btn.Content = "press me";
btn.HorizontalAlignment = HorizontalAlignment.Center;
btn.VerticalAlignment = VerticalAlignment.Center;
btn.SetBinding(ToggleButton.IsCheckedProperty, "Topmost");
btn.DataContext = this;
Content = btn;
ToolTip tip = new ToolTip();
tip.Content = "text content";
btn.ToolTip = tip;
}
}
|