Ejemplo n.º 1
0
        private async void MenuItemRename_Click(object sender, RoutedEventArgs e)
        {
            var menuitem = (MenuItem)sender;
            var item     = (GdItem)menuitem.CommandParameter;

            var result = await MessageBoxManager.GetMessageBoxInputWindow(new MessageBox.Avalonia.DTO.MessageBoxInputParams
            {
                ContentTitle          = "Rename",
                ContentHeader         = "inform new name",
                ContentMessage        = "Name",
                WatermarkText         = item.Name,
                ShowInCenter          = true,
                WindowStartupLocation = WindowStartupLocation.CenterOwner,
                ButtonDefinitions     = new ButtonDefinition[] { new ButtonDefinition {
                                                                     Name = "Ok"
                                                                 }, new ButtonDefinition {
                                                                     Name = "Cancel"
                                                                 } },
            }).ShowDialog(this);

            if (result?.Button == "Ok" && !string.IsNullOrWhiteSpace(result.Message))
            {
                item.Name = result.Message.Trim();
            }
        }