Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Displaying wpf content over/outside main window bounds [closed]

I am trying to achieve an effect of overlapping the main window boundary with a control. It's hard to explain this in words which is also maybe why I am having difficulty finding information on how to do this or if it is even possible.

Below is an example of the effect I am trying to get (from the designer), where the "note" objects float outside the bounds of the main window.

Example 1

However the effect I get at runtime is this (below), the inner controls are clipped by the boundary of the main window.

Example 2

Can someone please tell me if this is possible (or not), and if it is maybe some suggestions about how I could get this effect.

like image 984
Dale Avatar asked Jun 18 '12 06:06

Dale


2 Answers

There is a control that can achieve this kind a behavior have you tried a Popup control? Check this out

Here's an examp;e"

<Window x:Class="MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="MainWindow" Height="350" Width="525">
<Grid>
    <ToggleButton x:Name="MainButton" Content="Show popup" VerticalAlignment="Top" HorizontalAlignment="Right"/>
    <Popup PlacementTarget="{Binding ElementName=MainButton}" Placement="Bottom" AllowsTransparency="True" IsOpen="{Binding ElementName=MainButton, Path=IsChecked}">
        <Grid>
            <Border BorderBrush="Orange" BorderThickness="1" Background="Yellow"/>
            <TextBlock Text="Lorem Ipsum is simply dummy text of the printing and typesetting industry"/>
        </Grid>            
    </Popup>
</Grid>

like image 162
Juzailie Avatar answered Oct 25 '22 19:10

Juzailie


Contents of window will always get clipped. So basically there is only one way to go here. You could get the desired effect by creating a new transparent window for your floating content and then manualy set and update the position of floating content window based on the location of main window.

So far I've been using AvalonDock for similar functionalty. You might give it a try...

like image 2
dodsky Avatar answered Oct 25 '22 17:10

dodsky