WPF menu like control showing when clicking a control ;) How? - wpf

I have an application that connects to a server. In the status bar I show the connection status, and on a click I want to open a "menu like" subcontrol over the status showing control where more detailed connection information is shown (like: user name, server name, ping delay, disconnect / reconnect button).
This should basically look like an inverse menu - and when the user clicks outside of that area, the outside click should be suppressed (not triggering anything), but the detail info box should disappear.
I am a little at a loss here - first time I am to do something like that in WPF.
Which control would be advisable as base here? So far I have a custom control for the status bar - but basically it renders as a text box. Note tha the popup is not a menu - it should show a detailed view of the control, so I do not think I can reuse any existing control.
any Hints how to accomplish this?
Thanks in advance.

Two controls to look into:
1. Expander (this could work, but be carefull, it can shift your other controls
2. Button with template. Make a controltemplate for a button that includes a Popup item. This item can then be bound to a set of triggers/events in the button or in the wider form. I hope this helps :)

Related

How know if right click is on a "text being edited" not/before "text changed" event in winforms?

My question might be simple but I couldn't find specific answer on web.
I have a winforms application with a grid inside, in which I have implemented a context menu to be shown on right click on cells. These cells include text elements that can be edited. When user clicks or double clicks on the cell, the text can be edited and that's what I want. The problem is when the text is in edit mode and user right clicks on it again, 2 context menus are shown on each other. One is my context menu and the other is windows right click on text including options like copy, paste etc.
I wonder if there is any event like "text being edited" or "windows default context menu opened" that can be used for such scenarios? Or what is the proper way of solving this problem, which I guess must be a common one.
In these cases I want to show only the windows right-click menu, not mine.
Perhaps you need the Control.GotFocus event: https://msdn.microsoft.com/en-us/library/system.windows.forms.control.gotfocus%28v=vs.110%29.aspx?f=255&MSPPError=-2147217396
You could look for focus, then prevent right clicks in the control until the control has lost focus (Control.LostFocus). If the control gets focus from a right click, then you could open your context menu (I think).

WPF: Adorner + Popup = Modal Popup

So here's the idea of it...
I have an application that I am designing with WPF. It has a Main Window with a frame inside to navigate through pages. The navigation aspect is done through the window (kind of like a template with a footer that has the navigation controls) and the pages have the individual content. On certain pages I would like to have an ADD (+) button that causes a popup that has a form inside to add personal information to the database (First name, last name, address, .etc) While this popup is open I would not like them to be able to access any other part of the application until they press OK or CANCEL. I'd like to be able to call this popup from the individual pages unless there is another workaround.
Any ideas or assistance would be appreciated!
some wpf popups Here and Here.

WPF + PRISM - show modal popup window with controls in it?

I am following the 'Stock Trader RI' example by the Prism team,
but it does not address this exactly :
I have a Shell with a Main Region in it.
In this shell I have some filter fields and a grid.
When I press on a button - I would like to load a screen that allows me to change the filters,
and then press 'Save'. This would then call a service to update the fields, and close the pop-up.
Here is an illustration of the 'Shell' before pressing the button (left) and after (right) :
Problems are :
The 'Stock Trader RI' sample app only uses a modaless dialog popup. I need a MODAL pop-up (background will continue to refresh, but user will not have access to it as long as pop-up is active).
Need to have Silverlight-like effect when pop-up shows, meaning - 'Shell' needs to appear 'disabled' (like a gray mask over it).
Pop-up window should have no 'X' button and no 'minimize' or 'maximize' buttons. The pop-up window should be simply a rectangle with curved-corners.
I don't think I can use a 'Notification Window' or a 'Confirmation Window' because I cannot put inside them whatever I want. This is an example with 2 fields, but the pop-up might be much more complex with tabs, and a lot of information shown to the user.
So how do I show a modal pop-up from my "WPF+PRISM" Shell-View-Model once the 'Edit' button is pressed ? (Meaning, once the 'EditCommand' is executed...)
I have found a solution here.
Basically it uses InteractionRequest and it allows me to open a window (that I can style however I want, without the 'Maximize' 'Minimize buttons), and also - I can choose for it to be Modal.
Great thing about this solution is - that I can use custom pop-ups and not only Notification or Confirmation pop-ups.
Also - I can pass information back to the class the invoked the 'InteractionRequest'.
Only thing that it doesn't solve - is that I cannot make the calling view look disabled by adding a gray semi-transparent over it ... haven't figured out yet how to do that...

In my Windows Phone app,I want to turn my current page unable in gray and show a textbox in foreground

Like the title said,how may i turn the grid(or page) and the components in it into background gray and unable and show a new component in foreground.
It's a common effect in the web page,but i cannot do that with a xaml.
Please answer in detail better with sample code if you do.Thanks in advance.
Here's an example of using a Popup to display a UserControl when a Page is navigated to. The OnNavigatedTo function creates a popup, binds a Click event to the UserControl, and then shows the UserControl over the entire page. If the correct password is entered, ("password" in the example) the control disappears. You'll need to modify it for your own requirements, but it should definitely get you started.
https://skydrive.live.com/redir.aspx?cid=ef08824b672fb5d8&resid=EF08824B672FB5D8!343
You'll want to use the VisualStateManager and create some animation transitions to switch between the old and new components. I won't paste the code here for brevity, but if you check out:
http://visualstudiomagazine.com/articles/2011/07/22/wcmob_visual-states.aspx
You'll see a simple example of switching between two UI components on a single page within a Windows Phone 7 PhoneApplicationPage. In your scenario, you'd use this paradigm to create 2 animation storyboards, one for showing an overlay control and one for settings the 'disabled' property on the main grid.

How to interact with other application forms

I am looking for a way to once I see a form by Name add a button to that form and when the user clicks the added button, pull information from the form. For example, if I see the for title - "Stack Overflow - Wnidows Internet Explorer" I would add a button "MyButton" on the form, and when that button is clicked, I would "pull" the information from the "search" box. It should work on Web or Win forms.
Any help would be greatly appreicated.
I found my answer
You need to get the window handle to the form in question.
To put the button on another form you need to create the button and set its owner to the other window and set the buttons window position.
You can use the same window handle to enumerate the child windows to get the text if its an edit control.

Resources