Quantcast
Channel: Extended WPF Toolkit™ Community Edition
Viewing all articles
Browse latest Browse all 4964

New Post: Center of ChildWindow With Margins set

$
0
0
Hi,

What I would do is place the windowContainer underneath the ribbon. Something like :
<Grid>
<StackPanel>
<Ribbon />
   <Grid>
         <Grid>
               <Data/>
        </Grid>
        <WindowContainer>
             <ChildWindow />
        </WindowContainer>
    </Grid>
</StackPanel>
</Grid>

The ChildWindow would have the 2 following properties :
WindowStartupLocation="Center"
Margin="0,0,0,25" //25 is half the size of the ribbon's height

Then modifying the toolkit Code :

In file :Xceed.Wpf.Toolkit/Core/Primitives/WindowContainer.cs
in method : CenterChild
Replace the "if" content with this :
windowControl.Left = ( this.ActualWidth - windowControl.ActualWidth ) / 2.0;
windowControl.Left += (windowControl.Margin.Left - windowControl.Margin.Right);
windowControl.Top = ( this.ActualHeight - windowControl.ActualHeight ) / 2.0;
windowControl.Top += ( windowControl.Margin.Top - windowControl.Margin.Bottom );
Normally, the ChildWidow is centered in the WindowContainer. With this, the ChildWindow will be offsetted from this center.

Viewing all articles
Browse latest Browse all 4964

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>