Datagrid in a region auto height adjustment

Topics: Prism v2 - WPF 3.5
Dec 21, 2009 at 8:30 AM
Edited Dec 21, 2009 at 8:32 AM

Hello,

I have a datagrid in a region. Data size can be changed according to parameters. Horizontal alignment is working fine. But when data is much and datagrid height pass beyond limits of region veritcally, datagrid is clipped and vertical scrollbar (Always selected, but not functioning) or moving by cursor does not show rows below. I have found a discussion thread (http://compositewpf.codeplex.com/Thread/View.aspx?ThreadId=28522) but my problem is not solved. Data grid is wrapped within a stackpanel. I am using Oct. 2009 WPF version and c#. 

Regards.

 

Region def in shell:

 

        <Grid x:Name="ContentGrid" Grid.Row="2"  >
            <Grid.RenderTransform>
                <TransformGroup>
                    <ScaleTransform/>
                    <SkewTransform/>
                    <RotateTransform/>
                    <TranslateTransform/>
                </TransformGroup>
            </Grid.RenderTransform>
                <Controls:RoundedBox />
            <!--Controls:AnimatedTabControl SelectedIndex="0"  ItemContainerStyle="{StaticResource ShellTabItemStyle}"-->
                <TabControl
                    x:Name="RulesetsTab"
                    VerticalAlignment="Stretch"
                    HorizontalAlignment="Stretch"
                    Height="Auto"
                    Width="Auto"
                    ItemContainerStyle="{StaticResource ShellTabItemStyle}" SelectedIndex="0"
                    Background="{StaticResource headerBarBG}" 
                    cal:RegionManager.RegionName="{x:Static inf:RegionNames.RulesetListRegion}"
                    AutomationProperties.AutomationId="RulesetsTab" Opacity="0.75">
                </TabControl>
            </Grid>

 

        <Grid x:Name="ContentGrid" Grid.Row="2"  >

            <Grid.RenderTransform>

                <TransformGroup>

                    <ScaleTransform/>

                    <SkewTransform/>

                    <RotateTransform/>

                    <TranslateTransform/>

                </TransformGroup>

            </Grid.RenderTransform>

                <Controls:RoundedBox />

            <!--Controls:AnimatedTabControl SelectedIndex="0"  ItemContainerStyle="{StaticResource ShellTabItemStyle}"-->

                <TabControl

                    x:Name="RulesetsTab"

                    VerticalAlignment="Stretch"

                    HorizontalAlignment="Stretch"

                    Height="Auto"

                    Width="Auto"

                    ItemContainerStyle="{StaticResource ShellTabItemStyle}" SelectedIndex="0"

                    Background="{StaticResource headerBarBG}" 

                    cal:RegionManager.RegionName="{x:Static inf:RegionNames.RulesetListRegion}"

                    AutomationProperties.AutomationId="RulesetsTab" Opacity="0.75">

                </TabControl>

            </Grid>

Datagrid:

 

        <my:DataGrid AutoGenerateColumns="False" Name="dgRuleSets" SelectionMode="Extended" 

                     ItemsSource="{Binding Items}" ClipboardCopyMode="IncludeHeader"  

                     RowDetailsVisibilityMode="VisibleWhenSelected" HorizontalContentAlignment="Left"

                     VerticalScrollBarVisibility="Visible" HorizontalScrollBarVisibility="Auto"

                     SelectedIndex="{Binding Path=DgRuleSets_SelectedIndex,Mode=TwoWay}" HeadersVisibility="All" Height="Auto" RowHeaderWidth="75" ClipToBounds="True"

                     SizeChanged="dgRuleSets_SizeChanged" RowStyle="{StaticResource MyCellStyle}">

            <my:DataGrid.Columns >

 

 

 

Dec 21, 2009 at 9:41 AM

I changed the surrending container from stackpanel to grid and problem is gone away. Thanks. I couldn't find a way to remove the thread. Sorry for disturbance.

Regards.