开发者

ContentControl does not show change

开发者 https://www.devze.com 2023-01-16 07:09 出处:网络
The following code is in a MEF MVVM desktop application. The Shell is already build, but a Module is initialising.

The following code is in a MEF MVVM desktop application. The Shell is already build, but a Module is initialising. The Module wants t开发者_开发问答o add text to a ContentControl in the Shell, but the following code does not cause the change to be seen in the Shell Window. Any suggestions as to how I get the window to update.

thanks

    [ImportingConstructor]
    public ModuleInit(IView1Model vm)
    {
        var viewModel = vm as ViewModels.View1Model;
        var view1 = GetView(viewModel);

        var shellModel = viewModel.Shell;
        var shellView = GetView(shellModel);

        Control c1 = shellview as Control; //Window
        ContentControl c2 = c1.FindName("ActiveItem1") as ContentControl;
        TextBlock tb = new TextBlock();
        tb.Text = "New Text Message";
        c2.Content = tb;

John


It was geting late and I didn't notice I was creating a new view instead of finding the current one. Sorry all. John

0

精彩评论

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

关注公众号