DataGrid horizontal scrollbar issue

Feb 1, 2009 at 1:40 PM
Edited Feb 1, 2009 at 1:49 PM
Hello all!

I found strange datagrid behavior. I have following XAML:

<

Window x:Class="WpfApplication1.Window1" xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml

xmlns:tk=http://schemas.microsoft.com/wpf/2008/toolkit Title="Window1" Height="300" Width="300">

<Window.Resources>

<XmlDataProvider x:Key="prov" XPath="/Items/Item">

<x:XData>

<Items xmlns="">

<Item>

<Number>1</Number>

<Name>Table</Name>

<Count>10</Count>

<Price>500</Price>

</Item>

<Item>

<Number>5</Number>

<Name>LED Indicator</Name>

<Count>70</Count>

<Price>5</Price>

</Item>

<Item>

<Number>7</Number>

<Name>Notebook</Name>

<Count>170</Count>

<Price>1500</Price>

</Item>

<Item>

<Number>11</Number>

<Name>Network Adapter</Name>

<Count>10</Count>

<Price>50</Price>

</Item>

</Items>

</x:XData>

</XmlDataProvider>

</Window.Resources>

<Grid>

<tk:DataGrid ItemsSource="{Binding Source={StaticResource prov}}" AutoGenerateColumns="False">

<tk:DataGrid.Columns>

<tk:DataGridTextColumn Width="50" MinWidth="50" Header="#" Binding="{Binding XPath=Number}"/>

<tk:DataGridTextColumn Width="*" Header="Name" Binding="{Binding XPath=Name}"/>

<tk:DataGridTextColumn Width="70" Header="Count" Binding="{Binding XPath=Count}"/>

<tk:DataGridTextColumn Width="70" Header="Price" Binding="{Binding XPath=Price}" CanUserSort="False"/>

</tk:DataGrid.Columns>

</tk:DataGrid>

</Grid>

</

Window>

And when I set minimum width of the window like this:
http://i41.tinypic.com/119ypsy.jpg

horizontal scrollbar is shown. It's ok, but when I expand my window, horizontal scroll bar is "flashing" and when I stop, horizontal scrollbar is never hide. Window look like:
http://i40.tinypic.com/21kl56s.jpg

Is it a bug? How can I avoid that behavior?

Thanks in advance!

 

Feb 2, 2009 at 7:36 AM

I try to update to Jan 2009 release and this issue is repeated

Feb 5, 2009 at 4:57 AM
Up!

Can anyone post a comment - is it a bug and what can I do to avoid this behavior?
Coordinator
Feb 9, 2009 at 6:25 PM
Hi,

The behavior in the first pic is not a bug. This happens when size of viewport becomes less than the sum of MinWidths of the columns.

However the behavior in the second pic is a bug. I am not sure about the dates but next update should have this fix. And there is no easy way to work it around.
Feb 11, 2009 at 5:34 AM
Ok, thank you for your reply
Apr 6, 2009 at 3:32 PM
Edited Apr 6, 2009 at 3:35 PM
It seems that the bug is still alive.
The scrollbars are always shown, while using ScrollBarVisibility hidden or disabled.

<dg:DataGrid
     GridLinesVisibility="Vertical" VerticalGridLinesBrush="LightGray"
     HorizontalScrollBarVisibility="Hidden" ScrollViewer.HorizontalScrollBarVisibility="Hidden"
     VerticalScrollBarVisibility="Hidden" ScrollViewer.VerticalScrollBarVisibility="Hidden"
     HeadersVisibility="Column"
     BorderThickness="1"
     >

Is there an existing workaround, or a date for a next release wich will surely resolve the bug ?
Thanks.

Apr 6, 2009 at 4:47 PM
After reviewing my code and externalizing it in a blank project, the issue seems coming from my theme, and not from the framework.

Is it possible to know from what Type is the container for the rows ? (above the header, containing the whole rows)


Another question for design this time :
How to redefine the background of the columns header container ? (wich contains the ColumnHeaderStyle restyled part)