Close, Hide, Move borderless window without passing Window instance MVVM Light

Hi everyone,
I'm now working with an app which is on MVVM Model, and I'm using MVVM Light to make that app . I wonder if I can close the current window and open another one without passing Window instance or not . I've seen a way which helps me to close the current window
without passing the instance through MVVM Command :
return new RelayCommand(() => Application.Current.Windows.Cast<Window>().Single(w => w.DataContext == this).Close());
But what if I handle the MouseDown event, I have to use LinQ so many times.
Can anyone help me please ?

If you want to do something with a window without having a reference to it, you could send a message from a class using the Messenger and then subscribe to this message in the window class itself and close it or do whatever from there.
public class CloseWindowMessage
ViewModel:
return new RelayCommand(() => { GalaSoft.MvvmLight.Messaging.Messenger.Default.Send<CloseWindowMessage>(new CloseWindowMessage()); } );
Window:
GalaSoft.MvvmLight.Messaging.Messenger.Default.Register<CloseWindowMessage>
this,
(action) => this.Close()
Please refer to the following links for more information about how to use the Messenger in MVVM Light:
http://stackoverflow.com/questions/16993918/mvvm-light-messenger-sending-and-registering-objects
https://msdn.microsoft.com/en-us/magazine/dn745866.aspx
Please remember to close your threads by marking helpful posts as answer.

