开发者

Set Border Visibility Property Using Button Trigger

I need a button click trigger that will change the visibility property for a border. The situation is a logon screen with an error message in the border, and whe开发者_JAVA百科n login is clicked the border collapses prior to the logon logic executing (ideally). I am unable to get the UI to update before executing the logic, which is bound to the login button Command property, using EventTriggers routing the MouseLeftButtonUp/Down events.


Solved the problem by using a method to force the UI to update.

void AllowUIToUpdate() 
{
    DispatcherFrame frame = new DispatcherFrame();

    Dispatcher.CurrentDispatcher.BeginInvoke(DispatcherPriority.Render
                                             , new DispatcherOperationCallback(delegate(object parameter)
                                                   {
                                                       frame.Continue = false;
                                                       return null;
                                                   })
                                             , null);

    Dispatcher.PushFrame(frame);
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