0
一類Silverlight5如何從XAML引用的事情類:參考從XAML
xmlns:UserControls="clr-namespace:xyz.ClientApp.UserControls"
public class Thing : ContextMenu, IDisposable
{
public void Dispose()
{
MethodInfo infos = typeof(ContextMenu).GetMethods(BindingFlags.NonPublic | BindingFlags.Instance).Where(a => a.Name.Equals("HandleRootVisualMouseMove")).FirstOrDefault();
Delegate handler = Delegate.CreateDelegate(typeof(MouseEventHandler), this, infos);
EventInfo info = System.Windows.Application.Current.RootVisual.GetType().GetEvent("MouseMove");
info.RemoveEventHandler(System.Windows.Application.Current.RootVisual, handler);
}
}
上午試圖修復一個bug在ContextMenuService here
是不是隻是'用戶控件:Thing'? – McGarnagle
是否有正確的命名空間? –