
Hi
When using the popupbutton in my project,I cannot find the method that it shows the popupcontent through coding instead of clicking.
Thanks
Lik
Hi
When using the popupbutton in my project,I cannot find the method that it shows the popupcontent through coding instead of clicking.
Thanks
Lik
Hi Lik,
I believe you can set the PopupButton.IsPopupOpen property to true.
private void btnGetOther_Click(object sender, RoutedEventArgs e) { OpenFileDialog dlg = new OpenFileDialog(); dlg.Title = "打开文件"; dlg.Filter = "文件(*." + xmhouzhui + ";*." + gchouzhui + ")|*." + xmhouzhui + ";*." + gchouzhui + "|项目(*." + xmhouzhui + ")|*." + xmhouzhui + "|工程(*." + gchouzhui + ")|*." + gchouzhui + "|所有(*.*)|*.*";
if (dlg.ShowDialog().GetValueOrDefault()) {
} btnGetOther.IsPopupOpen = true; }
not excute
It worked ok when I tried setting IsPopupOpen in response to a keystroke. If it's not working in response to a button click, try to dispatch the IsPopupOpen line so that it occurs after any pending input finishes up first, in case that is causing a problem.
I use Caliburn.Micro in project , dispatch the IsPopupOpen also not working.
please give me a sample. Thanks.
//view.Dispatcher.BeginInvoke((System.Action)delegate() { //view.Activate(); //view.Focus(); btn.Focus(); btn.IsPopupOpen = true; });
btn.Dispatcher.BeginInvoke((System.Action)delegate() { //view.Activate(); //view.Focus(); btn.Focus(); btn.IsPopupOpen = true; });
Hello, please see the MSDN documentation on it for assistance:
http://msdn.microsoft.com/en-us/library/ms591206.aspx?cs-save-lang=1&cs-lang=csharp#code-snippet-3
You'd want to use a DispatcherPriority of Background or Input.
Please log in to a validated account to post comments.