Skip to content

Commit

Permalink
Fix DataContext management for FastFlags page
Browse files Browse the repository at this point in the history
  • Loading branch information
pizzaboxer committed Jul 23, 2023
1 parent e5d6ac0 commit 2bd20b5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Bloxstrap/UI/Elements/Menu/Pages/FastFlagEditorPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>

<TextBlock Grid.Row="0" Margin="0,0,0,16" Text="Manage your own FastFlags. Press the delete key to delete a selected entry." FontSize="14" Foreground="{DynamicResource TextFillColorSecondaryBrush}" />
<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}" />

<DataGrid Name="DataGrid" Grid.Row="1" Style="{x:Null}" HeadersVisibility="Column" AutoGenerateColumns="False" CanUserAddRows="False" CanUserDeleteRows="False" CellEditEnding="DataGrid_CellEditEnding">
<DataGrid.Columns>
Expand Down
10 changes: 10 additions & 0 deletions Bloxstrap/UI/Elements/Menu/Pages/FastFlagsPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,24 @@ namespace Bloxstrap.UI.Elements.Menu.Pages
/// </summary>
public partial class FastFlagsPage
{
bool _initialLoad = false;

public FastFlagsPage()
{
DataContext = new FastFlagsViewModel();
InitializeComponent();
}

private void Page_Loaded(object sender, RoutedEventArgs e)
{
// refresh datacontext on page load to synchronize with editor page

if (!_initialLoad)
{
_initialLoad = true;
return;
}

DataContext = new FastFlagsViewModel();
}

Expand Down

0 comments on commit 2bd20b5

Please sign in to comment.