Click here to Skip to main content
15,881,832 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have the following code:
XML
<Grid>
    <Grid.ColumnDefinitions>
        <ColumnDefinition Width="*"/>
        <ColumnDefinition Width="Auto"/>
        <ColumnDefinition Width="*"/>
    </Grid.ColumnDefinitions>
    <ContentControl x:Name="MainContent" Grid.Column="0">
        Some content
    </ContentControl>
    <GridSplitter Grid.Column="1" Width="5"/>
    <ContentControl Content="{Binding ElementName=MainContent, Path=Content}" Grid.Column="2"/>
</Grid>



This shows the content of the first ContentControl in both sides.
If I change the "Some content" text to any control it shows the content only in the second ContentControl and not in both.

Is there any way to do this?
Posted

 
Share this answer
 
Comments
Itamarep 9-Jun-13 8:40am    
In my case, I want to display 2 web browsers that will display the same content and when browsing in one it will show the same results in the other.
If I connect the source to a resource it will browse in both opening the same page twice, more than that, if an internal script on the page changes the display, the URL doesn't have to change meaning they will display different pages (under the same URL)
Sergey Alexandrovich Kryukov 9-Jun-13 13:03pm    
And how is that related to the original question?
OK, please see Solution 2 then.
—SA
The question asked in the comment to Solution 1 has nothing to do with the original question:
Itamarep asked:
In my case, I want to display 2 web browsers that will display the same content and when browsing in one it will show the same results in the other. If I connect the source to a resource it will browse in both opening the same page twice, more than that, if an internal script on the page changes the display, the URL doesn't have to change meaning they will display different pages (under the same URL)
System.Windows.Controls.WebBrowser is not System.Windows.Controls.ContentControl, and the media content it shows has nothing to do with the content of ContentControl:
http://msdn.microsoft.com/en-us/library/system.windows.controls.webbrowser.aspx[^].

Isn't the resolution of this problem, especially taken into account the last clause about the effect of the page's "internal script" trivial?
The browser URI is changed is 1) you navigate to some other URI using one of the Navigate methods; 2) when a use clicks in some HTML navigation control (such as anchor) inside the page currently rendered; in other way, you can navigate using some different URL from outside the browser's page and from the page. In first case, simply call the same Navigate method from both browser.

The second case is just a little bit different and asymmetric: handle the event Navigating in one browser instance, and, in its handler, call Navigate for another browser instance accordingly.

First and foremost, don't try to handle this event in both browsers in reciprocal manner, to avoid "infinite" mutual recursion: http://en.wikipedia.org/wiki/Mutual_recursion[^]… :-)

—SA
 
Share this answer
 
Comments
Itamarep 10-Jun-13 1:18am    
Having both browsers navigate to the same site is easy but is not enough, in the same site (exact same URI) you can have different contents which is something I don't want.
In addition, if I display a clip in one side I want to display the same clip at the exact same location in the other.
If there is a solution for that, please post it since I can't see it by using the same resource.
Sergey Alexandrovich Kryukov 10-Jun-13 9:16am    
You have made very vague comment on different content with the same URL when asking this question.

If you mean having the same content every second, not just the same URI, this is even theoretically impossible. Do I even have to explain why? it should be obvious.

—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900