3

階層コレクションがあり、サイズが大きいため、最下位レベルを遅延ロードします。

私がアクティブにしようとしているアクションはCollectionHolderManagerにありますが、バブリングが何らかの理由でそのビジュアルレイヤーをスキップしているようです。

<ItemsControl DataContext="{Binding Path=CollectionHolderManager}"
                      ItemsSource="{Binding Path=CollectionTopLevel}">
    <ItemsControl.ItemTemplate>
        <DataTemplate>
            <telerik:RadToolBar cal:Bind.Model="{Binding}">

                <TextBlock x:Name="Name" />

                <ItemsControl ItemsSource="{Binding Path=CollectionMiddleLevel}">
                    <ItemsControl.ItemTemplate>
                        <DataTemplate>

                            <telerik:RadDropDownButton cal:Bind.Model="{Binding}"
                                                               Content="{Binding Path=Name}"
                                                               cal:Message.Attach="[Event DropDownOpened] = [Action GetLowestLevel($dataContext)]">
                                <telerik:RadDropDownButton.DropDownContent>
                                    <telerik:RadListBox SelectionMode="Multiple"
                                                                ItemsSource="{Binding Path=CollectionLowestLevel}">
                                        <telerik:RadListBox.ItemTemplate>
                                            <DataTemplate>

                                                <!-- some template -->

                                            </DataTemplate>
                                        </telerik:RadListBox.ItemTemplate>

                                    </telerik:RadListBox>
                                </telerik:RadDropDownButton.DropDownContent>
                            </telerik:RadDropDownButton>
                        </DataTemplate>
                    </ItemsControl.ItemTemplate>
                </ItemsControl>
            </telerik:RadToolBar>
        </DataTemplate>
    </ItemsControl.ItemTemplate>
</ItemsControl>

したがって、TopLevelCollectionにアクションがある場合、それが呼び出されます。

CollectionHolderManagerを所有するViewModelにある場合は呼び出されますが、CollectionHodlerManager自体にある場合は呼び出されません。なぜそれをスキップするのですか?

4

1 に答える 1

4

こんなに単純なことを見逃したなんて信じられません。

<ItemsControl cal:Bind.Model="{Binding Path=CollectionHolderManager}"
              ItemsSource="{Binding Path=CollectionTopLevel}">

DataContextの代わりにBind.Model。

于 2012-08-24T10:53:26.417 に答える