Similar Messages

  • Close/hide "Now Playing" Window?

    iTunes 10.7, Mac OS 10.6.8
    Every time I switch to iTunes from another program, the iTunes window/playlist is partially covered by a large "Now Playing" window.  No matter how often I close this window, it pops back up to the front when I come back to iTunes from another program.  Is there any way to close it and keep it closed?

    Whatever the problem was, it seems to have been solved with today's upgrade to iTunes 11.0.

  • Unexpected performance of Firefox in Windows 7, namely minimize/maximize/close buttons not working and unable to move/resize window.

    I have been using FF for a while now. My main computer was WinXP-32, though I recently bought a new laptop with Win7-64 installed. This problem was never experienced on my WinXP machine.
    Brief description of problem:
    After a time of having FF up and running, the minimize/maximize/restore/close buttons in the top-right no longer work as expected and, if not maximised, I cannot move the window around my desktop nor resize the browser window. When clicked, the buttons will
    rapidly flash on and off continuously without appearing to perform any noticeable function other than temporarily hogging CPU cycles. I've found that clicking (sometimes double clicking) in the main browser window then mousing over the buttons again seems
    to stop them flashing, though does nothing else.
    To minimize/maximize/restore/move/close the window(s), I have to right-click on the relevant tab in my taskbar and pick the desired option. Occasionally, however, even this doesn't work and the right-click menu will disappear as soon as I move the mouse
    over it after right-clicking. 'Show desktop' is a temporary fix for minimising windows and 'ALT + F4' or 'CTRL + W' for closing windows or tabs. This isn't satisfactory and to move or resize a window, I have to close the window in question (sometimes all other
    windows too), reopen it and do what I need to do, though sometimes even this is only a very short fix. If I have to close all the windows, FF will sometimes keep running for a while afterwards, even though no windows are actually open - simply ending the process
    via the windows task manager will fix this though is only a work-around, not a fix.
    One thing I have noticed is that if I manage to move the browser window (when not maximised), for a short period afterwards I can often resize the window successfully. This is more likely to occur if the browser window is not flush with the edge of my screen
    once moved.
    I've tried to include as much information as I can - most of which was determined after several minutes/hours of playing around with different scenarios, trying to manually reproduce particular problems or simply through sheer luck of happening to click
    in the right place at the right time! I hope there is a reasonably fix for this at some point in the not-too-distant future.
    I noticed in some of the threads at another site where people have voiced problems similar to mine, that a link to 'ObjectDock' was discovered in some cases. I do have 'ObjectDock 1.90 Plus' installed on my machine and use it in many ways and so decided
    to see if I could find a connection between the two. I have uninstalled, tested, and reinstalled both programs in a multitude of ways, though could find no conclusive correlation between having both bits of software running or installed at the same time and
    the problems I am experiencing. In my case, at least, this does not appear to be an answer.
    Also, in another thread on this site, someone suggested there might be a link with AVG Anti-Virus Free (I have version 9.0.819) though I've tried uninstalling it and its various add-ons in several different combinations, with no noticeable improvement.
    Sorry for such a long question... If you need to know anything more, just let me know!
    - James
    System Information:
    Operating System: Windows 7 (64 bit)
    Firefox Version: 3.6.3
    Application Basics
    Name
    Firefox
    Version
    3.6.3
    Profile Directory
    <button onclick="openProfileDirectory()"> Open Containing Folder </button>
    Installed Plugins
    about:plugins
    Build Configuration
    about:buildconfig
    Extensions
    Name
    Version
    Enabled
    ID
    Update Service
    1.2
    true
    [email protected]
    Java Console
    6.0.17
    true
    {CAFEEFAC-0016-0000-0017-ABCDEFFEDCBA}
    Adblock Plus
    1.2
    true
    {d10d0bf8-f5b5-c8b4-a8b2-2b9879e08c5d}
    Download Statusbar
    0.9.6.8
    true
    {D4DD63FA-01E4-46a7-B6B1-EDAB7D6AD389}
    Cooliris
    1.11.6
    true
    [email protected]
    FoxTab
    1.3
    true
    {ef4e370e-d9f0-4e00-b93e-a4f274cfdd5a}
    Save File to
    2.0.1
    true
    [email protected]
    1-Click YouTube Video Downloader
    1.4
    true
    [email protected]
    British English Dictionary
    1.19
    true
    [email protected]
    Tab History
    1.0.7
    true
    {84417002-6445-49b4-9fd7-1ef48240fa41}
    Universal Print
    0.4.23
    true
    {BE2100B3-1D80-48eb-ACCF-D26750644378}
    Active Stop Button
    1.3.0
    true
    {9e96e0c4-9bde-49b7-989f-a4ca4bdc90bb}
    Fission
    1.0.9
    true
    {1280606b-2510-4fe0-97ef-9b5a22eafe41}
    Smart Bookmarks Bar
    1.4.3
    true
    [email protected]
    Compact Menu 2
    3.1.1
    true
    {57068FBE-1506-42ee-AB02-BD183E7999E4}
    Menu Editor
    1.2.6
    true
    {EDA7B1D7-F793-4e03-B074-E6F303317FB0}
    Locationbar²
    1.0.5
    true
    [email protected]
    RealPlayer Browser Record Plugin
    1.0
    true
    {ABDE892B-13A8-4d1b-88E6-365A6E755758}
    AVG Safe Search
    9.0.0.812
    true
    {3f963a5b-e555-4543-90e2-c3908898db71}
    Searchbar Autosizer
    1.4.5
    true
    {655397ca-4766-496b-b7a8-3a5b176ee4c2}
    Open Bookmarks in New Tab
    0.1.2010043001
    true
    [email protected]
    Remove New Tab Button
    1.0
    true
    [email protected]
    New Tab Homepage
    0.4.2
    true
    {66E978CD-981F-47DF-AC42-E3CF417C1467}
    SwiftTabs
    0.3.6.8
    true
    {5F4EC95A-FFA8-11DE-898C-667D55D89593}
    Tab Kit
    0.5.8
    true
    [email protected]
    Hide Find Bar
    1.3.1
    true
    [email protected]
    Toolbar Buttons
    0.6.0.8
    true
    {03B08592-E5B4-45ff-A0BE-C1D975458688}
    Java Console
    6.0.19
    true
    {CAFEEFAC-0016-0000-0019-ABCDEFFEDCBA}
    View Cookies
    1.10.1
    true
    {8F6A6FD9-0619-459f-B9D0-81DE065D4E21}
    Adobe DLM (powered by getPlus(R))
    1.6.2.63
    true
    {E2883E8F-472F-4fb0-9522-AC9BF37916A7}
    Modified Preferences
    Name
    Value
    accessibility.typeaheadfind.flashBar
    0
    browser.history_expire_days.mirror
    180
    browser.places.importBookmarksHTML
    false
    browser.places.smartBookmarksVersion
    2
    browser.startup.homepage
    http://www.bath.ac.uk/
    browser.startup.homepage_override.mstone
    rv:1.9.2.3
    browser.tabs.closeButtons
    0
    browser.tabs.tabMinWidth
    77
    browser.tabs.warnOnClose
    false
    extensions.lastAppVersion
    3.6.3
    network.cookie.prefsMigrated
    true
    network.http.pipelining
    true
    network.http.pipelining.maxrequests
    50
    network.http.proxy.pipelining
    true
    places.last_vacuum
    1271706454
    privacy.sanitize.migrateFx3Prefs
    true
    privacy.sanitize.timeSpan
    0
    security.warn_viewing_mixed
    false
    security.warn_viewing_mixed.show_once
    false

    Hi Kossa,
    You can also check if the issue occurs in
    Clean Boot. If the issue disappears in the Clean Boot environment, you can continue to narrow down which entry is causing the issue.
    Besides, uninstall it and re-download
    a fresh copy of FireFox to check the result. If the issue still exists, create a new user account to see if it occurs.
    If the issue persists, you can contact Mozilla Support directly and use Internet Explorer (IE) during the time.
    J
    Please Note: The third-party product discussed here is manufactured by a company that is independent of Microsoft. We make no warranty, implied or otherwise,
    regarding this product's performance or reliability.
    Regards,
    Linda

  • My macbook froze up. Finger gestures work, but I cant close out of any windows. How do I close out the windows without using the track pad?

    My macbook froze up. Finger gestures work, but I can't close out of any windows by clicking on the red "X". How do I close out the windows without using the track pad?

    Command + W will close a window. Command + Q will quit a program.

  • How to handle window controls like minimize,close and move

    Hello,
    I have created a javaFx page with stage style as 'style:StageStyle.TRANSPARENT'
    Now,there are no window controls of close,minimize,move available.I want to add my images for such event and handle them myself. ie, i want to minimize the page by clicking my button.
    Can i do this?
    if yes,then how?
    Thanks to reply
    Anuj

    hello,
    i have found the way to drag and close the window.
    Dragging can be done by :
    onMouseDragged:
                                    function( e: MouseEvent ):Void {
                                        varX = e.screenX-100;
                                        varY = e.screenY-100;
                                  }where varX and varY are used in
    var s: Stage = Stage {
        title: "AppDeploy Demo"
        width : 300 height : 200
        style: StageStyle.TRANSPARENT
        opacity: .9
        x: bind varX
        y: bind varY
    }For closing:
    we can just call s.close();
    Now i just want to know how can i minimize the stage???
    Please help

  • How can i hide( close or exit) the windows media player window from front panel after a video is played.

    I want a video to be played when i star executing a vi. After that i want to remove(hide or close) the media player window from my front panel.how can i do this?
    the vi is attached.
    Electronics and Instrumentation Engineer
    Freelance LabVIEW and Arduino programmer.
    For projects contact me ; [email protected]
    Solved!
    Go to Solution.
    Attachments:
    videovi.vi ‏9 KB

    Check out the attached code.
    If it solves your problem then dont forget to mark this as a solution. Also if you like the answer dont forget to give me kudos
    Tushar Jambhekar
    [email protected]
    Jambhekar Automation Solutions
    LabVIEW Consultancy, LabVIEW Training
    Rent a LabVIEW Developer, My Blog
    Attachments:
    Main.vi ‏14 KB
    MediaPopup.vi ‏21 KB

  • Often, Firefox app will close, but the underlying Windows process will not and cannot be stopped via Task Manager. When this happens, Firefox can no longer be used...the system must be rebooted.

    Hello,
    Often, the Firefox app will close, but the underlying Windows process will not and cannot be stopped via Task Manager. When this happens, Firefox can no longer be used...the system must be rebooted. This happens especially when many apps are running but even though there are plenty of memory resources available.
    I have tried to find if something is using Firefox in the background, but have no way to know what that would be.
    Their are no apparent viruses detected.
    Firefox is version v5.0 and occurred in earlier release.
    System is Windows 7 (64bit).

    well, it's not the same hardware and it's a bit different.
    I managed to pass that stage somehow but I still have a problem
    I don't use the built-in creator tool that comes with Spyrus as it doesn't know how to append a pre-staged media that was created by SCCM that should apply the Windows file system to a second partition and the WinPE to the first partition.
    I managed to do everything. my only problem is that the WTGCreator that comes with SCCM 2012 R2 creates the 350MB partition with FAT32 file system.
    when I boot from the device I get the WinPE, I can choose a task sequence and then it fails when trying to apply the wim file. the error tells me that the 350MB partition is FAT32 which is not supported (even though it chooses the second partition, which
    is all the rest of the disk space)
    what I did was adding another task that converts the 32 Fat partition to an NTFS partition and then the process continues and finishes successfully! but that's a workaround.
    I'm trying to make this process as smooth as possible without having additional steps
    Tamir Levy

  • How to relocate the Minimize, Maximize and Close buttons on the window

    I am a right-hand user, and would prefer if all my Minimize, Maximize and Close buttons on the window are relocated to the right hand side of the window. Anyone got any suggestion to do it ?

    This is just something you end up getting used to, at least it was the case for me.
    It is not possible to move this, without the help of third-party software.
    ShapeShifter is offers customisation of the look of the Windows, but I don't know if it can move the buttons.
    http://www.unsanity.com/haxies/shapeshifter
    But I don't know if it is compatible with Leopard yet.

  • Issue with turning on project 2010 / 2013 - "There is not enough memory to complete the operation. To free up available memory, close programs, projects, or windows you aren't using, and then try again."

    I get the following error after the installation and configuration window of MS Project: "There is not enough memory to complete the operation. To free up available memory, close programs, projects, or windows you aren't using, and then try again."
    It happens both with MS Project 2010 and 2013 on a Windows 7 desktop. 
    I tried installing / uninstalling Office 2010, MS Project, tried installing 32 and then 64 bit versions, clean up, disk error checker, startup changes (msconfig), anti virus, running as Windows 7 and then Windows XP compatible mode. 
    Nothing helps. I see this issue reported as early as 2007 version of MS projects on Microsoft forums, but I do not see any solution anywhere. Any suggestions on how to fix the issue without having to reformat hard drive? Every other application, including
    all other Office programs work seamlessly. 
    I also tried Microsoft support, after an hour and a half of basically doing what I did before, I was told I have to pay 99$ for "premium" support, so someone can look at this bug. 
    I have 16 Gb RAM and more than 200Gb or hard drive free, so actual memory is not the problem. 

    This issue was originally reported with MS Project 2007 and keeps popping up since.
    A quick Google search provides more than 200K pages of results of this issue:
    https://www.google.ca/webhp?sourceid=chrome-instant&ion=1&espv=2&ie=UTF-8#q=There+is+not+enough+memory+to+complete+the+operation.+To+free+up+available+memory%2C+close+programs%2C+projects%2C+or+windows+you+aren't+using%2C+and+then+try+again.
    And 193K results on Bing:
    http://www.bing.com/search?q=There+is+not+enough+memory+to+complete+the+operation.+To+free+up+available+memory%2C+close+programs%2C+projects%2C+or+windows+you+aren%27t+using%2C+and+then+try+again.&go=Submit&qs=n&form=QBLH&pq=there+is+not+enough+memory+to+complete+the+operation.+to+free+up+available+memory%2C+close+programs%2C+projects%2C+or+windows+you+aren%27t+using%2C+and+then+try+again.&sc=0-0&sp=-1&sk=&cvid=4cb023c1fbd94ec2bba9821b095f21f2
    Computer was defragged already. I run more tests, and specifically when MS Projects tries to run, it tries to take all memory, more than 300Gb, on the computer. (DropBox was running at the same time, and warned that there were no space. As soon as MS Project
    stopped attempting to configure itself, everything came back to normal and the available space became available again.)
    Looking through older forum posts, looks like this application tries to take "unlimited" amount of memory. Some registry fixes are mentioned potentially, but I was not able to apply them. 
    Since everything else works, this is a MS Project bug reported by multiple users on various versions of Windows, including Vista and 7, so please provide a fix and not 'not a know bug' lie. All the premium support will say, is to format the hard drive, unless
    they have a patch or a registry edit solution. If the latter is true, since the issue exists for multiple years, it should have been already been provided to users.
    Also, I am not running a SQL server, or any server, this is an installation on a local machine. 

  • How to move existing windows service to cloud?

    Hello team,
    We have one windows service.
    We call it as Monitor Service. This service is running at customer premise and continuously monitor the door controllers fixed at client location. it also update the database in case of any update observed at door control panel. My question is, This Window
    Service is separately running for each customer within their premise to monitor the devices fixed at customer location. How can I move this windows service to cloud (as without VM) such that it will monitor the multiple devices of more than one customers across
    the globe.  if it is not feasible then let us know any other alternate solution. Actually, this is a very grey area for us.
    Thanks,
    Bhavin Modi

    Hi,
    Here are a few key things which you might want to consider while planning your migration to Azure
    https://msdn.microsoft.com/en-us/library/azure/jj156157.aspx?f=255&MSPPError=-2147217396
    Azure provides different hosting models for running applications. Each one provides a different set of services, and so which one you choose depends on exactly what you're trying to do. You may choose any of the below offerings
    Cloud Service (PaaS)
    Virtual Machine (IaaS)
    Websites
    I suggest you to refer to the below article to find the best hosting model per your requirement
    http://azure.microsoft.com/en-us/documentation/articles/fundamentals-application-models/
    Hope this helps !
    Regards,
    Sowmya

  • Automatically hide Skype in Windows 7 taskbar on s...

    Is there a way to make the Skype taskbar field automatically hide when Skype starts up? It did it on XP, now it's not doing it on 7 and I see no option for it. I do know how to make it always show in the notification and close it manually from the taskbar so that is not the problem, I just dislike having to close it manually every time.

    Unfortunately regardless of the settings you still have to close the initial main form manually.  I was wondering if it could be done so I made a C# application to do it.  It just needs to launch after Skype executes.  So if you have it run at startup then you would want "HideSkype" to be the last program running.  Alternatively you can use the provided Skype.cmd file to launch it as well at any time. It's set to a 10 second delay to allow Skype enough time to sign-in automatically to a default account.
    You will probably need .NET Framework 4.0 or above installed or you computer for it to work.  This has been tested many times on my Windows 7 machine.  You will need to fill out the skypeid.txt file with your skypeid for it to work properly.  Be aware this does not close/minimize all of Skype's windows.   It is targeted to solely close the main Skype window.  However, if Skype is set to default view vs. compact view it will close that complete window which includes that active chat session encased in the same window.
    If I find out later I have to correct an error, any new version can be downloaded from here:
    http://www.pcdust.com/Downloads/Skype/HideSkype.zip
    Feel free to scan it with your AntiVirus, mine says it's clean, as it should be. 
    Attachments:
    HideSkype.zip ‏6 KB

  • Hide the Deployment window in a built executable

    My LabVIEW application uses Shared Variables to pass data around, and therefore my built executable needs to deploy the shared variables at launch. This is all handled automatically it seems by the builder/executable, but it results in a Deployment Window appearing when I launch the executable. It takes a good few seconds to deploy all my variables, and until it's done my application panel doesn't appear.
    Personally I think this looks ugly and quite unusual for an application, I'm sure there will be questions asked by the customer, so I was hoping there might be some way to suppress or hide the deployment window?
    This is a snapshot of the window about half way through deployment:
    Thoric (CLA, CLED, CTD and LabVIEW Champion)

    Hi Thoric,
    Unfortunately, it is not currently possible to hide the Deployment Progress dialog box when deploying Shared Variables in and executable. This is confirmed in the Knowledge Base article below.
    Can You Hide the Deploy... Dialog Box that Displays when Downloading to Real-Time Targets Or Buildin...
    I certainly agree with you however that this is a great recommendation for a future feature in LabVIEW and as such I recommend that you post it as a suggestion on the Product Suggestion Center which I have also linked below for your convenience.
    Product Suggestion Center
    Best Regards,
    Christian Hartshorne
    NIUK

  • Cannot Compile CHM -- Message says to close all HTML Help windows

    Running TCS 1.3 with latest patches.
    Single source project - output to HTML Help (.chm).
    When I try to compile, I receive the following message:
    "Cannot create compiled file. It may be open in another window. Please close all HTML Help windows and try again."
    I don't have any HTML Help windows open. Shutting down RH and restarting does not resolve the problem. I have to shut down the computer, which is a serious hassle, before I can compile again. I do work from a network directory, which may be causing it, but I'd like to know if there is a process I can kill from the Windows Task Manager that would allow me to compile without having to restart my computer. I don't see any process that identifies itself as something I can kill to resolve this issue.
    Anyone?

    Hi there
    That message normally indicates you have launched the .CHM file that you are trying to create. The first step of the process is to destroy the existing .CHM in preparation for building the new one. Just as you would need to destroy a house on a lot where you wish to build a new one.
    If your .CHM is on a network drive, another user may have it open. (yet another good reason for working locally)
    If your .CHM is on your local drive, RoboHelp believes you have it open. If you press Alt+Tab, you may see a blue up arrow. That will indicate the running CHM file.
    Cheers... Rick
    Helpful and Handy Links
    RoboHelp Wish Form/Bug Reporting Form
    Begin learning RoboHelp HTML 7 or 8 within the day - $24.95!
    Adobe Certified RoboHelp HTML Training
    SorcerStone Blog
    RoboHelp eBooks

  • Embedded OC4J shuts down every time I close a Jasper Viewer window

    I have created a basic application using ADFBC, one component of the application requires reports which have been made using iReport.
    Now the reports are displayed fine via the application, no problems in passing of params and stuff.
    My program returns the control back to the page after displaying the report using a backing bean. The control does come back, but the moment I close the Jasper Viewer window in which the report is displayed, the embedded oc4j shuts itself down...
    I did check my code to see, if I have mistakenly written any code to cause such an action, but there's none.
    If anyone had encountered a similar scenario, do let me know. Also, would I need to search through the Jasper classes themselves to see if such a situation is handled???
    Thanks,
    Regards,
    zoheb..

    Hello,
    I sincerely apologize for the delay in the reply.
    I deployed the application on a standalong Oc4j server and have found that the same problem persists, the standalone oc4j shuts down when the jasper report window is closed, stalling the entire application.
    Are there any changes which are required to be carried out in the Jasper report libraries to stop this flow??
    thanks,
    regards,
    zoheb.

  • Movie para windows

    He hecho una composición en Adobe Afther Effects 6.5 que tiene varios archivos de imagen capturados con una MATROX DIGISUITE DTV y codificados en DVCPRO 50 y un archivo de audio .wav
    Con el propio AF 6.5 exporto a una movie para windows manteniendo la codoficacion del video y audio en los settings del render
    Como resultado obtengo un unico archivo .avi
    Mi problema es el siguiente: Si importo el archivo en Adobe Premier 6.5 y arrastro el archivo a la timeline solo me aoarece la pista de video y no la de audio. Si le doy play solo sale video por la MATROX y nada de audio
    Si reproduzco el archivo con Windows Media 9 veo imagen en la pantalla del PC pero no en la salida de video de la MATROX y sale perfectamente el audio por la MATROX
    ¿¿Que tendría que hacer para poder tener las dos cosas???
    Tener video y audio en Premier en la salida de MATROX
    Tener video y audio con WMP 9 en la salida de MATROX
    Muchas gracias por las respuestas

    I'll let others answer the question on Windows Movie Maker...
    Keep in mind if you put an HD video on a DVD... not all DVD players will support it.  You may wish to burn to a Blu-Ray disk.
    Personally I use Premiere Elements or Pinnacle Studio.  I create an MP4 file and then save it to a DVD for those without Blue-Ray

Maybe you are looking for

  • Windows system crash when connecting iPod Nano

    The above is a new development. Have had my 2nd Gen iPod Nano for about 3 months with no hitches. Now, however, my system freezes when connecting my iPod for update. The only new bit of software I have downloaded was virus free (according to Norton)

  • Problem with views -- not picking up new records from table?

    Hello, I'm having trouble with some of my views and I can't understand what is wrong. I have a table that contains three months of data. The view references the table, but only picks up the prior two months of data. When I query the table the latest

  • Contact Sheets in Bridge CC

    i have downloaded the output module for Bridge cc, now how do i create a contact sheet from this?

  • Camera RAW 7

    I'm using the Beta version of CS6 and there is a CAMERA RAW 7 program that I would like to use in my Elements program. The RAW editor in Elements (current) always has the sliders in a pre-set configuration, not at zero. Using CS6 Beta, the Camera RAW

  • Ordering the records prior to select

    I have a table 'orderlines' with columns line_id, ship_flag, service_flag, bom_order. I need to generate the order line number in the following way select the orderlines order by bom_order for the first line the line number is 1.0 for the next line i