private void SynchronizeCardViewItems( CardListViewElement cardElement, List <LayoutControlItemBase> containerItems) { IDictionary <string, string> boundItems = cardElement.BoundItems; if (boundItems == null || boundItems.Count == 0) { return; } foreach (LayoutControlItemBase containerItem in containerItems) { ICardViewBoundItem cardViewBoundItem = containerItem as ICardViewBoundItem; if (cardViewBoundItem != null) { string cardItemFieldName = this.GetCardItemFieldName(containerItem, boundItems); if (!string.IsNullOrEmpty(cardItemFieldName)) { ListViewDetailColumn column = cardElement.Owner.Columns[cardItemFieldName]; if (column != null && (cardViewBoundItem.CardField == null || cardViewBoundItem.CardField.Name != column.Name)) { cardViewBoundItem.FieldName = column.Name; cardViewBoundItem.SetCardField(column); } cardViewBoundItem.Synchronize(); } } } }
private bool HasItemCollapsedGroups(CardListViewElement cardElement) { if (cardElement.CollapsedGroupsDictionary.ContainsKey(this.Data)) { return(cardElement.CollapsedGroupsDictionary[this.Data].Count > 0); } return(false); }
private List <string> GetCollapsedItemNames(CardListViewElement cardElement) { if (cardElement.CollapsedGroupsDictionary.ContainsKey(this.Data)) { return(cardElement.CollapsedGroupsDictionary[this.Data]); } return(new List <string>()); }
protected override void SynchronizeProperties() { base.SynchronizeProperties(); CardListViewElement viewElement = this.Data.Owner.ViewElement as CardListViewElement; if (viewElement == null) { return; } viewElement.CompareContainers(this.layoutContainer, this); this.UpdateGroupItemsExpandedState(viewElement); List <LayoutControlItemBase> allChildItems = viewElement.GetAllChildItems((RadItemCollection)this.CardContainer.Items); this.SynchronizeCardViewItems(viewElement, allChildItems); foreach (LayoutControlItemBase layoutControlItemBase in allChildItems) { ((RadCardViewElement)this.Data.Owner).OnCardViewItemFormatting(new CardViewItemFormattingEventArgs(layoutControlItemBase, this)); } }
public override TypeConverter.StandardValuesCollection GetStandardValues( ITypeDescriptorContext context) { List <string> stringList = new List <string>(); LayoutControlItemBase layoutControlItemBase = context.Instance is ICardViewBoundItem ? context.Instance as LayoutControlItemBase : (LayoutControlItemBase)null; if (layoutControlItemBase != null && layoutControlItemBase.ElementTree != null && (layoutControlItemBase.ElementTree.Control != null && layoutControlItemBase.ElementTree.Control.Parent != null) && layoutControlItemBase.ElementTree.Control.Parent is RadCardView) { CardListViewElement viewElement = (layoutControlItemBase.ElementTree.Control.Parent as RadCardView).CardViewElement.ViewElement as CardListViewElement; if (viewElement != null) { stringList.Add(string.Empty); foreach (KeyValuePair <string, Type> fieldName in viewElement.GetFieldNames()) { stringList.Add(fieldName.Key); } } } return(new TypeConverter.StandardValuesCollection((ICollection)stringList)); }
private void UpdateGroupItemsExpandedState(CardListViewElement cardElement) { List <LayoutControlItemBase> allChildItems = cardElement.GetAllChildItems((RadItemCollection)this.CardContainer.Items); List <string> collapsedItemNames = this.GetCollapsedItemNames(cardElement); foreach (LayoutControlItemBase layoutControlItemBase in allChildItems) { LayoutControlGroupItem controlGroupItem = layoutControlItemBase as LayoutControlGroupItem; if (controlGroupItem != null) { bool flag = true; if (collapsedItemNames.Contains(controlGroupItem.Name)) { flag = false; } controlGroupItem.isAttaching = true; controlGroupItem.IsExpanded = flag; controlGroupItem.isAttaching = false; } } }
protected override SizeF MeasureContentCore(SizeF availableSize, SizeF desiredSize) { if (this.Data == null || this.IsDesignMode) { return(SizeF.Empty); } float num1 = 0.0f; float num2 = 0.0f; if (this.Data.Owner.ShowCheckBoxes) { switch (this.Data.Owner.CheckBoxesPosition) { case CheckBoxesPosition.Left: case CheckBoxesPosition.Right: num1 = this.ToggleElement.DesiredSize.Width; break; default: num2 = this.ToggleElement.DesiredSize.Height; break; } } desiredSize.Width += num1; desiredSize.Height += num2; RadListViewElement owner = this.Data.Owner; if (owner == null) { return(desiredSize); } bool arbitraryItemWidth = owner.AllowArbitraryItemWidth; bool arbitraryItemHeight = owner.AllowArbitraryItemHeight; CardListViewElement viewElement = owner.ViewElement as CardListViewElement; SizeF itemSize = (SizeF)owner.ItemSize; if (viewElement.CardTemplate.ContainerElement.LayoutTree.Root != null) { if (arbitraryItemWidth) { itemSize.Width = viewElement.CardTemplate.ContainerElement.LayoutTree.Root.Bounds.Width; } if (arbitraryItemHeight) { itemSize.Height = viewElement.CardTemplate.ContainerElement.LayoutTree.Root.Bounds.Height; } } desiredSize = itemSize; if (!arbitraryItemHeight && !arbitraryItemWidth) { this.layoutContainer.Measure(desiredSize); this.UpdateScrollbars(desiredSize); } else if (arbitraryItemHeight && !arbitraryItemWidth) { desiredSize.Width = itemSize.Width + num1; this.layoutContainer.Measure(desiredSize); if (this.HasItemCollapsedGroups(viewElement) && this.layoutContainer.LayoutTree.Root != null) { this.layoutContainer.Measure((SizeF) new Size(1, 1)); desiredSize.Height = this.layoutContainer.LayoutTree.Root.Bounds.Height; this.layoutContainer.Measure(desiredSize); } if (this.HorizontalScrollBar.Visibility != ElementVisibility.Collapsed) { desiredSize.Height += (float)this.HorizontalScrollBar.MinSize.Height; } this.UpdateScrollbars(desiredSize); this.VerticalScrollBar.Visibility = ElementVisibility.Collapsed; desiredSize.Height += num2; if (this.Data.Size.Height > 0) { desiredSize.Height = (float)this.Data.Size.Height; } } else if (!arbitraryItemHeight && arbitraryItemWidth) { desiredSize.Height = itemSize.Height + num2; this.layoutContainer.Measure(desiredSize); if (this.HasItemCollapsedGroups(viewElement) && this.layoutContainer.LayoutTree.Root != null) { desiredSize.Width = this.layoutContainer.LayoutTree.Root.Bounds.Width + (this.VerticalScrollBar.Visibility != ElementVisibility.Collapsed ? (float)this.VerticalScrollBar.MinSize.Width : 0.0f); this.layoutContainer.Measure(desiredSize); } this.UpdateScrollbars(desiredSize); this.HorizontalScrollBar.Visibility = ElementVisibility.Collapsed; if (this.VerticalScrollBar.Visibility != ElementVisibility.Collapsed) { desiredSize.Width += (float)this.VerticalScrollBar.MinSize.Width; } desiredSize.Width += num1; if (this.Data.Size.Width > 0) { desiredSize.Width = (float)this.Data.Size.Width; } } else { this.VerticalScrollBar.Visibility = ElementVisibility.Collapsed; this.HorizontalScrollBar.Visibility = ElementVisibility.Collapsed; this.layoutContainer.Measure(desiredSize); if (this.HasItemCollapsedGroups(viewElement) && this.layoutContainer.LayoutTree.Root != null) { desiredSize = this.layoutContainer.LayoutTree.Root.Bounds.Size; } this.layoutContainer.Measure(desiredSize); desiredSize.Width += num1; desiredSize.Height += num2; if (this.Data.Size.Width > 0) { desiredSize.Width = (float)this.Data.Size.Width; } if (this.Data.Size.Height > 0) { desiredSize.Height = (float)this.Data.Size.Height; } } Padding padding = Padding.Add(this.GetBorderThickness(true), this.Padding); desiredSize = SizeF.Add(desiredSize, new SizeF((float)padding.Horizontal, (float)padding.Vertical)); this.Data.ActualSize = desiredSize.ToSize(); return(desiredSize); }