2

I have a wpf application which hosts a group of controls which are backed by another process via FrameworkElementAdapter. For some reason, these controls have a clipping / Z order issue that non-remoted controls don't seem to exhibit.
enter image description here

The gridview in the above image is one of those hosted controls, and improperly overlaps the panel on the right, while the contentcontrol that hosts it behaves as expected. I have explicitly set ClipToBounds = true on the gridview.

My question is : Is there a way to make my controls clip and honor the z order properly, or does FrameworkElementAdaptermake this impossible by, for example, rendering them onto the adorner layer or something?

Xaml:

<Grid>
    <Viewbox>
        <ContentControl Content="{Binding VM.ErrorView}" Height="240" Width="425" Loaded="ContentControl_Loaded"/>
    </Viewbox>
</Grid>

C#:

public partial class ValidationView : UserControl
{
    public ValidationView()
    {
        InitializeComponent();
    }

    private void ContentControl_Loaded(object sender, RoutedEventArgs e)
    {
        var cc = (sender as ContentControl);
        var content = cc.Content as FrameworkElement;
        content.ClipToBounds = true;
    }
}

Interesting side note: if I inspect my app with Snoop, in the preview Snoop displays when you mouse over parts of the visual tree graph, the remoted controls don't appear at all and their respective host contentcontrols appear empty, but are the right size

Anthony
  • 286
  • 3
  • 11

0 Answers0