Trigger when application is not active - winforms

I have an application(Winform, TAB based MDI application), now we are adding few features. These Features are developed in WPF. A new form contains Element host, which will host this WPF User control. This newly added Form is displayed in every Tab's one corner. When application minimizes/Maximizes events are trigger, through these I am able to show or hide this new form. Also, this new form's Topmost Property is set true.
But when main form is still showing and when another application(like a note pad) is opened, the newly added form displayed over this notepad. The new form supposed to go behind the notepad, but it is always top.
Any suggestion on how to send it back.
Thank you,

Selected answer from
Detect when application becomes active post solved my problem.
I am also capturing
main.Deactivate += new EventHandler(main_Deactivate);
Thank you.

Related

Finding empty label in Windows form

I am new to Windows Form application and trying to build a small application.
I had dragged and dropped a label on the main form.
Then I deleted its text property to empty string basically hiding the label.
Now I would like to move this label to some other location on the form but unable to do so because I cannot find it.
I checked the designer file and its there.
But I cannot find it in the form so that I can grab it and move to a different location.
Please help.
Thanks
Use Document Outline. Look at the following images.
That happens to me several times, and a few weeks ago I found a way to get the empty label like this:
On the tab "Properties" just click on the arrow to show all controls and click on the label you want, this will automatically select the label on your form..

DevExpress DateEdit Force user to use menu popup

I have a WinForms app that uses this control and I would like to prevent the user from typing in a date. We want to make them have to use the popup calendar to make the date selection.
I tried setting ReadOnly of course but that puts the whole control into the read only state.
Our version of DevExpress is: 9.1.9.0
You can accomplish this task using the RepositoryItemButtonEdit.TextEditStyle property.
Assign the DisableTextEditorvalue with this property. In this mode a button editor is displayed in its normal way. However, editing and selecting text is not allowed.
Code snippet:
dateEdit1.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.DisableTextEditor;

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.

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

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 :)

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