0

I'm trying to show two windows on two monitors, I already checked ProjectionManager only support to sent windows (app views) to secondary displays, and swaps main and projection views. But I want to share a child window in two monitors, can I do that? Image for your reference.

jerry
  • 317
  • 2
  • 20

1 Answers1

0

By testing, using ProjectionManager Class for this issue works well.

There is a simple sample to test it, you can refer to the following code. More info can be found here.

MainPage.xaml:

<Grid>
        <StackPanel Orientation="Horizontal" >
            <TextBlock Text="Today is a good day!" VerticalAlignment="Center" HorizontalAlignment="Center" FontWeight="Bold" Foreground="Red"/>
            <Frame x:Name="frame1" BorderBrush="BlueViolet" Width="900">
            </Frame>
        </StackPanel>
</Grid>

ChildWindow.xaml

  <Grid>
        <TextBlock Text="Child Window" Foreground="Blue" />
  </Grid>

MainPage.xaml.cs

  public sealed partial class MainPage : Page
    {      
        public MainPage()
        {
            this.InitializeComponent();
            frame1.Navigate(typeof(ChildWindow));
            expand();
        }
       
        private async void expand()
        {
            var NewWindow = CoreApplication.CreateNewView();
            int Windowid = ApplicationView.GetForCurrentView().Id;
            int NewWindowid = 0;

            await NewWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
            {
                Frame newframe = new Frame();
                newframe.Navigate(typeof(ChildWindow), null);
                Window.Current.Content = newframe;
                Window.Current.Activate();
                ApplicationView.GetForCurrentView().Title = "New Page";

                NewWindowid = ApplicationView.GetForCurrentView().Id;
            });
            //Call ProjectionManager class for moving new window to secodary display
            bool available = ProjectionManager.ProjectionDisplayAvailable;
            ProjectionManager.ProjectionDisplayAvailableChanged += (s, e) =>
            {
                available = ProjectionManager.ProjectionDisplayAvailable;
            };
            await ProjectionManager.StartProjectingAsync(NewWindowid, Windowid);
        }
    }
dear_vv
  • 2,350
  • 1
  • 4
  • 13
  • Thanks for your your comment. Actually I want to share one child window on two monitors. User edit data on child window, both of the two monitors can see the modification. – jerry Jan 25 '21 at 06:52
  • In my case, I need to create one instance of Child Window, then add it into Main Window's container, and send it to the secondary monitor. The child window only can be added into on container, so it seems not possible to do it. – jerry Jan 25 '21 at 08:57
  • If it is just a simple change of control data, you can bind Projection Page and source Page to the same data source. – dear_vv Jan 28 '21 at 09:29