/// <summary> /// Method to select the template based on status and index. /// </summary> /// <param name="item">stepview item.</param> /// <param name="container">step progress bar.</param> /// <returns>data template.</returns> public override DataTemplate SelectTemplate(object item, DependencyObject container) { StepViewItem stepViewItem = item as StepViewItem; if (stepViewItem != null) { ItemsControl itemsControl = ItemsControl.ItemsControlFromItemContainer(stepViewItem); int index = itemsControl.ItemContainerGenerator.IndexFromContainer(stepViewItem); StepStatus stepStatus = stepViewItem.Status; stepViewItem.MarkerWidth = 50; stepViewItem.MarkerHeight = 50; if (stepStatus == StepStatus.Inactive && index == 0) { return(stepViewItem.FindResource("InactiveFirstStepTemplate") as DataTemplate); } else if (stepStatus == StepStatus.Indeterminate && index == 0) { return(stepViewItem.FindResource("IndeterminateFirstStepTemplate") as DataTemplate); } else if (stepStatus == StepStatus.Active && index == 0) { return(stepViewItem.FindResource("ActiveFirstStepTemplate") as DataTemplate); } else if (stepStatus == StepStatus.Inactive && index == 1) { return(stepViewItem.FindResource("InactiveSecondStepTemplate") as DataTemplate); } else if (stepStatus == StepStatus.Indeterminate && index == 1) { return(stepViewItem.FindResource("IndeterminateSecondStepTemplate") as DataTemplate); } if (stepStatus == StepStatus.Active && index == 1) { return(stepViewItem.FindResource("ActiveSecondStepTemplate") as DataTemplate); } else if (stepStatus == StepStatus.Inactive && index == 2) { return(stepViewItem.FindResource("InactiveThirdStepTemplate") as DataTemplate); } else if (stepStatus == StepStatus.Indeterminate && index == 2) { return(stepViewItem.FindResource("IndeterminateThirdStepTemplate") as DataTemplate); } else if (stepStatus == StepStatus.Active && index == 2) { return(stepViewItem.FindResource("ActiveThirdStepTemplate") as DataTemplate); } } return(null); }
/// <summary> /// Method to select the template based on status and index. /// </summary> /// <param name="item">stepview item.</param> /// <param name="container">step progress bar.</param> /// <returns>data template.</returns> public override DataTemplate SelectTemplate(object item, DependencyObject container) { StepViewItem stepViewItem = item as StepViewItem; if (stepViewItem != null) { if (stepViewItem.Status == StepStatus.Active) { return(stepViewItem.FindResource("CompletedTemplate") as DataTemplate); } else if (stepViewItem.Status == StepStatus.Indeterminate) { return(stepViewItem.FindResource("InProgressTemplate") as DataTemplate); } else { return(stepViewItem.FindResource("NotStartedTemplate") as DataTemplate); } } return(null); }
public override DataTemplate SelectTemplate(object item, DependencyObject container) { StepViewItem stepViewItem = item as StepViewItem; stepViewItem.MarkerWidth = 30; stepViewItem.MarkerHeight = 30; if (stepViewItem != null) { StepStatus stepperState = stepViewItem.Status; if (stepperState == StepStatus.Indeterminate) { return(stepViewItem.FindResource("IndeterminateCircleTemplate") as DataTemplate); } else if (stepperState == StepStatus.Active) { return(stepViewItem.FindResource("ActiveCircleTemplate") as DataTemplate); } else { return(stepViewItem.FindResource("InactiveCircleTemplate") as DataTemplate); } } return(null); }