Question

Image on Standard Switcher window

Posted 6 years ago by Avatar FinallyInSeattle
Is there any way to provide the image that the Standard switcher window displays? The top left portion of our screens aren't distinct enough to identify the window.

Thanks in advance!

[Modified at 01/16/2009 06:52 PM]

Comments (8)

Posted 6 years ago by Actipro Software Support - Cleveland, OH, USA
FinallyInSeattle,

Not directly but our switchers are extensible so this most likely could be done with a small amount of work.

You could probably create a class that inherits StandardSwitcher, then override OnSelectedWindowChanged (don't call the base method), and in your override do this to get the preview area:
Border preview = this.GetTemplateChild("PART_Preview") as Border;
Then set the preview Width/Height and background to whatever you need to show. this.SelectedWindow would return the currently selected window that should be displayed in the switcher.

Actipro Software Support
Posted 6 years ago by FinallyInSeattle
I'm invoking the following code in OnSelectedWindowChanged:
    private void SetSwitcherImage()
    {
      Border preview = this.GetTemplateChild("PART_Preview") as Border;
      InternalWindow wdw = this.SelectedWindow as InternalWindow;
      if (wdw != null)
      {
        preview.Height = wdw.ThumbnailHeight;
        preview.Width = wdw.ThumbnailWidth;
        preview.Background = wdw.Thumbnail;
        System.Diagnostics.Debug.WriteLine("ONSELECTEDWINDOWCHANGED - " + wdw.Title);
      }
    }
The thumbnail of the first selected window appears correctly and the rest of them appear as blank. I've verified that thumbnails themselves arent' blank. Is there something I need to reset between assigning subsequent visual brush's to the background of the border?

Thanks!
Posted 6 years ago by Actipro Software Support - Cleveland, OH, USA
If you can send over a small sample project to our support address, then we can take a look. By default, StandardSwitcher shows the contents of the Window, not the window itself. In addition, it will call UpdateLayout on the contents (if a UIElement).

I suspect the problem has to do with the Thumbnail property, but can't be sure (since there's no code for it). But we'd can debug it in the sample project.

Actipro Software Support
Posted 6 years ago by FinallyInSeattle
The Thumbnail property is a VisualBrush that is an image of the screen.
Posted 6 years ago by Actipro Software Support - Cleveland, OH, USA
The StandardSwitcher uses a VisualBrush as well, so I suspect you either need to build a VisualBrush from the Window contents and/or call UpdateLayout on the contents before building the VisualBrush.

Again, if you send over a project we can take a look.

Actipro Software Support
Posted 6 years ago by FinallyInSeattle
Would you be able to send the block of code that updates the background of the border in the Switcher window? My VisualBrush's aren't blank - it's just that only the first one is displayed when the Switcher window comes up. Subsequent updates to the border background display a blank area. I'm looking to see if you're doing any refreshes on the border object itself.

Thanks for your assistance!
Posted 6 years ago by Actipro Software Support - Cleveland, OH, USA
No, we are doing any special refreshes on the Border (PART_Preview). If you email over your code snippet, then we can compare that with ours over email.

Actipro Software Support
Posted 6 years ago by FinallyInSeattle
Got it - switched to using an ImageBrush instead and it works. Thanks for all your assitance!
Information The latest build of this product (2014.1 build 0602) was released 1 month ago, which was after the last post in this thread.

Add a Comment

Please log in to a validated account to post comments.