在WPF MVVM应用程序中,当远程桌面连接到运行该应用程序的PC后,UserControls会重新加载,之后我们遇到了一些问题。我阅读了这篇关于WPF的链接,但我无法解决这个问题。
有一个ItemsControl,其中添加了UserControl。
有一个ItemsControl,其中添加了UserControl。
<ItemsControl ItemsSource="{Binding CamerasList}" x:Name="AllCamerasControl">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<UniformGrid />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<local:SingleView />
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
UserControl
的构造函数如下:
public SingleCameraView()
{
InitializeComponent();
DataContext = new SingleViewModel();
}
有人能告诉我如何解决这个问题吗?