Load a Xaml and set as DockPanel's child
Hi,
I'm experiencing a strange behavior :
Having a DockPanel with 3 buttons dock to top :
If I load the following XAML and set as DockPanel's children:
The loaded button is always misplaced in the DockPanel... Same result with a stackpanel...
I'm experiencing a strange behavior :
Having a DockPanel with 3 buttons dock to top :
Code: Select all
<Grid Grid.Column="2" HorizontalAlignment="Left" VerticalAlignment="Top">
<ScrollViewer>
<Border BorderBrush="Black" BorderThickness="4">
<DockPanel x:Name="itGridViewRight" VerticalAlignment="Top">
<Button DockPanel.Dock="Top" Margin=" 0,0,0,0">TOTO</Button>
<Button DockPanel.Dock="Top" Margin=" 0,0,0,0">TOTO</Button>
<Button DockPanel.Dock="Top" Margin=" 0,0,0,0">TOTO</Button>
</DockPanel>
</Border>
</ScrollViewer>
</Grid>
Code: Select all
<Grid DockPanel.Dock="Top" VerticalAlignment="Top" Height="50"
x:Class="Atome2.FileListDock"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Background="#FF1A1A1D" >
<Button >TITI</Button>
</Grid>
Re: Load a Xaml and set as DockPanel's child
I tried after the "parent.Children.Add(control);" to do a parent.UpdateLayout(); or even a parent.InvalidateMeasure(); but with no success..
Re: Load a Xaml and set as DockPanel's child
Found the origin of the problem.
My class is not directly a UserControl but instead my own class wich inherit from UserControl... My own class was performing a Center() on the window at init... My Bad so... and not Noesis's Fault ;)
Fixed. :)
My class is not directly a UserControl but instead my own class wich inherit from UserControl... My own class was performing a Center() on the window at init... My Bad so... and not Noesis's Fault ;)
Fixed. :)
-
sfernandez
Site Admin
- Posts: 2997
- Joined:
Re: Load a Xaml and set as DockPanel's child
Thanks for the update.
Who is online
Users browsing this forum: Galilman and 2 guests