views:

103

answers:

0

Hello,

I'm having trouble with a WPF visual tree. I'd like the children of any container to be under any visual element that is above their container, like they should.

Link to image displaying problem

Both red zone and green zone are children of grey zone.

<Grid Name="Grey">
    <Grid Name="Red">...</Grid>
    <Grid Name="Green">...</Grid>
</Grid>

Blue square is the content of a child ContentControl inside of red square

<Grid Name="Red">
    <ContentControl Content="{Binding ViewModel, Path=Content}" />
</Grid>

The Content is dynamically loaded in the ViewModel through an Add-In (System.Addin) and put inside a property, and the visual tree is updated by the Binding. It loads fine (the blue zone is the Add-In UI).

/* ViewModel */
AppInfo app = x as AppInfo;
IAddIn appli = ChargerAppli(app);
this.Content = appli.MainVisual; // Content property gets the UI for Binding

I don't have a clue why it goes on the very top of the scene. Add-In UI content doesn't seem to be handled like any other FrameworkElements in the Host visual tree. If I load an arbitrary content (host side) in the red zone's ContentControl, it is handled as expected and appears beneath the green zone.

Would anyone give me an advice?