Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6541157
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T11:04:13+00:00 2026-05-25T11:04:13+00:00

I have application with WPF Ribbon and Grid. And I need to show this

  • 0

I have application with WPF Ribbon and Grid. And I need to show this Grid not only in main application window but also on second window. This Grid contain a lot of elements like ToggleButtons, TextBoxes, Images.
Scheme of my application code looks like that:

<ribbon:RibbonWindow
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        [...]
        xmlns:ribbon="clr-namespace:Microsoft.Windows.Controls.Ribbon;assembly=RibbonControlsLibrary"
        Title="MainWindow"
        x:Name="RibbonWindow"
        Height="870" Width="1000">

    <Grid x:Name="LayoutRoot">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <ribbon:Ribbon x:Name="Ribbon">
        [...]
        </ribbon:Ribbon>

        <Grid Background="#FF5C5C5C" Height="765" Width="986" Grid.Row="1" Margin="0,0,-2,-70" x:Name="MainGrid">
            <ToggleButton/>
            <TextBlock />
            <ToggleButton/>
            <Rectangle />
            [...]
         </Grid>

    </Grid>
</ribbon:RibbonWindow>

MainGrid is the Grid that I want to show in second window. It can even be only view of this Grid. But when I change something in first window, like write something in TextBox or click on ToggleButton, I need to have it visible on second screen too.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T11:04:14+00:00Added an answer on May 25, 2026 at 11:04 am

    Umm this is going to be tricky. What I would do is create a UserControl with the Grid and then put one UserControl in Window1 and another in Window2. But to synchronize the state of the Window1-Grid and the Window2-Grid you will have to bind them to the same object.

    Edit: Here, cooked up an example for you

    Step 1: Put the Grid into a UserControl so it can be reused.

    Notice I set the UpdateSourceTrigger property on the binding to PropertyChanged, this updates the source object as the user is typing, so we will see changes in Window2 as they are happening in Window1.

    CommonGrid.xaml

    <UserControl x:Class="WindowSync.CommonGrid"
                 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                 xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006">
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto"  />
            </Grid.RowDefinitions>
            <StackPanel Grid.Row="0" Orientation="Horizontal" Margin="5">
                <TextBlock Text="Name: " />
                <TextBox Width="200" Text="{Binding Name, UpdateSourceTrigger=PropertyChanged}" />
            </StackPanel>
            <StackPanel Grid.Row="1" Orientation="Horizontal" Margin="5">
                <CheckBox IsChecked="{Binding IsAdmin, UpdateSourceTrigger=PropertyChanged}" />
                <TextBlock Text=" Is Admin" />
            </StackPanel>
        </Grid>
    </UserControl>
    

    Step 2: Put the UserControl into the desired windows.

    Note: you have to reference the namespace that UserControl is in, in this case the namespace is WindowSync, this line lets us user the namespace xmlns:app="clr-namespace:WindowSync".

    Window1.xaml

    <Window x:Class="WindowSync.Window1"
            xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
            xmlns:app="clr-namespace:WindowSync"
            Title="Window 1" Height="200" Width="400">
        <app:CommonGrid x:Name="Window1Grid" />
    </Window>
    

    Windo1.xaml.cs

        public Window1()
        {
            InitializeComponent();
            Window1Grid.DataContext = Person.User; // bind the UserControl in Window1 to the an object
            new Window2().Show(); // create an instance of window 2 and show it
        }
    

    Window2.xaml

    <Window x:Class="WindowSync.Window2"
            xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
            xmlns:app="clr-namespace:WindowSync"
            Title="Window 2" Height="200" Width="400">
        <app:CommonGrid x:Name="Window2Grid" />
    </Window>
    

    Window2.xaml.cs

        public Window2()
        {
            InitializeComponent();
            Window2Grid.DataContext = Person.User; // bind the UserControl in Window2 to the same object
        }
    

    Person.cs

    I just created a random object called person for the demonstration.

    Note: you have to implement the INotifyPropertyChanged interface on your object, and raise the appropriate PropertyChanged event whenever something is changed, this is what let’s us synchronize the two grids. Window1 changes something, the PropertyChanged event gets fired, Window2 picks it up and makes the changes.

    public class Person : INotifyPropertyChanged
    {
        public static Person User = new Person();
    
        #region Name
        private string _Name;
        public string Name
        {
            get { return _Name; }
            set
            {
                _Name = value;
                OnPropertyChanged("Name");
            }
        }
        #endregion
    
        #region IsAdmin
        private bool _IsAdmin;
        public bool IsAdmin
        {
            get { return _IsAdmin; }
            set
            {
                _IsAdmin = value;
                OnPropertyChanged("IsAdmin");
            }
        }
        #endregion
    
        #region INotifyPropertyChanged
        public event PropertyChangedEventHandler PropertyChanged;
        private void OnPropertyChanged(string property)
        {
            if (PropertyChanged != null)
                PropertyChanged(this, new PropertyChangedEventArgs(property));
        }
        #endregion
    }
    

    Anywyas, I hope this helps you out. I uploaded a zipped version of the project if you get stuck. http://www.mediafire.com/?yv84xbben6tjdy7

    Good luck.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have WPF application with one main window . In this window there are
I have WPF application and a window in it. Lets have something like this
I have WPF Application where I have One main form and other user controls
I'm looking for a WPF prism with ribbon application samples and tutorials. I have
I have WPF application project and I'm using EF. I want something like this.
I have a WPF application embedded in a Microsoft Outlook 2003 window. Everything is
I have a WPF windows application that uses the ms ribbon control for the
I have written an application (wpf - will Mono translate this for a Mac?)
I have a WPF application that has several modal window used for various purposes.
I have WPF application, Which works fine on my PC. As this application is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.