开发者

How to access a control from an open window in the same namespace from a new window?

开发者 https://www.devze.com 2023-03-09 18:47 出处:网络
I have an application (WPF using C#) that I\'m working on where I have a login window that is opened first (Set as the StartUri). Once the user clicks on the PasswordBox, a new window appears that con

I have an application (WPF using C#) that I'm working on where I have a login window that is opened first (Set as the StartUri). Once the user clicks on the PasswordBox, a new window appears that contains numeric buttons for entering the numeric password (it's going to be a touchscreen application). The data entered then is added to an Array List. Once the User clicks OK, the password they entered needs to show up in the login window that was first opened. I need to do this without opening a new login window s开发者_Python百科ince the login window will still be running in the background. Is there an easy way to access the login windows PasswordBox and add the Array List to it? These windows are both part of the same namespace.


Can both windows use the same ViewModel or DataContext? Then you could just bind both controls to the same field

<myControls:NumericPasswordEntryControl 
    DataContext="{Binding ElementName=MyLoginWindow, Path=DataContext}" />
0

精彩评论

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

关注公众号