Non-Modal Popup without fading out the BackGround screen - c#

I'd like to create a popup dialog box in silverlight with a Input-box and a Ok and Cancel button. And the speciality of popup should be that It should not fade-out the master-background screen. And the backGround screen should be scrollable and visibile clearly.
Currently i am using just a Javascript Prompt box on my screen, but its look and feel is not so pleasing.. i am looking for something having a smoother look.

Using Silverlights ChildWindow you'll get a folowing look . Fading out can be disabled though.
UPDATE:
Non modal refactoring

In Silverlight there is a ChildWindow-Control that you can use as PopUp. The ChildWindow has properties to specify the Opacity and the Background of the Overlay, so that you can define if the Background screen is visible.

You can use the ChildWindow control to do this.
And even you can handle the events of this popup window on the parent window.

Related

Show icon in taskbar for hidden windows

When I set the main window's visibility to hidden, No icon is shown in taskbar, so I have no control over the window to show it again. I want for the application's icon to be visible even when I hide the window, and to show the window when I click it's button in the taskbar. (something like minimize behavior)
How can I achieve that using WPF and .Net 4.0 in C#?
Edit: I mean the icon in taskbar (usually in the left and middle of the horizontal taskbar) not the notifyicon in system tray.
So, based on "comments" section, what you are looking to do is minimize or hide a window but still show some windows or dialogues that the window opens. First if you want to keep your window in the task bar, you should minimize with:
this.WindowState = WindowState.Minimized
That can be called from anywhere within the form. As you mentioned, though, this will close hide any dialogues that have this window set as the parent. The key, then is to not use this window as the parent. Lets say your dialogues inherit from form. You want to use:
newWindow.Show();
I am guessing that you are calling "ShowDialog", which ties the window state to the parent window state. Try this out and hopefully it will help!
Edit
One more note: the same is actually true of MessageBoxes, but the way to control the parent form is with the first parameter of the MessageBox.Show() call. If you pass in a form as the first parameter, that will be the parent, otherwise the parent will not be set.

Grey out entire windows screen

I am currently working on a windows form application (C# visual studio).
Is it possible to grey out the entire windows screen when a button is pressed?
How can I work that out?
Is it also possible to grey out the entire screen but leaving an ungreyed space in the middle for a message box for showing some text?
Answers to your question:
Is it possible to grey out the entire windows screen when a button is
pressed?
You can put a control like a panel over the entire window and hide it.
In the button event you then make it visible. Set the background of the panel to gray and vary the transparency to adjust it so until your window visibility beneath it looks right.
This will force the window into a "modal mode" without any way out. So you better have logic for undoing this as well.
How can I work that out?
Make sure you have some event such as completion of an event or query to hide the control or the user will never get back into your application again.
Is it also possible to grey out the entire screen but leaving an
ungreyed space in the middle for a message box for showing some text?
That is more complex and to be honest with you I haven't played with WinForm is some time -- instead doing WPF for desktop. You MAY be able to use clipping but you will have to do quite a bit of research into how to do it. Use Google -- it can be your best friend.
easiest way:use XAML pop-up as described below
<Popup x:Name="pop" IsOpen="False" >
</Popup>
For more details visit below link. http://www.c-sharpcorner.com/UploadFile/mahesh/using-xaml-popup-in-wpf/
After this to blur the main grid on eventhandler for the event which shows the pop-up,set the opacity as shown in below C# code
if (pop.IsOpen == false)
{
pop.IsOpen = true;
grdMain.Opacity = 0.4;
}
else
{
pop.isopen=false;
}

Advantages of popup over panels in Windows Phone

I'm curious about Popup control in Windows Phone. For me, it's some kind of panel, that has IsOpen property. And I should used it, when i want to present some only in some defined context (e.g. button pressed).
But why not use just normal stack, or grid panel, and when use Visiblity when you want to hide, or show it? It's seems to behave the same.
You can change the Horizontal and Vertical position of the popup using the HorizontalOffset /VerticalOffset properties in the Popup control. We don't have that option in the Grid and to other panels.
It is an overlay. It doesn't break page layout as it shows above the main content.
While StackPanel or Grid should be added to main content and when they are shown they'll move other controls down.

How to bring up a message popup in C#?

Most recently, while at my mom's house, a phone call came in and the caller ID popped up in a banner on her TV (Comcast). I've seen a similar functionality when the McAfee brings up a virus warning. It was a translucent popup window with the company logo, message and a button or two.
I'd like to mimic this behavior (via C#). This will event driven. My experience in C# is pretty limited, so I'm still feeling out the different libraries. Are there any ideas on where I should start?
I recommended to use WPF. Create new window, that will popup and set next properties:
WindowStyle="None"
AllowsTransparency="True"
Opacity="0.5" //50% transparent
Topmost="True"
Background property will set color of window.
Place on window any controls what you need.
Create this window and show when some event happens:
YourWindow popup = new YourWindow(/*possible args for message on popup, for example*/);
popup.Show();
To place your window in bottom-right corner, as all popups, use next code in windows Loaded event:
this.Left = SystemParameters.WorkArea.Width - this.Width;
this.Top = SystemParameters.WorkArea.Height - this.Height;
How to make animation of window movement you can read in other questions.
If your app is running in the background, you can simply pop up a window and set it to topmost.
Exactly what you do beyond that is going to depend on what type of UI are using (WPF/WinForms.) WPF makes it easier to build a transparent form, as described here:
http://blogs.interknowlogy.com/2007/06/20/transparent-windows-in-wpf-2/
Transparency in WinForms is a little bit harder, but there are some posts about it:
Partial transparency with C# .NET 3.5 WinForms?
A couple of things you will want to do with your pop-up window:
Disable the minimize/maximize/close buttons
Disable the borders
Just put those in your form so it looks better.
-- Dan

Form looks like a balloon

I am just trying to create a form control in winform in .net with custom shaped of balloon shape.
There is need of a balloon tooltip which is transparent and I can put buttons on tooltip,but
tooltip in .net does not provide facality that we can put the buttons on tooltip control so
I want to make a form control looks like a balloon tooltip and so I can put buttons on that form looking like a tooltip.But I cannot show window form control look like a balloon tooltip.
So what should I do??
I tried in one way that I create a image in powerpoint of balloon shape and set it to as background image of form property.But there is no solution with that.
The Control class supports a BackColor with an alpha < 255, it is automatic. It asks the Parent to draw itself to produce the background of the control, then draws itself on top of that. However, you'll want a top-level window for a balloon. That's a window type that can arbitrarily overlap another window and isn't confined by the client area of an underlying window. It has no Parent. A ToolTip is such a window.
The only control available in Windows Forms that can be an top-level window is a Form. Problem is: the transparency trick no longer works. Since a top-level window doesn't have a Parent, there isn't any obvious window to ask to draw the background. It could be many windows, belonging to other processes. You can get transparency in a Form with its TransparencyKey property. But that's a "hard" transparency, equivalent to an alpha of 0. You probably want a soft one. Another nasty problem is that drawing anti-aliased (ClearType) text no longer works since there is no reliable background pixel color anymore.
Long story short: you can't make this work well unless you confine the balloon to the client area of a form. A control, not a form.
You can try to hook on the Paint event of the control and draw the Visual of the button there.

Categories