Posted 6 years ago by lik
Version: 13.2.0590
Avatar

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

Comments (5)

Answer - Posted 6 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Lik,

I believe you can set the PopupButton.IsPopupOpen property to true.


Actipro Software Support

Posted 6 years ago by lik
Avatar

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

Posted 6 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

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.


Actipro Software Support

Posted 6 years ago by lik
Avatar

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; });

Posted 6 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

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.


Actipro Software Support

The latest build of this product (v2019.1 build 0683) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.