XamlPadSample Step 1b-fullscreen
Enjoyed the feedback I got via blog comment/email about XamlPad/XamlDesigner. I decided today to focus on some of Mike Taulty’s feedback.
Already Done
One comment from Mike Taulty was already taken care of:
Allow for quick navigation through a set of pre-loaded files. i.e. maybe I hit the -> arrow key and the next file is loaded & displayed rather than having to drag a snippet.
You already can load a set of files with Open, close the app. Config.xaml will now contain the list of those files. Next time you run the app, it will open those.
Pressing ctrl-tab, ctrl-shift-tab will move forward/backward through the tabs that are open.
New Stuff I Coded
In my early morning coding today, I focused on three main things:
- Add FullScreen mode (per Mike Taulty’s suggestion). When I did that, I realized I needed to also saving WindowState into config.xaml.
- Tried to start saving Selections per document, partially motivated by Mike’s request to: Make it slick to show "here's a piece of XAML I'm highlighting for you & here's its effect on-screen".
- (TODO: need to learn how to make a WPF TextBox display its selection even after it lost focus…)
- Fixed a bug so that closing the window would prompt to save changed documents, just like the exit button would.
I posted XamlPadSample-2010-01-21.zip with these updates. (XamlPadSample links to all the posts/samples in this series)
Detailed change list
XamlPadHelpers project
- XamlPadConfig.cs
- added WindowState and WindowFullScreen properties.
- UserSettings.cs
- added SelectionBrush property (bound to XamlPad.xaml’s TextBox.SelectionBrush).
- XamlDocumentViewModel.cs
- In order to enable saving the selection per document, added SelectionStart and SelectionLength properties (with DefaultValueAttribute of 0, so they won’t get written into config.xaml unless there are non-default values).
- XamlDocument.cs
- Added DefaultValueAttribute(null) for ExceptionMessage to avoid ExceptionMessage=”{x:Null}” in config.xaml
- XamlPad.xaml
- Added to TextBox: SelectionBrush="{Binding XamlPadConfig.UserSettings.SelectionBrush}"
XamlPadSample project
- MainWindow.xaml
- Added to Window: WindowState="{Binding WindowState, Mode=TwoWay}"
- Put ToolBar in ToolBarTray, added new ToolBar with FullScreen button.
- MainWindow.xaml.cs
- Implemented FullScreen feature
- (todo: F11/Escape support. also would be nice to make menus/tabs potentially disappear)
- Set UserSettings.SelectionBrush in default routine (likely need a new color…)
- Fixed bug to make Alt-F4 or window close via X call into the same handling that the Exit button does…so it asks you to save changes.
- When creating windows to show via ShowDialog, added Topmost = this.TopMost to work in FullScreen mode too.