1

我们有一个通过绑定转换器转换的数组:

else if (TTools.IsOfBaseClass(value.GetType(), typeof(System.Activities.Presentation.Model.ModelItemCollection)))
        {

              OurBaseClass[] test = (value as ModelItemCollection).GetCurrentValue() as OurBaseClass[];
              List<OurBaseClass> listOfArray = new List<OurBaseClass>();
              foreach (OurBaseClass item in test)
                {
                     listOfArray.Add(item);
                }
                return listOfArray;

        }

转换效果很好,但在我们的动态 gui 中没有显示

带有绑定的gui代码:

<sap:WorkflowItemsPresenter xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:sap="clr-namespace:System.Activities.Presentation;assembly=System.Activities.Presentation"  Grid.Column="0" Name="MyArray" Items="{Binding Path=ModelItem.MyArray}"  MinWidth="150" Margin="0">
                <sap:WorkflowItemsPresenter.SpacerTemplate >
                    <DataTemplate>
                        <TextBlock  Foreground="DarkGray" Margin="30">..</TextBlock>
                    </DataTemplate>
                </sap:WorkflowItemsPresenter.SpacerTemplate>
                <sap:WorkflowItemsPresenter.ItemsPanel>
                    <ItemsPanelTemplate>
                        <StackPanel Orientation="Vertical" HorizontalAlignment="Center" Margin="0"/>
                    </ItemsPanelTemplate>
                </sap:WorkflowItemsPresenter.ItemsPanel>
            </sap:WorkflowItemsPresenter>

为什么gui没有显示为列表???它在没有转换器的情况下运行良好。谢谢

4

1 回答 1

0

您是否尝试在转换器中设置断点?

我认为第一个问题可能是 ModelItem.MyArray 是 ModelProperty 类型,而不是 ModelItemCollection。

于 2010-02-26T09:26:57.050 回答