public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) { string stringValue = value as string; if (stringValue != null) { ViewBase toReturn = null; string completeName = stringValue; int pointIndex = completeName.IndexOf("."); string viewName = string.Empty; string themeName = string.Empty; if (pointIndex != -1) { viewName = completeName.Substring(0, pointIndex); themeName = completeName.Substring(pointIndex + 1); } else { viewName = completeName; } viewName = viewName.ToLowerInvariant(); switch (viewName) { case "tableview": toReturn = new TableView(); break; case "tableflowview": toReturn = new TableflowView(); break; } if (toReturn == null) { throw new ArgumentException("The specified view is invalid.", "value"); } else { if (!string.IsNullOrEmpty(themeName)) { ThemeConverter themeConverter = new ThemeConverter(); toReturn.Theme = (Theme)themeConverter.ConvertFromString(themeName); } } return(toReturn); } return(base.ConvertFrom(context, culture, value)); }
private void SetCellDataContextAnimated(bool hideContent) { object dataContext = this.DataContext; UnboundDataItem unboundDataItemContext = this.UnboundDataItemContext; bool isNewContext; foreach (Cell cell in this.CreatedCells) { Cell.AssignDataContext(cell, dataContext, unboundDataItemContext, cell.ParentColumn, out isNewContext); // We must refresh the Displayed template // since ShouldDisplayEditor always return // false when an EmptyDataItem is detected cell.RefreshDisplayedTemplate(); } if (hideContent) { this.ApplyAnimationClock(Row.CellContentOpacityProperty, null); this.SetValue(Row.CellContentOpacityProperty, 0d); } else { m_fadeInAnimation.From = 0d; m_fadeInAnimation.To = 1d; m_fadeInAnimation.Duration = TimeSpan.FromMilliseconds(TableflowView.GetRowFadeInAnimationDuration(DataGridControl.GetDataGridContext(this))); if (m_opacityAnimationClock != null) { m_opacityAnimationClock.Controller.Pause(); m_opacityAnimationClock.Completed -= this.OpacityAnimationClock_Completed; m_opacityAnimationClock = null; } m_opacityAnimationClock = ( AnimationClock )m_fadeInAnimation.CreateClock(true); m_opacityAnimationClock.Completed += this.OpacityAnimationClock_Completed; this.ApplyAnimationClock(Row.CellContentOpacityProperty, m_opacityAnimationClock); m_opacityAnimationClock.Controller.Begin(); } }
public void Visit(DataGridContext sourceContext, int sourceDataItemIndex, object item, ref bool stopVisit) { // In TableflowView, we must consider that sticky headers may hide the item. if (m_itemsHost != null) { if (m_isFirstItem) { m_isFirstItem = false; // At least half the item is hidden. if (m_firstItemHiddenRatio > 0.5d) { return; } } var areHeadersSticky = TableflowView.GetAreHeadersSticky(sourceContext); var areGroupHeadersSticky = TableflowView.GetAreGroupHeadersSticky(sourceContext); var areParentRowsSticky = TableflowView.GetAreParentRowsSticky(sourceContext); if (areHeadersSticky || areGroupHeadersSticky || areParentRowsSticky) { var stickyHeadersCount = sourceContext.CustomItemContainerGenerator.GetStickyHeaderCountForIndex(sourceDataItemIndex, areHeadersSticky, areGroupHeadersSticky, areParentRowsSticky); if (stickyHeadersCount > m_stickyHeadersSkipped) { m_stickyHeadersSkipped++; return; } } } m_item = item; m_parentDataGridContext = sourceContext; m_success = true; stopVisit = true; }