WF 4.0 中的自定义活动:WorkflowItemsPresenter 不会显示转换后的数组

发布于 2024-08-22 19:09:35 字数 1652 浏览 6 评论 0原文

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

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 没有显示为列表???无需转换器即可正常工作。 谢谢

we have an Array which is converted via a Binded Converter:

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;

        }

the convertion works well but it is not shown in our dynamically gui

gui code with bindings:

<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>

Why is the gui not shown as a List??? it works well without converter.
Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

诠释孤独 2024-08-29 19:09:35

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

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

Have you tried setting a breakpoint in the converter?

I think the first problem may be that ModelItem.MyArray is type ModelProperty, rather than ModelItemCollection.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文