Silverlight combobox blocks interaction with other controls - c#

I have a Silverlight view which has several layers of popups. It is a record search/edit page, which displays the results in a datagrid. There is a details view for each record that is then shown in a popup over the grid. Finally, the sections in the details view can be edited, and the edit form is displayed in a third popup. The search criteria is hidden when viewing data, but can be toggled into view.
The problem I am facing is that whenever the comboboxes on the edit popups are interacted with, it causes the layers below them to be un-clickable. In the screenshot I provided, if the user clicks on the Phone or Email comboboxes, even if they don't change the selections, and closes the topmost edit popup, then the delete, save, close, and view on map buttons no longer receive mouse interaction. They have mouseover styles that are not applied and they don't receive clicks. However, the New Group button does, but only below a certain point. It is behaving as if there is an invisible canvas/shape blocking mouse interaction.
Additionally, if the user slides out the Record Search panel (by clicking on the down arrow icon), the form somehow gets reset and those buttons are clickable again. Also, if the browser window gets resized the buttons are also clickable.
I've spent the better part of two days going through this, admittedly complicated, view and I'm positive there are no controls/canvases/shapes that I'm displaying that are being placed in the way, as I've added color/outlines to every canvas in the xaml.
At this point I am stumped and reconsidering redesigning the form to avoid this problem. Has anyone run into this and if so do you have a solution?

Related

Need to tap twice on touchscreen to click button in WPF

I have a WPF application that at one point brings up another window where the user can enter text in a field that is selected on open then click OK to save the text. This is working correctly on my desktop using a mouse, but when I run the application on a tablet (Surface Pro) the OK button needs to be tapped twice to save the text. The first tap highlights the button, then the second tap clicks it. Is there any way to allow the user to click the button with just one tap on the screen?
This only happens when the application switches to the new window. The main window only requires one tap to click buttons (Though I have noticed that they require two when switching back to the main window). It seems like this issue has to do with focus or something because if I tap somewhere on the new window before clicking OK, I can tap OK once and it will trigger the click event.
You probably need something like this in your code:
textBox1.Focus();
The other place to consider is the Tab order of the items on the form. Once the focus leaves the textbox, it moves to the next highest tab order object. It should be the OK button.
You can adjust the Tab order by looking at the properties of the objects on the form.
This is a bug in WPF combined with a touch display.
Because the textbox is focused, and you press the button, the textbox gets unfocused and the button gets focus. When the button has focus, you just have to press it in order to save your text.
There really isn't a thing you can do about it, since the touchscreen focuses first on the button before you can fire the event (I think it probaly is a kind of a safety feature).

C# asp.net Maintain tab index after asynchronous postback ontextchanged

Ok, so I've researched this to the end of the earth and can't seem to find a solution that works.
I have a C# application, which is basically a web form made up of radio button lists and text boxes in an update panel. The form has multiple 'sections', each of which the user submits when completed. Each control performs a postback. This is because if the user modifies a section after completing it, the 'section saved' label needs to disappear.
This all works well, except the postbacks lose the tab order of the controls. I have found code examples that save the last control that had focus, which works well for the radio button lists, but because the text boxes post back when a user tabs to the next control (not modifies the text), it doesn't select the next control. The user has to hit tab again and it jumps to the third text box, not the second because technically, the second text box is what had focus after the initial postback. I hope this makes sense.
Any ideas? I can post code if required.
I should probably also add that this page is within a frame of our community portal.

Change panels / views based on button click

