I have a populated ListView dialog. If a user clicks on an option in the ListView, a new dialog is shown above the ListView.
My problems is that when I click off of the new top-most dialog (onto the ListView behind it), the new dialog's borders flash/blink several times. The icon on the taskbar also flashes. I wish to disable the flashing, but cannot find a property to change.
To show my dialog, I use the following code:
if (detail == null)
detail = new Details(opt, val, user, desc, m_l);
else
detail = null;
detail.ShowDialog();
This is intended behavior, it's because the new dialog is modal. It's drawing attention to the fact that something needs to be done.
If you need to make a non-modal form, instead of using ShowDialog(), simply use Show().
Sounds like to me you are creating modal windows each time. And you cannot resume the previous dialogs until you dismiss your new top-most window.
Take a look at this wikipedia article for information about modal dialogs.
I would advise you look at how you are creating/showing your windows.
In WPF you show windows via Show() or ShowDialog(), however, I do not know which type of ListView you are using
EDIT:
Per your comment, you want modal dialogs. The only ways I can think of even trying to remove the flashing is going into WINAPI. This doesn't seem like a job for .NET.
I want to suggest a few things:
Take a look at options for showing each window. See this MSDN page
Take a look at the options for styling each window. See this MSDN page
Reconsider your design. I know this may take a lot of work, but having so many layers of windows is kind of unappealing to most users. Ultimately, I believe this option will make your application the best.
Thank you all for your answers and guidance. I have found the best way to handle my problem.
I was using an event ItemActivated. This event was called when an a highlighted item on the ListView was clicked. This became a problem when the user would double click on an already selected item. This would cause the new dialog to show, but also flash several times.
By using the DoubleClick event instead, a single click on a selected object does nothing. A double click on either a selected or non-selected item opens the dialog without the flashes. The flashes still appear if you try to click off of the dialog box, but are not as much of an issue.
Related
I have a WPF Window in which I want to "open" other windows/interfaces. So that when I click on one of the labels, a "Popup" opens where I can do stuff (Input via a Textbox, images, buttons etc.). I already found this but it seems that this is not really what i am looking for. Images below. Would be nice if someone could point me in the right direction.
What I have
What I want to do/how it should look
This project shows how you can display dialog like content in a DropDownButton control:
https://github.com/Dirkster99/fsc/blob/master/source/Apps/FolderBrowserDemo/MainWindow.xaml
So, I think you probably do want a DropDownButton control like this:
https://github.com/Dirkster99/DropDownButtonLib
with a custom view as shown in your screenshot. This solution is quit advanced though but I hope it helps.
I'm calling my custom dialog window with this code:
GUI.SLDialog sd = new GUI.SLDialog();
if (sd.ShowDialog() == false)
{
return;
}
But sd.ShowDialog() always returns nothing (i think), because the function breaks, but the waypoint at return; isn't reached.
Dialog is automaticly closing when I add to button:
this.DialogResult = false;//or true
Anybody know what am I doing wrong?
Thanks in advance for your help.C.H.
#edit
This is my SLDialog:
xaml: http://wklej.org/hash/9fb67fb0c7c/
cs: http://wklej.org/hash/16e3ccc6c0d/
I don't think I can tell you much here unless you post the code for the dialog but I do have a suggestion in the mean time.
Since you're already unhappy with the standard dialog boxes and customization is clearly an option why not move towards what people are coming to expect? Instead of your standard dialog why not just create a user control that lays over the rest of your UI and blurs everything out from the background? Much like a jquery dialog box you might see on a web page.
Modality is easier to control since it's just a matter of covering your entire app window with a translucent rectangle and then make the dialog window appear however you want.
Just a suggestion.
I need to show a MessageBox with the Show Details option , like what we get during normal windows exceptions. When the user clicks the show details option, it has to expand and show the collection of details to the user. How to achieve it in Windows forms?
Thanks in advance
These dialogs are not exposed as part of any API and so you need to create your own dialog that behaves the same way.
A dialog is simply a standard form shown using the ShowDialog method:
DetailsMessageBox dialog = new DetailsMessageBox();
if (dialog.ShowDialog() == DialogResult.OK)
{
// Handle me
}
Before your dialog closes you should set the DialogResult property of the form is set to the desired dialog outcome - you can get buttons to automatically set the dialoig result (and close the dialog) for you when they are clicked by setting the DialogResult property of the button to the desired result.
You should also set the AcceptButton and CancelButton properties of your dialog to suitable buttons so that the dialog is closed when the use presses Escape or Enter.
These types of forms are only via API available on Windows Vista and higher. You'd best just create your own form. That way you can make it precisely how you want it :)
The simplest way would be to make your own messagebox. You can then add as much additional functionality as you'd like, including event/error logging etc.
You can try the TaskDialog API, see http://msdn.microsoft.com/en-us/library/windows/desktop/bb787471(v=vs.85).aspx
Edit for those who say to use tab control
I would love to use a tab control; yet i have no idea how to go about linking the tab control up from the main form. I would assume that I would have to do something like this:
Create Form with a blank TabControl on it, no pages created.
Create a CustomuserControl (Add -> user Control), with my controls on it.
When a new chat comes in, create a tab control Item, Tab Control Page, add the Custom Control to the Tab Control Page. Add the tab control handle to the hash table, so that when new messages come in, they can be referenced in the proper control.
But, i am so not sure how to do this. For example, I know that I can create custom events inside of the User Control, so that, for example, if each control has a 'bold' button, i can each page that has that control on it, to actually USE the button.
Yet i also need to register message callbacks, so that I can use a MessageGrabber to send data to it, and tha'ts not assigned inside of the UserControl, that's assigned programatically when a new window comes in; but since I have no controls to reference, i can't assign.
KISS Philosophy
Wouldn't it be easier to just create the form, like i do now, and then just dock that form within a window or something? So that, in essence, it's still creating the form, but it's also a separate window?
Original Question
Okay, so i'm stumped (which isn't that big of a surprise when it comes to complex C# logic lol)! What i'm trying to do is the following:
Goal: Setup tabbed chatting for new chat application.
Completed: Open new window whenever a chat message is received, or a user requests a new chat from the roster. This is working perfectly, and opens only a window when the user doesn't already have the chat open. Nice and happy there.
Problem: I dont want windows. Well, i do want A window, but, i do not want tons of separate windows. For example, our Customer Service team may have about 10 active IM windows going at one time, i do not want them to have to have 10 windows tiled there lol. I'd rather they have a single Private IM window, and all 10 tabs docked within the window.
Logic: This is my logic here, which may be flawed, i do apologize:
OnMessage: Open new chat window if one doesn't already exist; if one exists, open it as a tab within the current chat window.
SendMessage: ^^ ditto ^^
Code Examples:
if (!Util.ChatForms.ContainsKey(msg.From.Bare))
{
RosterNode rn = rosterControl1.GetRosterItem(msg.From);
string nick = msg.From.Bare;
if (rn != null)
nick = rn.Text;
frmChat f = new frmChat(msg.From, xmpp, nick);
f.Show();
f.IncomingMessage(msg);
return;
}
Note on above: The Util. function just keeps tracks of what windows are opened inside of a hashtable, that way, when messages come in, they route to the proper window. That is added with the:
Util.ChatForms.Add(m_Jid.Bare.ToLower(), this);
Command in the frmChat() form.
Library in Use: agsxmpp from: http://www.ag-software.de/agsxmpp-sdk/download/
Problem:
How can i convert this code to open inside of tabs, instead of windows? Can someone please give me some ideas, and help with that. I just can't seem to wrap my head around that concept.
Use TabControl
Quick question: I have a very busy form going on that I have developed for information about say book records.
I want to design an 'add new book form' that is essentially a pop up to input the info. What is the best way to do this? Use a Usercontrol that is called on a button click or menu click? an entire new form?
Have seen this type of functionality, but never designed it in a pop up have just had user input info on the actual form - and it can get very busy.
Thanks for any help. Cheers!
I'd follow a common UI idiom. Which is, from a menu choose "new". This would popup a modal dialog to accept information about the new book form. I'd use the "Popup" control for this dialog. Within this Popup control, I'd embed the actual input dialog which is implemented as a user control.
The popup control is part of the .Net framework. If you can't see the control in the VS2008 designer, then you can still use it by typing the Popup element directly in the text view of the .xaml file.