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 162327
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T11:22:15+00:00 2026-05-11T11:22:15+00:00

I have followed the Accepted Answer’s instructions from this post as regards creating a

  • 0

I have followed the Accepted Answer’s instructions from this post as regards creating a code behind file for a Resource Dictionary, and it worked…so now I can attach events to controls in the generic.xml file.

But now I want to be able to call the DragMove() method from an event in there and since there aren’t any references to the window hosting the dictionary at the time, I don’t know how to call this DragMove() method.

So, from a Resource Dictionary Code behind file, is there any way I can make a reference to the window that will currently be hosting that Resource Dictionary?


[Update] (Temporary Solution)

As a simple (yet stupid) workaround, I have currently done the following:
Since I can reference the Application.Current.MainWindow from the Generic.xaml.cs code-behind, I now have this in the Generic.xaml.cs:

private void Border_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) {                    Application.Current.MainWindow.DragMove(); } 

And then I’m attaching PreviewMouseLeftButtonDown handler to each Window I have, like such:

private void Window_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e) {     Application.Current.MainWindow = this; } 

It, well, it works…and until someone can come up with the proper way on how to do this, It should serve me well enough.

  • 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. 2026-05-11T11:22:16+00:00Added an answer on May 11, 2026 at 11:22 am

    There is no way I know of doing this. However, if you’re trying to determine the Window given a specific resource, you could use a RelativeSource:

    <SolidColorBrush x:Key='MyBrush' Color='{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}, Converter={StaticResource WindowToColorConverter}'/> 

    And if you’re doing it from code, you can use Window.GetWindow(). You just need a DependencyObject hosted in that Window.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 76k
  • Answers 76k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer Sure - just use Contains - using Northwind as an… May 11, 2026 at 2:55 pm
  • added an answer I have resolved the problem! In DiscountASP I have changed… May 11, 2026 at 2:55 pm
  • added an answer There are several great workflow engines for Java JBPM is… May 11, 2026 at 2:55 pm

Related Questions

I have followed the Accepted Answer's instructions from this post as regards creating a
I have a very fast web server (IIS6, ASP.NET) that I want to use
I set up a website to use SqlMembershipProvider as written on this page .
Thanks for the three excellent answers which all identified my problem of using "onclick
Let's take a concrete example and hope I can be clear. Suppose the (ordered)

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.