From 41b6a97408365f377afb86afcfbbb1fde4044338 Mon Sep 17 00:00:00 2001 From: Andy McFadden Date: Tue, 11 Jun 2019 14:36:38 -0700 Subject: [PATCH] Populate toolbar icons Extract some XAML icons from the VS2017 Image Library. There's no particular reason to prefer XAML over PNG, but somehow it feels more forward-compatible. (OTOH, defining images as ControlTemplate instances is just weird. Yay WPF.) --- CommonWPF/WPFExtensions.cs | 4 + SourceGenWPF/ProjWin/MainWindow.xaml | 35 +++++- SourceGenWPF/Res/CommandIcons.xaml | 178 +++++++++++++++++++++++++++ SourceGenWPF/SourceGenWPF.csproj | 4 + 4 files changed, 217 insertions(+), 4 deletions(-) create mode 100644 SourceGenWPF/Res/CommandIcons.xaml diff --git a/CommonWPF/WPFExtensions.cs b/CommonWPF/WPFExtensions.cs index 24badf9..429453f 100644 --- a/CommonWPF/WPFExtensions.cs +++ b/CommonWPF/WPFExtensions.cs @@ -62,6 +62,10 @@ namespace CommonWPF { /// Figures out which item index is at the top of the window. This only works for a /// ListView with a VirtualizingStackPanel. /// + /// + /// See https://stackoverflow.com/q/2926722/294248 for an alternative approach that + /// uses hit-testing, as well as a copy of this approach. + /// /// The item index, or -1 if the list is empty. public static int GetTopItemIndex(this ListView lv) { if (lv.Items.Count == 0) { diff --git a/SourceGenWPF/ProjWin/MainWindow.xaml b/SourceGenWPF/ProjWin/MainWindow.xaml index b9cecea..d1ca76c 100644 --- a/SourceGenWPF/ProjWin/MainWindow.xaml +++ b/SourceGenWPF/ProjWin/MainWindow.xaml @@ -30,6 +30,7 @@ limitations under the License. + + size when the window is resized. This needs to be the last thing defined in the + DockPanel, so that LastChildFill will expand this to fill all available space. --> diff --git a/SourceGenWPF/Res/CommandIcons.xaml b/SourceGenWPF/Res/CommandIcons.xaml new file mode 100644 index 0000000..6e877b1 --- /dev/null +++ b/SourceGenWPF/Res/CommandIcons.xaml @@ -0,0 +1,178 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/SourceGenWPF/SourceGenWPF.csproj b/SourceGenWPF/SourceGenWPF.csproj index 14e655a..818396e 100644 --- a/SourceGenWPF/SourceGenWPF.csproj +++ b/SourceGenWPF/SourceGenWPF.csproj @@ -169,6 +169,10 @@ Designer MSBuild:Compile + + Designer + MSBuild:Compile + Designer MSBuild:Compile