Catch resizing of window in Silverlight Popup - silverlight-4.0

I'm using a usercontrol with a popup element in it to create some kind of notification system.
There's the possibility that some notifications will be non-timed, so they stay open until the user interacts with it. This works allright, but when the user resizes the browser, the popup control has the wrong size.
I've tried catching the sizechanged on the usercontrol, but that doesn't get called (seems obvious now).
The one solution I have is catching the sizechanged on the mainwindow and applying it to the usercontrol. This notification usercontrol is singleton, so I can do it once and all notifications will have the right size. I just don't feel like this is the right solution.
Any other ideas on this matter?

Related

Pass TappedEvent to a sibling controll in uwp

I have a user control with a bunch of buttons behind a scroll viewer that has a grid with a bunch of rows in it. The first row is empty. The buttons in user control need to respond to tap/click when not obscured by scroll viewer's content. My problem is that the scroll viewer caches the tap event and it is not passed to the user control because it is a sibling to the scroll viewer. I would like to somehow pass/propagate the tap event to the user control to get the buttons working. I can't find a good solution to this issue because there seems to be no RaiseEvent(e) method on UI elements in uwp. Due to specific requirements, the whole page needs to react to scroll and the buttons are required to be behind the scroll viewer content. Does anyone know if it is possible to pass the whole event to another element or somehow allow for both controls to handle it? Thanks in advance.

Durandal modal dialog position issue when content added after initial display

I display a modal dialog with a small "please wait" message whilst an Ajax request is underway. Once that request is finished, the result is injected into the content of the modal dialog. If it is significantly larger, obviously the size calculations are thrown off and the "OK" button disappears off the bottom of the screen, requiring a reload to clear the modal!
Is there anything that can be done to resize/reposition the modal dialog after I inject the new content into it, or do I need to change my logic to show a "please wait" and then close it and display the new modal dialog in its completed state?
If you wish to take over the repositioning logic of a Durandal dialog, you would create a custom dialog context. Place your repositioning logic inside of the compositionComplete handler.
Resize, on the other hand, can be handled strictly with CSS. But it can be handled in the compositionComplete handler of the custom dialog context as well.
We have written several custom dialog contexts, and use the approach above to achieve what you are trying to achieve. We have even gone so far as to include special animations in the compositionComplete handler.
Take a look here in Durandal's documentation.
Also, I have uploaded to my public OneDrive a short movie of one of our custom dialog contexts. You can view it here. The slide-out window that pops in front is actually a custom Durandal dialog context.
In Durandal 2.1.0, there will be a method to to reposition the dialog. See:
https://github.com/BlueSpire/Durandal/blob/Version-2.1.0/docs/2.x/Showing-Message-Boxes-And-Modals.html.md#repositioning-dialogs-after-their-contents-have-been-changed

In Objective-C/Cocoa, are there global events for when mission control is activated or spaces are changed?

I'm currently working on an OSX menubar app that uses a custom status item view and a NSPopover to display content.
I'm trying to get it to dismiss at times that would make sense like when spaces are changed, since the popover doesn't move spaces like a window does, or when mission controller is activated.
Currently, when in mission control, the NSPopover stays on top as shown in this screenshot.
Currently I'm using NSEvent addGlobalMonitorForEventsMatchingMask: with some mouse event masks and that works alright but doesn't cover all needed events.
So, is there a way to detect when major OS events happen like opening mission control, changing spaces etc?
Any help would be greatly appreciated.
You can get notified of space changes by registering for NSWorkspace's NSWorkspaceActiveSpaceDidChangeNotification. There isn't a notification as such for Mission Control, but you might investigate whether NSWorkspaceDidActivateApplicationNotification or other notifications can be used to determine what you need.
HTH

Using Popup control in Window 8

Is there any property of pop up , wherein we can dim the window app.
As in metro app there is no Child Window control available , so using
popup in place of it but the problem in popup is when it is open the
user can still interact with other control on window app.
So is there an workaround to make the window app dim when pop is open.
I'm not sure to understand what your trying to do. You can put a Border as first child of the popup which exposes the Background property. So if you specify a not null Background (Transparent for instance) the popup will catch every interactions.
It sounds like you want the MessageDialog class. The popup is meant to be non-modal, letting the user close it by just clicking away from it. The MessageDialog is a regular modal popup that does not let the user interact with the rest of the app when it is displayed.
If you really insist on using the popup control, here is a simple workaround:
Make the popup use all the screen (using a grid or border), then set that background to Black with opacity 0.1 (or any other color you see fit, this is to give a "dim" effect), then inside this popup, place another container with the size and margins that you want to act as your "real" popup.
Because the popup takes the whole screen it will prevent the user from clicking anywhere in the screen.

Keeping window of another application active while still receiving mouse events from another app's window?

Is there a way to have my app's window receive keyboard and/or mouse events (i.e. user clicking on window's buttons) while still retaining focus to another, unrelated app?
I've tried configuring my window at different levels, including [myWindow setLevel:NSPopUpMenuWindowLevel] to no avail.
You should be able to handle mouse clicks without ordering your window front by making your views (at least the ones that handle mouse clicks) respond to acceptsFirstMouse: messages by sending NSApp a preventWindowOrdering message and then returning YES.
You should not make your app handle typing without ordering itself front. The user might not realize where their typing is going if the field where it's appearing is obscured by another window.
Found it. Simple, yet elusive.
Use NSPanel and make sure panel style is Non Activating (NSNonactivatingPanelMask) or tick the same option in IB's inspector.