using Avalonia.Controls; namespace SlamCross.Views; public partial class RenameWindow : Window { public string? NewName { get; private set; } public RenameWindow(string currentName) { InitializeComponent(); if (this.FindControl("NameBox") is TextBox box) box.Text = currentName; } private void OK_Click(object? sender, Avalonia.Interactivity.RoutedEventArgs e) { if (this.FindControl("NameBox") is TextBox box && !string.IsNullOrWhiteSpace(box.Text)) NewName = box.Text.Trim(); Close(); } private void Cancel_Click(object? sender, Avalonia.Interactivity.RoutedEventArgs e) => Close(); }