В моей ситуации у меня есть окно в котором есть только одна кнопка:
Код: Выделить всё
Код: Выделить всё
using System.Windows.Documents;
using System.Windows.Media;
using System.Windows.Shapes;
namespace WpfApp1
{
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
private void Button_Click(object sender, RoutedEventArgs e)
{
Window window = new Window();
window.Height = window.Width = 100;
window.WindowStyle = WindowStyle.None;
Rectangle rectangle = new Rectangle();
rectangle.Height = rectangle.Width = 50;
rectangle.Fill = new SolidColorBrush(Colors.Red);
Grid grid = new Grid();
grid.Children.Add(rectangle);
window.Content = grid;
window.Show();
}
}
}
Подробнее здесь: https://stackoverflow.com/questions/657 ... ers-window