mirror of
https://github.com/bloxstraplabs/bloxstrap.git
synced 2025-04-21 10:01:27 -07:00
Allow for flag names to be editable
This commit is contained in:
parent
5741d82f3d
commit
b6dee9c772
@ -17,7 +17,7 @@
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<TextBlock Grid.Row="0" Margin="0,0,0,16" Text="Manage your own FastFlags. Double click the value column to edit." FontSize="14" Foreground="{DynamicResource TextFillColorSecondaryBrush}" />
|
||||
<TextBlock Grid.Row="0" Margin="0,0,0,16" Text="Manage your own FastFlags. Double click a column to edit." FontSize="14" Foreground="{DynamicResource TextFillColorSecondaryBrush}" />
|
||||
|
||||
<StackPanel Grid.Row="1" Margin="0,0,0,16" Orientation="Horizontal">
|
||||
<ui:Button Icon="ArrowLeft48" Content="Back" Click="BackButton_Click" />
|
||||
@ -87,7 +87,7 @@
|
||||
</DataGrid.CellStyle>
|
||||
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Header="Name" Binding="{Binding Name}" IsReadOnly="True" />
|
||||
<DataGridTextColumn Header="Name" Binding="{Binding Name}" />
|
||||
<DataGridTextColumn Header="Value" Binding="{Binding Value}" Width="*" />
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
|
@ -8,6 +8,7 @@ using Microsoft.Win32;
|
||||
using Wpf.Ui.Mvvm.Contracts;
|
||||
|
||||
using Bloxstrap.UI.Elements.Dialogs;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace Bloxstrap.UI.Elements.Menu.Pages
|
||||
{
|
||||
@ -111,11 +112,28 @@ namespace Bloxstrap.UI.Elements.Menu.Pages
|
||||
break; */
|
||||
|
||||
case "Name":
|
||||
string newName = ((TextBox)e.EditingElement).Text;
|
||||
var textbox = e.EditingElement as TextBox;
|
||||
|
||||
App.FastFlags.SetValue(entry.Name, null);
|
||||
string oldName = entry.Name;
|
||||
string newName = textbox!.Text;
|
||||
|
||||
if (newName == oldName)
|
||||
return;
|
||||
|
||||
if (App.FastFlags.GetValue(newName) is not null)
|
||||
{
|
||||
Controls.ShowMessageBox("A FastFlag with this name already exists.", MessageBoxImage.Information);
|
||||
e.Cancel = true;
|
||||
textbox.Text = oldName;
|
||||
return;
|
||||
}
|
||||
|
||||
App.FastFlags.SetValue(oldName, null);
|
||||
App.FastFlags.SetValue(newName, entry.Value);
|
||||
|
||||
if (!newName.Contains(_searchFilter))
|
||||
ClearSearch();
|
||||
|
||||
break;
|
||||
|
||||
case "Value":
|
||||
|
Loading…
Reference in New Issue
Block a user