I would like to implement the following WinForms user-interface, with two buttons at the top that allows the user to toggle between two views.
So, when I click the 1st button ("Show User Profiles"), the three panels below should show the three different user profiles (with some content fetched from database), like so...
And when I click the 2nd button ("Show Chat History"), the three panels below should show the three different chat histories (with some content fetched from database), like so...
What is a good approach (either dynamic or static) to implement this kind of structure in C# / .Net? Is there a cleaner or at least more efficient way than my crude method below:
Layout three sets of controls for the three Profiles
Layout three sets of controls for the three Chat-Histories, overlapping on top of
the Profiles' controls.
Change visibility of the controls based on which button is pressed.
For example, if 1st button is clicked, Set Visibility=false for all the controls related to Chat-History, and Set Visibility=true for all the controls related to User-Profiles.
a tab control would give you a separate set of panels. Its the obvious way to do it, but if you want to overlay panels and control the visibility you can, and its fine. I have a content viewer that displays either images or text depending on the mime type of the content, and that context switching occurs without user interaction, so it makes sense there to put the image control on top of the textbox and set it visible if the mime type is image/jpeg. Where a user is going to make the choice tho, I would use a tab control.
I assume you are using the visual ui to add controls. you can just drag a tab control to your form and it should by default appear with 2 tabs defined. You can add more in properties my modifying the tabpages collection. That's where you would also rename them to reflect your choices (profiles, chats). drag the tab control up where you want it on the form and size it appropriately, or dock it to fill the form. drag 3 panels into the first tab, then click on the 2nd tab, and drag 3 more in there. then proceed as you would have. When the user clicks on the chat tab the tab control will manage the view - hiding the first tab and its 3 panels. Of course clicking the first tab would make that tabPage visible again. no need for you to code anything.
I'll just add that I don't understand the design of having 3 profiles visible, and 3 chat history's. Unless your users are going to be limited to 3 friends. I would think you would be better off using a listbox for friends names on the profiles page, with a single profile panel that just filled the profile controls based on which friend is selected, and then the same list on the chat page, with a single chat panel that loaded the history into the textbox based on which friend was selected. That way you can have all the friends you want :)
and for completeness i'll suggest one more way, why should the user have to switch between tabs to view a users profile or chat history when you can provide them both in a single tabPage? You could programmatically create a new tab for each user and on that tab have their profile panel on the left, and their chat history on the right. Less context switching = better user experience. The tab control will allow you to scroll for tabs that don't fit on the form automagically(tm).

Scroll to item in view, but do not scroll to view

I'm developing a WPF application, containing multiple ListView's.
Every view has a button, and the user can press it to initiate a function that processes the items in the view.
The item count is often up in thousands, and can take a couple of minutes to process.
Now, I want the item currently being processed to be selected and scrolled to so the user can get a hunch of how much has been processed.
This in turn also makes it easy for the user to know what item causes the processing to stop in the event of an error, as it is selected.
To do this I have bound the ListView's SelectedIndex to my ScrollRow property, which i set in my processing function.
I then scroll to the selected item using the event SelectionChanged, which runs a function that calls ScrollToView on the selected item.
My window contains many views, so there is often a scrollbar on the main window containing the views.
The problem is that when I call ScrollToView on a row in a view, the main window also scrolls to this view, when the user wants to look on another view further down in the window.
I have looked into setting the scroll position directly, but haven't found any ways to do that.
How do I prevent the window to scroll when a view in the window scrolls?
I'm not sure the user will like to see a listbox animating itself other a thousand item.
Rather a little info panel on current processing displaying % progress, current item, time...
But but but.... i'm not here to question your design choices :-)
So what you should do is to get the scrollViewer of your listView, and call ScrollToVerticalOffset on it to have the content to scroll without stealing focus.
To find the scrollViewer, you might use my answer in this question :
How do I get the start index and number of visible items in a ListView?
If you want to go for a more xaml/binding solution, you might expose VerticalOffset using this kind of solution:
http://marlongrech.wordpress.com/2009/09/14/how-to-set-wpf-scrollviewer-verticaloffset-and-horizontal-offset/

Timer causes dropdownlists to disappear permanently after a modal popup

On a fairly complex page, we're getting some unusual behavior with dropdownlists in IE6. To layout the basic structure, there are 2 update panels on the page each with a GridView presenting a master-details layout. In addition to the grid, each panel houses some DropDownLists for filtering the data in the respective GridView.
Now what's happening is that a button on the bottom grid will cause a modal popup form to display, where some details about the row item can be modified. As per the ASP.NET AJAX JavaScript, the DropDowns disable during the postback, and re-enable after it closes.
The bottom grid also has a timer attached to it that periodically updates it to keep the view of the data fresh. When this timer ticks after the modal popup is closed, the drop down lists mysteriously vanish, except for the ones in that update panel which apparently get rendered again.
Oddly enough, if the timer ticks while the popup is up, the drop downs enable early and show through the modal (oh IE6...) but don't vanish later on.
Been a while since I posted this, but the problem occasionally resurfaces and I think I finally found an answer to it.
The AJAX Toolkit's modal popup javascript disables all DropDownLists on the page because they show through to the highest Z-level in IE6. But if something causes a postback while the modal is showing (like a badly managed timer) then the invisible state gets recorded into the viewstate for the DDLs.
One easy way around it is to just put the offending DDLs in an update panel, so they properly get refreshed on updates and don't get stuck. The more complex way is to ensure nothing causes extraneous postbacks while the modal is showing. The best way would probably be to ditch Webforms and all the baggage with it, but that's pretty much not going to happen.

Categories