如何在WPF中管理两个单独的显示? [英] How do I manage two separate displays in WPF?

查看:91
本文介绍了如何在WPF中管理两个单独的显示?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一个应用程序,允许用户从触摸屏显示器上的一系列地图中进行选择,然后地图也将显示在更大的壁挂式屏幕上。用户可以在地图上平移/缩放/旋转,我希望壁挂式屏幕能够与触摸屏同步显示这些变化。



什么是管理这两个显示器的好方法是什么?



目前,我已经使用MVVM格式设置了应用程序并使用了Caliburn.Micro。



每个地图都在自己的UserControl中,并使用ShellViewModel中的Conductor和ActivateItem在我的ShellView上的ContentControl中激活它们。我想让活动项目也显示在一个单独的窗口中(在壁挂式屏幕上)。



这是迄今为止的代码:



ShellView.xaml:



I am writing an application which will allow users to select from a series of maps on a touchscreen display, and then the maps will also display on a larger wall-mounted screen. Users will be able to pan/zoom/rotate around the maps and I would like the wall-mounted screen to show those changes in sync with the touchscreen.

What is a good way to approach managing the two displays?

Currently, I have the application set up in MVVM format and am using Caliburn.Micro.

Each map is in its own UserControl and they are activated in a ContentControl on my ShellView using Conductor and ActivateItem in the ShellViewModel. I would like to have the Active Item also be displayed in a separate Window (on the wall-mounted screen).

Here is the code so far:

ShellView.xaml:

<Grid>
       <!--The Content control shows which MapView is currently active-->
       <ContentControl x:Name="ActiveItem"/>
           <StackPanel>
               <TextBlock Text="Select a map.">
               <ComboBox>
                   <Button x:Name="LoadMap1">Map1</Button>
                   <Button x:Name="LoadMap2">Map2</Button>
                   <Button x:Name="LoadMap3">Map3</Button>
               </ComboBox>
           </StackPanel>
   </Grid>







ShellViewModel.cs




ShellViewModel.cs

public class ShellViewModel : Conductor<object>
{
    public ShellViewModel()
    {

    }

    public void LoadMap1()
    {
        ActivateItem(new MapOneViewModel());
    }

    public void LoadMap2()
    {
        ActivateItem(new MapTwoViewModel());
    }

    public void LoadMap3()
    {
        ActivateItem(new MapThreeViewModel());
    }
}





我不知道这是否是设置此项的最佳方式up,但它适用于在ShellView上加载地图。我真的只需要在另一个窗口中为壁挂式显示器显示相同的东西



任何帮助表示感谢,谢谢!



我尝试了什么:



我尝试过使用VisualBrush但不知道我是否可以绑定它跨越两个Windows。



I do not know if this is the best way to set this up, but it works well for loading the maps on the ShellView. I really just need to show the same thing in another window for the wall-mounted Display

Any help appreciated, Thanks!

What I have tried:

I have tried using a VisualBrush but don't know if I can bind it across two Windows.

推荐答案

您可以根据需要显示任意数量的非模态窗口;并在另一个窗口中有任何窗口调用方法。



如果这还不够,则运行应用程序的多个实例;使用远程自动化或其他任何想法。



Windows可以拖动到任何屏幕。 Windows 10可以很好地扩展,IMO。
You can show as many non-modal windows as you want; and have any window call methods in another window.

If that isn't enough, you run multiple instances of your app; using remote automation or whatever else comes to mind.

Windows can be dragged to any screen. Windows 10 scales well, IMO.


这篇关于如何在WPF中管理两个单独的显示?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