在运行时更改WPF源

时间:2012-03-16 09:06:31

标签: wpf lync

我想在MainWindow.xaml.cs文件中更改运行时的source属性。我当前的代码显示在这里。

                <controls:StartVideoCallButton Name="accountString" Source="sip:stj@starck.onmicrosoft.com" Height="75" Width="314" Background="#FFC7C7C7"></controls:StartVideoCallButton>

1 个答案:

答案 0 :(得分:2)

这对我有用:

accountString.Source = "sip:new.sip@company.com";

或者您可以使用MVVM模式绑定source属性以将UI与业务逻辑分开 - 这是WPF应用程序的首选方法