Hi Guys
I'm want to create a listview of items where the item has a waiting bar which appears when the item is pressed and disappears again once a long running process kicked off by the press has completed. I have successfully built the custom item but when I go to the ItemMouseClick event of the listview I'm not sure how to access the waiting bar element so that I can make it visible and set it running.
Many thanks in advance
regards
Ian Carson
I'm want to create a listview of items where the item has a waiting bar which appears when the item is pressed and disappears again once a long running process kicked off by the press has completed. I have successfully built the custom item but when I go to the ItemMouseClick event of the listview I'm not sure how to access the waiting bar element so that I can make it visible and set it running.
Many thanks in advance
regards
Ian Carson
public class RadCustomVariationViewVisualItem : IconListViewVisualItem { private LightVisualElement _imageElement; private LightVisualElement _nameElement; private LightVisualElement _descriptionElement; private RadWaitingBarElement _waitingBarElement; private StackLayoutPanel _overallLayout; private StackLayoutPanel _textLayout; protected override void CreateChildElements() { base.CreateChildElements(); _overallLayout = new StackLayoutPanel {Orientation = Orientation.Horizontal}; _imageElement = new LightVisualElement { DrawText = false, ImageLayout = ImageLayout.Center, StretchVertically = false, Margin = new Padding(10, 22, 10, 5), NotifyParentOnMouseInput = true, ShouldHandleMouseInput = false }; _overallLayout.Children.Add(_imageElement); _textLayout = new StackLayoutPanel { Orientation = Orientation.Vertical }; _overallLayout.Children.Add(_textLayout); _nameElement = new LightVisualElement { TextAlignment = ContentAlignment.MiddleLeft, Margin = new Padding(10, 10, 10, 5), Font = new Font("Segoe UI", 12, FontStyle.Bold, GraphicsUnit.Point), NotifyParentOnMouseInput = true, ShouldHandleMouseInput = false }; _textLayout.Children.Add(_nameElement); _descriptionElement = new LightVisualElement { TextAlignment = ContentAlignment.MiddleLeft, Margin = new Padding(10, 5, 10, 5), Font = new Font("Segoe UI", 12, FontStyle.Bold, GraphicsUnit.Point), NotifyParentOnMouseInput = true, ShouldHandleMouseInput = false }; _textLayout.Children.Add(_descriptionElement); _waitingBarElement= new RadWaitingBarElement(); _waitingBarElement.WaitingBarOrientation = Orientation.Horizontal; _waitingBarElement.WaitingDirection = ProgressOrientation.Right; _waitingBarElement.Size = new Size(120, 14); _waitingBarElement.WaitingIndicatorSize = new Size(50, 30); _waitingBarElement.WaitingSpeed = 90; _waitingBarElement.WaitingStep = 2; _waitingBarElement.WaitingStyle = WaitingBarStyles.Dash; //_waitingBarElement.Visibility = ElementVisibility.Collapsed; _waitingBarElement.StartWaiting(); _textLayout.Children.Add(_waitingBarElement); Children.Add(_overallLayout); Padding = new Padding(10); Margin = new Padding(4, 2, 4, 2); Shape = new RoundRectShape(5); DrawBorder = true; DrawFill = true; BorderInnerColor = SystemColors.ControlLightLight; BorderInnerColor2 = SystemColors.Control; BorderInnerColor3 = SystemColors.ControlDark; BorderInnerColor4 = SystemColors.ControlDarkDark; BorderGradientStyle = GradientStyles.Solid; BorderBottomColor = SystemColors.ControlDark; BorderLeftColor = SystemColors.ControlDark; BorderTopColor = SystemColors.ControlDark; BorderRightColor = SystemColors.ControlDark; BorderGradientAngle = 270; BorderGradientStyle = GradientStyles.Solid; BackColor = SystemColors.Window; BackColor2 = SystemColors.Control; BackColor3 = SystemColors.ControlDark; BackColor4 = SystemColors.ControlLightLight; GradientAngle = 90; GradientPercentage = (float) 0.5; GradientPercentage2 = (float) 0.666; GradientStyle = GradientStyles.Linear; NumberOfColors = 2; SmoothingMode = SmoothingMode.AntiAlias; } protected override void OnMouseEnter(EventArgs e) { base.OnMouseEnter(e); BorderInnerColor = SystemColors.ControlLightLight; BorderInnerColor2 = SystemColors.Control; BorderInnerColor3 = SystemColors.ControlDark; BorderInnerColor4 = SystemColors.ControlDarkDark; BorderGradientStyle = GradientStyles.Solid; BorderBottomColor = SystemColors.ControlDark; BorderLeftColor = SystemColors.ControlDark; BorderTopColor = SystemColors.ControlDark; BorderRightColor = SystemColors.ControlDark; BorderGradientAngle = 90; BorderGradientStyle = GradientStyles.Linear; BackColor = SystemColors.Window; BackColor2 = SystemColors.Control; BackColor3 = SystemColors.ControlDark; BackColor4 = SystemColors.ControlLightLight; GradientAngle = 90; GradientPercentage = (float)0.5; GradientPercentage2 = (float)0.666; GradientStyle = GradientStyles.Linear; NumberOfColors = 3; SmoothingMode = SmoothingMode.AntiAlias; } protected override void OnMouseLeave(EventArgs e) { base.OnMouseLeave(e); BorderInnerColor = SystemColors.ControlLightLight; BorderInnerColor2 = SystemColors.Control; BorderInnerColor3 = SystemColors.ControlDark; BorderInnerColor4 = SystemColors.ControlDarkDark; BorderGradientStyle = GradientStyles.Solid; BorderBottomColor = SystemColors.ControlDark; BorderLeftColor = SystemColors.ControlDark; BorderTopColor = SystemColors.ControlDark; BorderRightColor = SystemColors.ControlDark; BorderGradientAngle = 270; BorderGradientStyle = GradientStyles.Solid; BackColor = SystemColors.Window; BackColor2 = SystemColors.Control; BackColor3 = SystemColors.ControlDark; BackColor4 = SystemColors.ControlLightLight; GradientAngle = 90; GradientPercentage = (float)0.5; GradientPercentage2 = (float)0.666; GradientStyle = GradientStyles.Linear; NumberOfColors = 2; SmoothingMode = SmoothingMode.AntiAlias; } protected override void SynchronizeProperties() { _imageElement.Image = (Image)Data["Image"]; _nameElement.Text = Convert.ToString(Data["Name"]); _descriptionElement.Text = Convert.ToString(Data["Description"]); } protected override SizeF MeasureOverride(SizeF availableSize) { var measuredSize = base.MeasureOverride(availableSize); _overallLayout.Measure(measuredSize); return measuredSize; } protected override SizeF ArrangeOverride(SizeF finalSize) { base.ArrangeOverride(finalSize); _overallLayout.Arrange(new RectangleF(PointF.Empty, finalSize)); return finalSize; } }private void LvViewsItemMouseClick(object sender, ListViewItemEventArgs e){ if (_resultsTable==null) _resultsTable = StrategyBacktestLoader.getBacktestResults(frmParadigmFM.Authority, ThisParent.StrategyID, ThisParent.ID, ThisVariation.ID); var element = sender as RadCustomVariationViewVisualItem; var view = (BacktestViewType) e.Item.Tag; DisplayBacktestView(view);}