Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6152957
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T20:00:40+00:00 2026-05-23T20:00:40+00:00

I have many different windows and they all have a different design. The different

  • 0

I have many different windows and they all have a different design. The different windows are selected in a menu. The menu has screenshots of the windows in every row. I would like to find a way and automatize the following steps:

  1. make a screenshot of the window
  2. insert the picture in the new window
  3. link the click handler

So, actually my question is, whether it is possible to get the image of the yet hidden window during runtime

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T20:00:41+00:00Added an answer on May 23, 2026 at 8:00 pm

    This should give the idea. I have a control template for my windows. This template has a VisualTarget element that wraps all the other controls in each instance. So the code below works for me.

    class ThumbnailView
    {
        public Guid WindowGuid { get; set; }
        public Window ApplicationWindowInstance { get; set; }
        public Border ThumbnailVisual
        {
            get {
                return (this.ApplicationWindowInstance.
                                Template.FindName("VisualTarget", 
                                this.ApplicationWindowInstance) as Border);
            }
        }
    }
    
    <Border BorderThickness="0,0,0,0" Cursor="Hand">
        <Border.Background>
            <VisualBrush Visual="{Binding ThumbnailVisual}"/>
        </Border.Background>
    </Border>
    

    Edit: Here is something more general

    ObservableCollection<WindowInstance> _windows = new ObservableCollection<WindowInstance>();
    
    class WindowInstance
    {
        public Window CurrentWindowInstance { get; set; }
        public DependencyObject CurrentVisual {
            get {
                return VisualTreeHelper.GetChild(CurrentWindowInstance, 0);
            }
        }
    }
    
    <ItemsControl ItemsSource="{Binding}">
        <ItemsControl.ItemsPanel>
            <ItemsPanelTemplate>
                <StackPanel></StackPanel>
            </ItemsPanelTemplate>
        </ItemsControl.ItemsPanel>
        <ItemsControl.ItemTemplate>
            <DataTemplate>
                <Border BorderThickness="0,0,0,0" Width="50" Height="50">
                    <Border.Background>
                        <VisualBrush Visual="{Binding CurrentVisual}"/>
                    </Border.Background>
                </Border>
            </DataTemplate>
        </ItemsControl.ItemTemplate>
    </ItemsControl>
    

    Edit: Examples above are using live visual brushes which could lead to a performance breakdown. So following is the answer for frozen window thumbnails.

    ObservableCollection<BitmapFrame> _windowCaptures = new ObservableCollection<BitmapFrame>();
    
    TestWindow testWindow = new TestWindow();
    RenderTargetBitmap bitmap = new RenderTargetBitmap((int)testWindow.Width, (int)testWindow.Height, 96, 96,
                                            PixelFormats.Pbgra32);
    bitmap.Render((Visual)VisualTreeHelper.GetChild(testWindow, 0));
    _windowCaptures.Add(BitmapFrame.Create(bitmap));
    
    <ItemsControl ItemsSource="{Binding}">
        <ItemsControl.ItemsPanel>
            <ItemsPanelTemplate>
                <StackPanel></StackPanel>
            </ItemsPanelTemplate>
        </ItemsControl.ItemsPanel>
        <ItemsControl.ItemTemplate>
            <DataTemplate>
                <Image Height="100" Width="100" Source="{Binding}"></Image>
            </DataTemplate>
        </ItemsControl.ItemTemplate>
    </ItemsControl>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have many emails coming in from different sources. they all have attachments, many
I have seen this problem arise in many different circumstances and would like to
I have an application that has many different types of objects that each persist
I have many labels as children of many different stack panels which are all
I have many different branches/checkouts of the same project code on my development machine.
I have a base class object array into which I have typecasted many different
I have a database that many different client applications (a smattering of web services,
I have an application with many different parts, it runs on OSGi, so there's
I have many tables with identical schemas but different names. Can I create a
I have a servlet that is used for many different actions, used in the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.