我正在尝试创建一个清除mdAutocomplete控件并打开面板的按钮。
这样的事情:
clearValue() {
this.stateCtrl.setValue("");
this.trigger.openPanel();
}
这里是完整代码的插件: https://plnkr.co/edit/KC8f1bHaDpWXEkLxzLta?p=preview
如果我在clearValue
函数中设置了一个断点,并在控制台中调用this.trigger.openPanel()
面板打开,但是当我让代码运行时,面板永远不会打开。
答案 0 :(得分:2)
解决问题的最简单方法是阻止传播到关闭弹出窗口的处理程序:
public class MyButton : Button
{
private static string Image_path = "ms-appx:///assets/Button.png";
public MyButton()
{
ImageBrush brush = new ImageBrush()
{
ImageSource = new BitmapImage(new Uri(MyButton.Image_path))
};
this.Background = brush;
this.PointerEntered += a;
}
// This almost work, but the image is flickering when event is fired
private void a(object sender, PointerRoutedEventArgs e)
{
ImageBrush brush = new ImageBrush()
{
ImageSource = new BitmapImage(new Uri(MyButton.Image_path))
};
//this.Foreground = brush;
this.Background = brush;
}
}
<强> Forked Plunker 强>