locked
Adding item to collection does not refresh activity designer RRS feed

  • Question

  • Hi there,

    Am re-hosting my designer and have added a toolbox item which has a WorkflowItemsPresenter to render multiple child activity items. So my model item has a collection as:

    Sequence _innerSequence = new Sequence();
            [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
            [Browsable(false)]
            [Description("")]
            public Collection<Activity> Activities { get { return _innerSequence.Activities; } }

    and the binding is

    <sap:WorkflowItemsPresenter Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="2" Items="{Binding Path=ModelItem.Activities}" VerticalAlignment="Center" HorizontalAlignment="Center" HintText="Drop activities here">
            <sap:WorkflowItemsPresenter.SpacerTemplate>
                    <DataTemplate>
                        <Label HorizontalAlignment="Center" Height="21"/>                    
                    </DataTemplate>
                </sap:WorkflowItemsPresenter.SpacerTemplate>
            </sap:WorkflowItemsPresenter>

    The binding works absolutely fine when the designer is loaded. Now i want to clear and add new items to this collection when some filter is updated on the designer. So in the set accessor of this filter property i call a method which does the following:

    private void RefreshApplication()
            {
                Activities.Clear();
                Activities.Add(new AddXYZApplication() { ApplicationName = "Test" });
            }

    Though the collection gets updated the designer does not refresh. I know there is a way of doing this by writing some designer code-behind (i.e. updating the collection via the model item tree), but I would ideally like to have NO code-behind and expect it work like any other WPF application.

    Any help would be greatly appreciated as I have been trying to devise a way (using multi-binding, using eventing etc) from sometime now.

    Cheerio,

    V


    http://btsbee.wordpress.com/

    Thursday, March 7, 2013 11:33 AM