From bc74eda3e514b32c2fa124d0c6a5dc11442aa630 Mon Sep 17 00:00:00 2001 From: Benjamin Popp Date: Sun, 9 Dec 2018 19:54:41 -0600 Subject: [PATCH] make the listbox look not terrible --- src/Gen3Hex.Tests/ModelTests.cs | 1 + src/Gen3Hex.WPF/Controls/HexContent.cs | 26 +++++++++++++++---------- src/Gen3Hex.WPF/Windows/App.xaml | 27 ++++++++++++++++++++++++++ 3 files changed, 44 insertions(+), 10 deletions(-) diff --git a/src/Gen3Hex.Tests/ModelTests.cs b/src/Gen3Hex.Tests/ModelTests.cs index cfa4da2e..7ccd9a28 100644 --- a/src/Gen3Hex.Tests/ModelTests.cs +++ b/src/Gen3Hex.Tests/ModelTests.cs @@ -415,5 +415,6 @@ namespace HavenSoft.Gen3Hex.Tests { // TODO putting a new anchor with the same name: delete any run that starts at that anchor, repoint everything from the old location to the new location // TODO undo/redo + // TODO file load/save (metadata file / TOML) } } diff --git a/src/Gen3Hex.WPF/Controls/HexContent.cs b/src/Gen3Hex.WPF/Controls/HexContent.cs index b9410398..c071511d 100644 --- a/src/Gen3Hex.WPF/Controls/HexContent.cs +++ b/src/Gen3Hex.WPF/Controls/HexContent.cs @@ -203,7 +203,15 @@ namespace HavenSoft.Gen3Hex.WPF.Controls { var anchor = (Core.ViewModels.DataFormats.Anchor)ViewPort[p.X, p.Y].Format; var panel = new StackPanel { Background = Solarized.Theme.Background }; - var menu = new Popup { Placement = PlacementMode.Mouse, Child = panel, StaysOpen = false }; + var menu = new Popup { + Placement = PlacementMode.Mouse, + Child = new Border { + BorderBrush = Solarized.Brushes.Blue, + BorderThickness = new Thickness(1), + Child = panel, + }, + StaysOpen = false, + }; if (anchor.Sources.Count > 1) { panel.Children.Add(new Button { @@ -225,16 +233,14 @@ namespace HavenSoft.Gen3Hex.WPF.Controls { })); } } else { - panel.Children.Add(new ScrollViewer { + panel.Children.Add(new ListBox { MaxHeight = 120, - Content = new ListBox { - ItemsSource = anchor.Sources.Select(source => source.ToString("X2")).ToList(), - }.SetEvent(Selector.SelectionChangedEvent, (sender, e) => { - var source = anchor.Sources[((ListBox)sender).SelectedIndex].ToString("X2"); - ViewPort.Goto.Execute(source); - menu.IsOpen = false; - }), - }); + ItemsSource = anchor.Sources.Select(source => source.ToString("X2")).ToList(), + }.SetEvent(Selector.SelectionChangedEvent, (sender, e) => { + var source = anchor.Sources[((ListBox)sender).SelectedIndex].ToString("X2"); + ViewPort.Goto.Execute(source); + menu.IsOpen = false; + })); } menu.IsOpen = true; diff --git a/src/Gen3Hex.WPF/Windows/App.xaml b/src/Gen3Hex.WPF/Windows/App.xaml index e4deaa2b..59cd1788 100644 --- a/src/Gen3Hex.WPF/Windows/App.xaml +++ b/src/Gen3Hex.WPF/Windows/App.xaml @@ -407,5 +407,32 @@ + + + + + + + + + + +