I have a search dialog where I want to disable the search button during the search. This is the current code but the button does not get deactivated
View:
I am not sure about looks when it was clicked and disabled - it is possible that it looks same.
But netaholic is right. If you execute logic in main UI thread it is possible that UI is frozen till your execution end (and isn't changed or changed to fast).
Try to put your logic in dispatcher. Like in next part of the code.
Application.Current.Dispatcher.BeginInvoke(
DispatcherPriority.Background,
new Action(() => {
//do some searching here
}));
BTW, I took this code there.
EDIT: don't use this for your solution. This is wrong (check comments).
Use dispatcher when you need to update visual element async.
Application.Current.Dispatcher.BeginInvoke(
DispatcherPriority.Background,
new Action(() => {
textbox.Content = "some result";
}));