Welcome to WindowsClient.net | Sign in | Join

Rob Relyea - XAMLified

WPF, Silverlight and XAML

Syndication

Sponsors





  • advertise here
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:

  1. Add FullScreen mode (per Mike Taulty’s suggestion). When I did that, I realized I needed to also saving WindowState into config.xaml.
  2. 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…)
  3. 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.
Published Thursday, January 21, 2010 6:44 AM by Rob_Relyea

Comments

# re: XamlPadSample Step 1b-fullscreen@ Thursday, January 21, 2010 11:53 AM

@Steve-

Yes, that looks like a good technique to wire parent pointers for collections.

Will tidy up the code a bit with that change.

Thanks, Rob

(by the way, not everything in this code is best practices yet...i need to move the "menu" to commands, etc...)

# re: XamlPadSample Step 1b-fullscreen@ Friday, January 22, 2010 3:10 AM

Of course :) but every bit helps and this just makes it a lot easier on the coding side :p

by Steve

# Dew Drop – January 22, 2010 | Alvin Ashcraft's Morning Dew@ Friday, January 22, 2010 9:15 AM

Pingback from  Dew Drop – January 22, 2010 | Alvin Ashcraft's Morning Dew

# Enlaces Interesantes WPF/Silverlight 22-01-2010@ Friday, January 22, 2010 10:00 AM

Hola vengo con los enlaces interesantes de hoy pero quisiera resaltar uno y establecer un pequeño

# Windows Client Developer Roundup for 1/25/2010@ Monday, January 25, 2010 1:55 AM

This is Windows Client Developer roundup #8. I’m off in Reykjavik Iceland this week, speaking about Silverlight

Leave a Comment

(required) 
(required) 
(optional)
(required) 
Page view counter