mirror of
https://github.com/fadden/6502bench.git
synced 2025-10-25 03:26:11 +00:00
Add "always on top" checkbox to reference table
It's annoying to have to go digging for the dialog. The default setting is "true", and the value is remembered for the duration of the current session.
This commit is contained in:
@@ -24,9 +24,13 @@ limitations under the License.
|
||||
Title="Reference List"
|
||||
Width="400" Height="300" MinWidth="180" MinHeight="120" ResizeMode="CanResizeWithGrip"
|
||||
ShowInTaskbar="True"
|
||||
PreviewKeyDown="Window_KeyEventHandler">
|
||||
PreviewKeyDown="Window_KeyEventHandler" Closing="Window_Closing">
|
||||
|
||||
<Grid Margin="8">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
<DataGrid Name="tableDataGrid" IsReadOnly="True"
|
||||
ItemsSource="{Binding ReferencesList}"
|
||||
FontFamily="{StaticResource GeneralMonoFont}"
|
||||
@@ -44,5 +48,10 @@ limitations under the License.
|
||||
<DataGridTextColumn Header="Type" Width="119" Binding="{Binding Type}"/>
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
|
||||
<StackPanel Grid.Row="1" Margin="0,5,0,0" Orientation="Horizontal">
|
||||
<!-- Bind the checkbox directly to the window's Topmost property. -->
|
||||
<CheckBox Content="Always on top" IsChecked="{Binding Path=Topmost}"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Window>
|
||||
|
||||
@@ -47,6 +47,9 @@ namespace SourceGen.WpfGui {
|
||||
}
|
||||
}
|
||||
|
||||
// Remember setting for duration of execution.
|
||||
private static bool sAlwaysOnTop = true;
|
||||
|
||||
public ObservableCollection<ReferenceTableItem> ReferencesList { get; private set; } =
|
||||
new ObservableCollection<ReferenceTableItem>();
|
||||
|
||||
@@ -58,6 +61,7 @@ namespace SourceGen.WpfGui {
|
||||
DataContext = this;
|
||||
|
||||
mMainCtrl = mainCtrl;
|
||||
Topmost = sAlwaysOnTop;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -78,6 +82,11 @@ namespace SourceGen.WpfGui {
|
||||
}
|
||||
}
|
||||
|
||||
// Remember the "always on top" setting.
|
||||
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) {
|
||||
sAlwaysOnTop = Topmost;
|
||||
}
|
||||
|
||||
private void ReferencesList_MouseDoubleClick(object sender, MouseButtonEventArgs e) {
|
||||
if (!tableDataGrid.GetClickRowColItem(e, out int unusedRow, out int unusedCol,
|
||||
out object item)) {
|
||||
|
||||
Reference in New Issue
Block a user