private List <PanoramaChild> GetCurrentChildren() { var result = new List <PanoramaChild>(); var index = SelectedIndex; // Our "first" element is the element that is selected PanoramaChild lastChild = null; for (var counter = 0; counter < Children.Count; counter++) { if (index > Children.Count - 1) { index = 0; // We wrap back to item 0 when we shoot out the back } if (Children[index].Visibility == Visibility.Visible) { var currentChild = Children[index]; if (lastChild != null && SimpleView.GetFlowsWithPrevious(currentChild)) { lastChild.FloatingElements.Add(currentChild); } else { lastChild = new PanoramaChild { Child = currentChild, ActualChildIndex = index }; result.Add(lastChild); } } index++; } return(result); }
/// <summary> /// Gets the controls in pairs. /// </summary> /// <returns>List<ControlPair>.</returns> private List <ControlPair> GetControls() { var controls = new List <ControlPair>(); for (var controlCounter = 0; controlCounter < Children.Count; controlCounter++) { var child = Children[controlCounter]; if (child.Visibility == Visibility.Collapsed) { continue; } var controlPair = new ControlPair(0d); if (SimpleView.GetIsStandAloneEditControl(child)) { controlPair.Edit = child; } else { controlPair.Label = child; if (SimpleView.GetSpanFullWidth(child)) { controlPair.LabelSpansFullWidth = true; } else if (!SimpleView.GetIsStandAloneLabel(child)) { var editControlIndex = controlCounter + 1; if (Children.Count > editControlIndex) { controlPair.Edit = Children[editControlIndex]; } controlCounter++; // We are skipping the next control since we already accounted for it while (true) // We check if the next control might flow with the current edit control { if (Children.Count <= controlCounter + 1) { break; } if (!SimpleView.GetFlowsWithPrevious(Children[controlCounter + 1])) { break; } controlPair.AdditionalEditControls.Add(Children[controlCounter + 1]); controlCounter++; } } } controls.Add(controlPair); } return(controls); }