Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
WPF Popup - Form Moved
Message
From
01/03/2008 14:03:45
 
 
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Miscellaneous
Thread ID:
01295934
Message ID:
01297978
Views:
34
>>The above code certainly seems a bit of a kludge - but if you're happy to have the popup close then just 'TogglePopups(false);' in the event handler should do it? Of course you'd need the same behaviour for any resizing as well.

What I don't like about that is I would have to add code for that to every form that I use this control on. I was hopping to make the object independent of the host.

>What about the Popup.StaysOpen property? Looks as if setting that to false should cause the popup to close automatically when it loses focus?

This was a cool idea. Unfortunately it seems a bit buggy, probably because by default the focus stays on the textbox.

It seems to work the first time.

But it consumes the mouse click for the move. So you have to click twice to move the form.

After the first move, the popup does not reappear. And toggling StaysOpen does not seem to help. I think I could make it work by disposing and recreating the popup... But with the mouse click not working right, I think I would rather not go that route.

I looked into VisualParent, but I can't get all the way to an object that has a move event with that.

I looked into Application.Current but it returns null. :(

I'm running out of ideas.

>>>Ooof! More than I bargained for <g>
>>
>>hehe, ya it is a bit of code. But it's a decent start on an item that is commonly wanted and not available in WPF yet. IF we get it spiffed up I'm willing to post the finnal code.
>>
>>>I was intially intrigued by 'The Popup does not stay with the textbox if the window is moved' and wonder why that would be the case.
>>>I think I'm well behind you on the learning curve on this one and I'm also tied up for the next couple of days but I do want to play with it when I get time....
>>>Regards,
>>>Viv
>>
>>I'm in no rush on this one.
>>
>>The sample code for the popup used this rather crude method in the window code. (It makes the popups flicker when you move the window.)
>>
>>
>>void Window1_LocationChanged(object sender, EventArgs e)
>>  {
>>  if ((bool)showDesc.IsChecked)
>>    {
>>    TogglePopups(false);
>>    TogglePopups(true);
>>    }
>>  }
>>
>>
>>But since I want to use this as a control, I need to find a different way. Plus in this case just closing the popup when the window moves would be fine.
>
>The above code certainly seems a bit of a kludge - but if you're happy to have the popup close then just 'TogglePopups(false);' in the event handler should do it? Of course you'd need the same behaviour for any resizing as well.
>
>What about the Popup.StaysOpen property? Looks as if setting that to false should cause the popup to close automatically when it loses focus?
>REgards,
>Viv
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform