WPF re-invoke constructor when connect using Remote Desktop Connection (RDP) to pc

让人想犯罪 __ 提交于 2019-12-24 07:44:38

问题


We have an ItemControl that UserConrols will be added to it, the code is as follows:

<ItemsControl ItemsSource="{Binding CamerasList}" x:Name="AllCamerasControl">
                <ItemsControl.ItemsPanel>
                    <ItemsPanelTemplate>
                        <UniformGrid />
                    </ItemsPanelTemplate>
                </ItemsControl.ItemsPanel>
                <ItemsControl.ItemTemplate>
                    <DataTemplate>
                        <local:SingleView />
                    </DataTemplate>
                </ItemsControl.ItemTemplate>
            </ItemsControl>

Constructor of UserControl is as follows:

public SingleCameraView()
        { 
            InitializeComponent();
            DataContext = new SingleViewModel();
        }

The problem is that when we open a Remote Desktop Connect to the PC that application is running, the constructor of the usercontrol class gets invoked and after that we got stuck in different problems.

I read this link WPF: Prevent unload & load after RDP (dis)connect , but I can not resolve this issue.

Can anyone help that how can resolve this issue?

来源:https://stackoverflow.com/questions/49715478/wpf-re-invoke-constructor-when-connect-using-remote-desktop-connection-rdp-to

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!