WPF Scroll Viewer Slow Performance (Bind Control Height From Another Object Using Code)
In this post, I created a datagrid dynamically or from code. When a record is loaded, the scrolling is slow using Scrollviewer control. So to translate into code behind here's what i come up.
XAML Markup:
The mapGrid datagrid is added to the stackpanel. And the Rectangle object is the sizing element.I found the solution from this site:
http://stackoverflow.com/questions/7254362/scrollviewer-slow-perfomance-with-datagrid
Binding bindHeight = new Binding(); bindHeight.ElementName = String.Format("sizingElement{0}", index + 1); bindHeight.FallbackValue = 1; bindHeight.Path = new PropertyPath("ActualHeight"); //mapGrid is the datagrid object mapGrid.SetBinding(DataGrid.HeightProperty, bindHeight);
<StackPanel x:Name="spThur" Height="Auto" Background="Green" HorizontalAlignment="Left" Orientation="Horizontal"> <Rectangle Name="sizingElement4" Fill="Transparent" Margin="1" Height="333"/> </StackPanel>
http://stackoverflow.com/questions/7254362/scrollviewer-slow-perfomance-with-datagrid
Comments
Post a Comment