I have issue binding the Row visibility with the collection item's property.I am using the below style but this sometimes work and sometimes not. When I scroll the grid up/down, it sometimes hides and sometimes not.
<Style TargetType="{x:Type igPrim:CellsPanel}"> <Setter Property="Visibility" Value="{Binding RowData.Visibility, FallbackValue=Visible}" /> </Style>
Is there any better way of doing it. I cannot use the Filters because I am using Virutalization records. (get records from Database on demand/scroll)
Hello Gajender and thank you for posting!
It seems that the cause for this behavior on your side is that the rows in the grid are virtualized and the visual elements are actually re-used so that they do not have to be rendered again when the user scrolls. Their data context on the other hand is modified and the corresponding values are displayed. Applying filters could be an option in this case although it does not listen to INotifypropertyChanged. Since you are updating your data when scrolling, you can use this and call the InvalidateData method for the grid to update so the updates take effect.Please let me know if you need additional assistance on this matter.
I have attached the sample of where is the issue and it is changing data on the fly.Data is already in there and Issue is with the vertical scrolling.
When I scroll the XamGrid using vertical scroll it works fine. When I scroll using the mouse wheels over the XamGrid, it is missing the rows display.
Using InvalidateData() which I have commented in the CustomizedXamGrid class is degrading the performance of XamGrid on scroll.
Is there any better of handle this.
Gajender,
I have tested the behavior you have described on my side using the latest build of version 14.1 - 14.1.20141.2216 and it seems that the issue is not reproducible. Which is the build version you are using? Please refer to the attached video that shows the behavior when the mouse wheel and the vertical scrollbar thumb are used for scrolling. I have added a column that shows the values of the RowVisibility property to illustrate better which rows are displayed. Could you please let me know if I am missing something in the scenario?
Hello,
I am just checking if you had a chance to look into this and if you would like any further assistance on the matter.
I have binded the Visibility of CellsPanel with the item's Property as below.
<Style TargetType="{x:Type igPrim:CellsPanel}" BasedOn="{StaticResource {x:Type igPrim:CellsPanel}}">
<Setter Property="Visibility" Value="{Binding AnalysisVisibility, FallbackValue=Visible, Mode=OneWay, TargetNullValue=Visible}" />
</Style>
I also tried to UpdateTarget as below but does not work either.
private void CellsPanel_Loaded(object sender, RoutedEventArgs e)
{
CellsPanel c = sender as CellsPanel;
c.DataContextChanged += new DependencyPropertyChangedEventHandler(c_DataContextChanged);
}
private void c_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e)
if (e.NewValue != null)
var dataContext = e.NewValue as EventViewModel;
if (dataContext != null)
BindingOperations.GetBindingExpressionBase(c, CellsPanel.VisibilityProperty).UpdateTarget();
Is there a way, I can recreate the CellsPanel every time I scroll rather than reuse the same control.
I fixed the issue by Binding the Height property of CellsPanel.
<Setter Property="Height" Value="{Binding AnalysisHeight, Mode=OneWay}" />
Hello Gajender,
Thank you for your feedback. I am glad that you resolved your issue and I believe that other community members may benefit from this as well.