Donate

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.
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); 
XAML Markup:
 <StackPanel x:Name="spThur" Height="Auto" Background="Green" HorizontalAlignment="Left" Orientation="Horizontal">  
      <Rectangle Name="sizingElement4" Fill="Transparent" Margin="1" Height="333"/>  
  </StackPanel> 
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

Comments

Donate

Popular Posts From This Blog

WPF CRUD Application Using DataGrid, MVVM Pattern, Entity Framework, And C#.NET

TypeScript Error Or Bug: The term 'tsc' is not recognized as the name of a cmdlet, function, script file, or operable program.

Invalid nested tag div found, expected closing tag input