Hi All,
I am working on XamDataGrid, I have List<List<List>> which generates the treeview effect in XamDAtaGrid. Its very simple collection.
but I can see some unwanted Accumulation of Field layouts on scrolling inside XamdatagRide. attached Screenshot.
I am not able to resolve this by seeting any property.
Please help.
Thanks
Hello Morgan,
I am just checking if my last reply was helpful for you.
If you require any further assistance, please do not hesitate to ask.
The Visibility property of the DataRecordPresenter is internally set to ‘Visible’ as it is used for providing other functionality of the xamDataGrid. You could find more information in this forum thread: http://ko.infragistics.com/community/forums/t/13256.aspx.
Another approach that can be used to collapse some of the records is setting the Height property instead of Visibility. You should change the converter so that it returns 0 if the record should not be displayed and Double.Nan if the Height should stay the same:
In XAML:
<Setter Property="Height" Value="{Binding Path=DataItem.Visible, Converter={StaticResource _visibilityConverter}}"/>
In code-behind:
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if ((bool)value == false)
return 0;
}
else
return double.NaN;
Please do not hesitate to ask if you have any questions.
Just know I got the solution for same. Thanks for looking into it.
But, Why is Visibility property binding not working, whereas IsExdpanded propertybinding is working
<Style TargetType="{x:Type igDP:DataRecordPresenter}"> <Setter Property="HorizontalAlignment" Value="Left"/> <Setter Property="BorderBrush" Value="Black"/> <Setter Property="BorderThickness" Value="2"/> <Setter Property="Visibility" Value="{Binding RelativeSource={RelativeSource Self}, NotifyOnSourceUpdated=True, NotifyOnTargetUpdated=True, UpdateSourceTrigger=PropertyChanged, Mode=OneWay, Path=Record.DataItem.Visible, Converter={StaticResource _visibilityConverter}}"/> <Setter Property="IsExpanded" Value="{Binding RelativeSource={RelativeSource Self}, Path=Record.DataItem.Expanded, Mode=TwoWay, NotifyOnSourceUpdated=True, NotifyOnTargetUpdated=True, UpdateSourceTrigger=PropertyChanged}"/> <!--<EventSetter Event="RequestBringIntoView" Handler="DRPloaded"/>--> </Style>
public class VisibilityConverter : ConverterBase { public VisibilityConverter() : base() { } public bool CollapsedWhenHidden { get { return _collapsedWhenHidden; } set { _collapsedWhenHidden = value; } } public override object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (value is bool && Object.Equals(targetType, typeof(Visibility))) { return ((bool)value ? Visibility.Visible : (_collapsedWhenHidden ? Visibility.Collapsed : Visibility.Hidden)); } else { return null; } } public override object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { if (value is Visibility && Object.Equals(targetType, typeof(bool))) { return ((Visibility)value == Visibility.Visible); } else { return null; } } private bool _collapsedWhenHidden = true; }
Code behind :
foreach (var treeNodeRole in ExceptionChecksModel.Items) { foreach (var treeNodeReviewItemType in treeNodeRole.ReviewItemTypes) { foreach (var treeNodeCheckse in treeNodeReviewItemType.TreeNodeChecks) { bool isTreeNodeChecksOpen = // some logic (tru or false) treeNodeCheckse.Expanded = isTreeNodeChecksOpen; treeNodeCheckse.Visible = isTreeNodeChecksOpen; treeNodeReviewItemType.Expanded = isTreeNodeChecksOpen; treeNodeReviewItemType.Visible = isTreeNodeChecksOpen; treeNodeRole.Expanded = isTreeNodeChecksOpen; treeNodeRole.Visible = isTreeNodeChecksOpen; } } }
Hello Anant,
Thank you for posting!
I have been looking into your code but I am not completely sure I understood your scenario correctly. When do you use this _checksTree_AssigningFieldLayoutToItem method that you have provided as your code behind logic? Does this accumulation occur only when you are scrolling? Could you send me a sample project that is demonstrating the issue you are having? These will help me investigate it further and provide you with a better solution. Thank you in advance.
PLease attached the Xaml + Codebehind.
Pelase suggest some good solution. that Accumulation looks annoying.