Catch event on user control - events

On windows form, I have an UserControl (UC).
In this UC, there is a WebBrowser control which does not have the DragDrop event.
How can I catch the DragDrop on my UC's area?

Maybe this can point to the right directions:
http://msdn.microsoft.com/en-us/library/aa984430(v=vs.71).aspx

Related

Navigation between views Xamarin Forms

I have simple Click event and want to navigate between views, but I get annoying slide up animation even that I have "false" as a parameter for animation in function. Is there any way to turn of animation effect when browsing between views in Xamarin Forms?
Thank you!
void Button_Clicked_Signup(System.Object sender, System.EventArgs e)
{
Navigation.PushModalAsync(new Signup(), false);
}
Your app is doing exactly what you're asking it to do. That annoying slide up animation is called Pushing a Modal which is happening since you are using the PushModalAsync function.
You need to the documentation and understand Hierarchical Navigation.
To fix it, you need to
Create a NavigationPage first
Pass in your current page into that
Use Navigation.PushAsync instead of Navigation.PushModalAsync

Control the VerticalOffset of a webbrowser in windows phone

I am using the webbrowser to show some string with a appbar-button. When I click the button, the webbrowser will NavigateTo another string. Everything goes well except that once the webbrowser is scrolled down(When the user is reading the end of a article), when the button clicked, the webbrowser is still at the bottom, the user has to scroll the webbrowser up.
So, before the new article is loaded, I want to set the verticaloffset of the webbrowser to zero. But there is no scrollviewer in the webbrowser, so I can't use the ScrollToVerticalOffset method.
would anyone know how to Control the VerticalOffset of a webbrowser?
Thanks.
You can do this via InvokeScript, which allows you to invoke JavaScript within your page. If you add the following JavaScript function:
function setVerticalScrollPosition(position) {
document.body.scrollTop = position;
}
Then invoke the following (C#)
this.webBrowser.InvokeScript("setVerticalScrollPosition", this.vScrollPos.Text);
Your browser control should scroll (courtesy of this blog post)

Detect mouse right ckick on combobox

How to detect a mouse click (or mousedown) event on a simple dropdown combo (combobox with style=1)?
I am unable to see mouseclick or mousedown event handlers for combobox in my vb6 IDE.
My aim is to detect right click.
Thanks in advance.
If the events aren't exposed, you may need to subclass the control and handle the WM_RBUTTONDOWN message.

How to stop the WP7 pivot control handling the Flick Gesture event in Silverlight Toolkit

I have a Pivot Control in my WP7 app that by nature responds to left and right swipes to move between the pivot items.
I then want to use the Flick Gesture on a UserControl (a small UI segment on my page) for something else.
My user control does handle the event but so does the Pivot control, so it navigates to the next item. I have not figured out how to stop the event when the usercontrol handles it.
Is it possible to use a sub control with the flick gesture within a WP7 Pivot Control?
eg:
private void glBlinds_Flick(object sender, FlickGestureEventArgs e)
{
//do stuff
e.Handled = true;
}
This solution posted recently seems to be working out for people for dealing with gesture conflicts on pano / pivot. You might like to check it out.
Preventing the Pivot or Panorama controls from scrolling
The short answer is don't put a control which supports a gesture on top of another control which also supports the same gesture.
Please see this answer to a very similar question for a slightly longer response: WP7 Toggle switch in a Pivot control?
I found this works well for incorporating a slider on a pivot item:
LayoutRoot
Pivot
PivotItem
Grid
Scrollviewer
[Content goes here, I use another grid]
Slider
If I skip the grid and place the slider inside the scrollviewer it doesn't work. I stumbled upon this solution as I wanted to support landscape and still have the slider visible / usable.
You might be able to place your small UI segment for the gesture similar to where I placed my slider.

WP7 ListPicker on Popup causing Back button problems

I am using the WP7 Tookit ListPicker (Feb release) on a Popup Control. I have trapped the Back button so I can close the popup.
If I press the back button while the ListPicker is open in popup mode, my back button event handler is firing before the ListPicker handles it so both the ListPicker and my popup are closing.
One way I thought of handling it was to check and see if I have any ListPickers on the popup that are open and if so close the and cancel the navigation (the controls on my popup are added dynamically so I have to enumerate through the popup child controls to check) but I can't find a way of seeing if the ListPicker is Open or Closing it.
So my question is a) is there a way of handling this in the back button handler and if not b) how can I check if a ListPicker is Open.
In your popup control's BackKeyPress callback add the following check:
if( myListPicker.ListPickerMode == ListPickerMode.Normal ) {
// Close popup
// Cancel navigation
e.Cancel = true;
}
When ListPickerMode is Expanded or Full the ListPicker will catch the back key pressed event and close itself.
EDIT:
According to #SteveChadbourne's comment the following worked:
if( myListPicker.ListPickerMode != ListPickerMode.Normal ) {
// Close the ListPicker
myListPicker.ListPickerMode = ListPickerMode.Normal;
// Cancel navigation
e.Cancel = true;
}

Resources