c# - Wpf Application cross (X) Button not working on single Click -
i have wpf application , problem facing application doesnt closed on single cross(x) button click. may know reason-
initially happening setting focus menuitem when window loaded,so when click on cross(x) button first focus menuitem removed , on second click application cross(x) button works.
private void window_loaded(object sender, routedeventargs e) { menuitem1.focus(); }
but when dont set focus on menuitem,the cross button works on single click.
private void window_loaded(object sender, routedeventargs e) { // menuitem1.focus(); }
i want set focus on menuitem , want red cross(x) button execute on singleclick..
is way scenario can achieved..???
i concur behaviour happening... menuitem
not same button
having focus. @samuel, focusmanager.isfocusscope
has no effect here. when menu
focused, stops window being moved or re-sized, let alone having of button
s clicked.
i tried implementing other events such mouseleave
, lostfocus
(on window) without ability change focused menuitem
.
i don't know why farzi wants automatically focused, suggest bad idea. maybe farzi wants can achieved in different way? maybe temporarily colouring menuitem.background
instead?
Comments
Post a Comment