Questions tagged [window]

In computer science a window is a graphical interface to let a user interact with a program. Questions regarding Microsoft Windows should use the "Windows" tag.

A window is an area of the screen containing controls and other objects controlled by a program. A User can use these objects to instruct the program on what to do and the program can use these objects to show outputs related to user commands. A window is an important part of Operating Systems havin a Graphical User Interface (GUI).

9460 questions
74
votes
16 answers

How do you center your main window in WPF?

I have a WPF application and I need to know how to center the wain window programatically (not in XAML). I need to be able to do this both at startup and in response to certain user events. It has to be dynamically calculated since the window size…
paxdiablo
  • 854,327
  • 234
  • 1,573
  • 1,953
72
votes
3 answers

Storing a variable in the JavaScript 'window' object is a proper way to use that object?

(Maybe) I just solved a my problem (How to update front-end content after that a form is successfully submitted from a dialog window?) by "storing" / "saving" a variable in the JavaScript window object. However, since I am newbie in JavaScript…
Backo
  • 18,291
  • 27
  • 103
  • 170
70
votes
11 answers

window.close() doesn't work - Scripts may close only the windows that were opened by it

I'm having a problem always when I'm trying to close a window through the window.close() method of the Javascript, while the browser displays the below message on the console: "Scripts may close only the windows that were opened by it." This occurs…
mayconfsbrito
  • 2,085
  • 4
  • 26
  • 45
70
votes
4 answers

Deleting a window property in IE

I can't find any information on this issue; why doesn't the following code work in IE? window.x = 45; delete window.x; // or delete window['x']; IE reports an "object doesn't support this action" error. Does it have anything to do with that…
gasper_k
  • 1,098
  • 1
  • 7
  • 11
69
votes
2 answers

Difference between screen.availHeight and window.height()

I am executing the following Javascript on my browser (Firefox). console.debug("Screen height = "+ screen.availHeight); //outputs 770 console.debug("Window Height ="+ $(window).height()); //outputs 210 (I am using jQuery as well) What is the…
Akshay
  • 1,735
  • 6
  • 21
  • 29
67
votes
5 answers

What's the difference between the Window.Loaded and Window.ContentRendered events

What's the difference between the Window.Loaded and Window.ContentRendered events in WPF? Is the ContentRendered event called first? The description of the Window.ContentRendered event here just says Occurs after a window's content has been…
Tony Vitabile
  • 8,298
  • 15
  • 67
  • 123
65
votes
7 answers

Rolling window for 1D arrays in Numpy?

Is there a way to efficiently implement a rolling window for 1D arrays in Numpy? For example, I have this pure Python code snippet to calculate the rolling standard deviations for a 1D list, where observations is the 1D list of values, and n is the…
c00kiemonster
  • 22,241
  • 34
  • 95
  • 133
64
votes
6 answers

How to make title bar disappear in WPF window?

I know this has been asked before but I've tried answers: How to create a WPF Window without a border that can be resized via a grip only? How to remove the title bar from a window but keep the border and neither work, the title bar text sits…
Stewart Stoakes
  • 797
  • 1
  • 8
  • 13
63
votes
4 answers

No creation of a WPF window in a DLL project?

Is there a reason why Visual Studio won't let me create a WPF window in a DLL project? I "solved" it by creating a window in an Application Project and copying it to my DLL project. I also found that I could just create a UserControl and change the…
Antoine Jeanrichard
  • 1,103
  • 1
  • 10
  • 18
63
votes
5 answers

Refer to active Window in WPF?

How can I refer to active Window of WPF application in C#, using something like ActiveForm property in WinForms?
pkain
  • 657
  • 1
  • 6
  • 6
62
votes
5 answers

What is the correct way to dispose of a WPF window?

I have a WPF window which I am creating from another window by calling Show(), then letting it Close() itself. When the window closes, I expect it to die, call its destructor, and delete all its child elements (such as timers..). What is the correct…
vanja.
  • 2,532
  • 3
  • 23
  • 39
61
votes
7 answers

How to set the location of WPF window to the bottom right corner of desktop?

I want to show my window on top of the TaskBar's clock when the windows starts. How can I find the bottom right corner location of my desktop? I use this code that works well in windows forms app but does not work correctly in WPF: var…
Mahdi7s
  • 813
  • 1
  • 9
  • 14
61
votes
9 answers

JavaScript, browsers, window close - send an AJAX request or run a script on window closing

I'm trying to find out when a user left a specified page. There is no problem finding out when he used a link inside the page to navigate away but I kind of need to mark up something like when he closed the window or typed another URL and pressed…
zozo
  • 8,230
  • 19
  • 79
  • 134
60
votes
9 answers

WPF: Cannot reuse window after it has been closed

I am trying to keep one instance of a Window around and when needed call ShowDialog. This worked find in winforms, but in WPF I recieve this exeception: System.InvalidOperationException: Cannot set Visibility or call Show, ShowDialog, or…
Jerod Houghtelling
  • 4,783
  • 1
  • 22
  • 30
60
votes
4 answers

How to prevent closing browser window?

I tried the following code to get an alert upon closing a browser window: window.onbeforeunload = confirmExit; function confirmExit() { return "You have attempted to leave this page. If you have made any changes to the fields without clicking the…
user42348
  • 4,181
  • 28
  • 69
  • 98