Fix DataContext management for FastFlags page

This commit is contained in:
pizzaboxer 2023-07-23 15:56:55 +01:00
parent e5d6ac0e0a
commit 2bd20b5880
No known key found for this signature in database
GPG Key ID: 59D4A1DBAD0F2BA8
2 changed files with 11 additions and 1 deletions

View File

@ -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>

View File

@ -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();
}