Skip to content

Commit

Permalink
[Registry Preview] Removing Read Only (#25152)
Browse files Browse the repository at this point in the history
* Removing Read Only

Based off the comments and how the app is being see in the early reports, this check box will just add confusion, so I've pulled it from the UX and screenshots.

* Update MainWindow.xaml

Fixing tab order
  • Loading branch information
randyrants committed Apr 3, 2023
1 parent 1fdf8cc commit bfe99a0
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 62 deletions.
35 changes: 0 additions & 35 deletions src/modules/registrypreview/RegistryPreviewUI/MainWindow.Events.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ public void Window_Closed(object sender, WindowEventArgs args)
}

// Save app settings
jsonSettings.SetNamedValue("checkBoxTextBox.Checked", JsonValue.CreateBooleanValue(checkBoxTextBox.IsChecked.Value));
SaveSettingsFile(settingsFolder, settingsFile);
}

Expand All @@ -68,12 +67,6 @@ private void GridPreview_Loaded(object sender, RoutedEventArgs e)
// static flag to track whether the Visual Tree is ready - if the main Grid has been loaded, the tree is ready.
visualTreeReady = true;

// Load and restore app settings
if (jsonSettings.ContainsKey("checkBoxTextBox.Checked"))
{
checkBoxTextBox.IsChecked = jsonSettings.GetNamedBoolean("checkBoxTextBox.Checked");
}

// Check to see if the REG file was opened and parsed successfully
if (OpenRegistryFile(App.AppFilename) == false)
{
Expand Down Expand Up @@ -354,33 +347,5 @@ private void TextBox_TextChanged(object sender, TextChangedEventArgs e)
RefreshRegistryFile();
saveButton.IsEnabled = true;
}

/// <summary>
/// Readonly checkbox is checked, set textBox to read only; also update the font color so it has a hint of being "disabled" (also the hover state!)
/// </summary>
private void CheckBoxTextBox_Checked(object sender, RoutedEventArgs e)
{
textBox.IsReadOnly = true;
SolidColorBrush brush = new SolidColorBrush(Windows.UI.Color.FromArgb(255, 120, 120, 120)); // (SolidColorBrush)Application.Current.Resources["TextBoxDisabledForegroundThemeBrush"];
if (brush != null)
{
textBox.Foreground = brush;
textBox.Resources["TextControlForegroundPointerOver"] = brush;
}
}

/// <summary>
/// Readonly checkbox is unchecked, set textBox to be editable; also update the font color back to a theme friendly foreground (also the hover state!)
/// </summary>
private void CheckBoxTextBox_Unchecked(object sender, RoutedEventArgs e)
{
textBox.IsReadOnly = false;
SolidColorBrush brush = (SolidColorBrush)Application.Current.Resources["TextControlForeground"];
if (brush != null)
{
textBox.Foreground = brush;
textBox.Resources["TextControlForegroundPointerOver"] = brush;
}
}
}
}
27 changes: 3 additions & 24 deletions src/modules/registrypreview/RegistryPreviewUI/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
<RowDefinition Height="*" />
<RowDefinition Height="6" />
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>

<Grid
Expand Down Expand Up @@ -147,7 +146,7 @@
Grid.Row="1"
Grid.RowSpan="3"
Grid.Column="0"
Margin="8,0,0,0"
Margin="8,0,0,8"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
AcceptsReturn="True"
Expand All @@ -164,26 +163,6 @@
TabIndex="0"
TextWrapping="NoWrap" />

<StackPanel
x:Name="stackPanelTextBox"
Grid.Row="4"
Grid.Column="0"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
IsTabStop="False">
<CheckBox
x:Name="checkBoxTextBox"
x:Uid="checkBoxTextBox"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Checked="CheckBoxTextBox_Checked"
Content="{Binding Content}"
IsChecked="True"
IsTabStop="True"
TabIndex="1"
Unchecked="CheckBoxTextBox_Unchecked" />
</StackPanel>

<Grid
Grid.Row="1"
Grid.Column="2"
Expand All @@ -206,7 +185,7 @@
ScrollViewer.HorizontalScrollMode="Enabled"
ScrollViewer.VerticalScrollBarVisibility="Visible"
ScrollViewer.VerticalScrollMode="Auto"
TabIndex="2">
TabIndex="1">
<TreeView.ItemTemplate>
<DataTemplate>
<StackPanel
Expand Down Expand Up @@ -245,7 +224,7 @@
ItemsSource="{x:Bind listRegistryValues}"
RowDetailsVisibilityMode="Collapsed"
SelectionMode="Single"
TabIndex="3">
TabIndex="2">
<controls:DataGrid.Columns>
<controls:DataGridTemplateColumn
x:Uid="NameColumn"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,6 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="checkBoxTextBox.Content" xml:space="preserve">
<value>Read only</value>
</data>
<data name="EditButton.Label" xml:space="preserve">
<value>Edit file...</value>
</data>
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/settings-ui/Settings.UI/Assets/Modules/RegistryPreview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit bfe99a0

Please sign in to comment.