Width and Height of DataWindow 3 not affected window size

May 10, 2012 at 10:09 AM

Hi Geert,

 I probably find bug in DataWindow implementation:

If I set Width and Height of DataWindow, these properties does not affected window size. Window is adapted to size of content. Classic WPF window(MS) implementation it´s OK.

 

Wrong behavior:

<catel:DataWindow x:Class="WPFAppCatel.Views.MainWindow"

                 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

                 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

                               xmlns:catel="http://catel.codeplex.com"

                 ShowInTaskbar="True" ResizeMode="CanResize" Width="1024" Height="600" >

   <Grid>

       <Grid.RowDefinitions>

           <RowDefinition Height="auto"/>

           <RowDefinition />

       </Grid.RowDefinitions>

       <Grid.ColumnDefinitions>

           <ColumnDefinition />        

       </Grid.ColumnDefinitions>

 

       <Label Grid.Row="0" Grid.Column="0" >Label</Label>

       <ListBox Grid.Row="1" Grid.Column="0">

           <ListBoxItem Content="1" />

           <ListBoxItem Content="2" />

           <ListBoxItem Content="3" />          

       </ListBox>

   </Grid>

</catel:DataWindow>

 

Right behavior:

<Window x:Class="WPFAppCatel.Views.WindowClassic"

       xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

       xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

       Title="WindowClassic" Width="1024" Height="600">

   <Grid>

       <Grid.RowDefinitions>

           <RowDefinition Height="auto"/>

           <RowDefinition />

       </Grid.RowDefinitions>

       <Grid.ColumnDefinitions>

           <ColumnDefinition />

       </Grid.ColumnDefinitions>

 

       <Label Grid.Row="0" Grid.Column="0" >Label</Label>

       <ListBox Grid.Row="1" Grid.Column="0">

           <ListBoxItem Content="1" />

           <ListBoxItem Content="2" />

           <ListBoxItem Content="3" />          

       </ListBox>

   </Grid>

</Window>

 

 

Can you please solve this bug for us?

 Thanks.

 

 Martin

Coordinator
May 10, 2012 at 4:33 PM

By default, the data window sets the SizeToContent to SizeToContent.WidthAndHeight. You should set it to SizeToContent.Manual if you want to set it manually.