Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / Silverlight > PanelBar > refreshing panelbar items

Not answered refreshing panelbar items

Feed from this thread
  • Kevin avatar

    Posted on Jan 31, 2012 (permalink)

    hi,  i'm trying to load a panel dynamically.  after i create a new object in my Diagrams collection, i just want to empty the panel and reload.  am i even close to correct here?:

            private void LoadWorkflowsToPanelBar()
            {
                var workflowsPanel = rpbTools.ChildrenOfType<RadPanelBarItem>().ElementAt(0);
                workflowsPanel.Items.Clear();
                
                foreach (var sssWorkflowDiagram in Diagrams)  // Diagrams is a collection i keep elsewhere
                {
                    RadPanelBarItem panelBarItem = new RadPanelBarItem();
                    StackPanel stackPanel = new StackPanel();
                    stackPanel.Orientation = Orientation.Horizontal;
                    Image image = CreateImage("../Images/workflow.png", "../Images/workflow.png", sssWorkflowDiagram.Name);
                    TextBlock textBlock = new TextBlock();
                    textBlock.Text = sssWorkflowDiagram.Name;
                    stackPanel.Children.Add(image);
                    stackPanel.Children.Add(textBlock);

                    panelBarItem.Tag = sssWorkflowDiagram.Id;
                    panelBarItem.Header = stackPanel;
                    workflowsPanel.Items.Add(panelBarItem);  // error is here
                }
    }
    this works fine the first time through, but the second time it is called, it does not load correctly.  when i debug this code, the following exception is thrown when the loop gets around to my new diagram:

    {System.ArgumentException: Value does not fall within the expected range.
       at MS.Internal.XcpImports.MethodEx(IntPtr ptr, String name, CValue[] cvData)
       at MS.Internal.XcpImports.MethodPack(IntPtr objectPtr, String methodName, Object[] rawData)
       at MS.Internal.XcpImports.Collection_Add[T](PresentationFrameworkCollection`1 collection, Object value)
       at System.Windows.PresentationFrameworkCollection`1.AddImpl(Object value)
       at System.Windows.Controls.ItemCollection.AddImpl(Object value)
       at System.Windows.Controls.ItemCollection.AddInternal(Object value)
       at System.Windows.PresentationFrameworkCollection`1.Add(T value)
       at SafetySpaces.Prototype.Silverlight.WorkflowDesigner.LoadWorkflowsToPanelBar()
       at SafetySpaces.Prototype.Silverlight.WorkflowDesigner.GetAllWorkflowDiagramsQueryCompleted(LoadOperation`1 loadOperation)
       at System.ServiceModel.DomainServices.Client.DomainContext.<>c__DisplayClass13`1.<Load>b__11(LoadOperation lo)
       at System.ServiceModel.DomainServices.Client.LoadOperation.<>c__DisplayClass4`1.<Create>b__0(LoadOperation`1 arg)
       at System.ServiceModel.DomainServices.Client.LoadOperation`1.InvokeCompleteAction()
       at System.ServiceModel.DomainServices.Client.OperationBase.Complete(Object result)
       at System.ServiceModel.DomainServices.Client.LoadOperation.Complete(DomainClientResult result)
       at System.ServiceModel.DomainServices.Client.DomainContext.CompleteLoad(IAsyncResult asyncResult)
       at System.ServiceModel.DomainServices.Client.DomainContext.<>c__DisplayClass1b.<Load>b__17(Object )}


    thanks,

    kevin

    Reply

  • Petar Mladenov Petar Mladenov admin's avatar

    Posted on Feb 3, 2012 (permalink)

    Hello Kevin ,

     I believe this could be naming issue in SIlverlight (2 visual elements with equal names). Could you please check out this forum post and let us know if it helps you or not? Thank you in advance.

    Kind regards,
    Petar Mladenov
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / Silverlight > PanelBar > refreshing panelbar items
Related resources for "refreshing panelbar items"

Silverlight PanelBar Features  |  Documentation  |  Demos  |  Telerik TV  |  Self-Paced Trainer  ]