首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >Caliburn.Micro消息冒泡跳过控件

Caliburn.Micro消息冒泡跳过控件
EN

Stack Overflow用户
提问于 2012-08-23 23:49:54
回答 1查看 789关注 0票数 3

我有一个分层的集合,我延迟加载最低层,因为它的大小。

我试图激活的操作是在CollectionHolderManager上,但由于某种原因,冒泡似乎跳过了那个视觉层。

代码语言:javascript
运行
复制
<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上有动作,它的get就会被调用。

如果我把它放在拥有CollectionHolderManager的ViewModel上,get就会被调用,但当它放在CollectionHodlerManager上时就不会了。为什么它会跳过这一点?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2012-08-24 18:53:26

这么简单的事情,我都不敢相信我错过了。

代码语言:javascript
运行
复制
<ItemsControl cal:Bind.Model="{Binding Path=CollectionHolderManager}"
              ItemsSource="{Binding Path=CollectionTopLevel}">

Bind.Model而不是DataContext。

票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/12095534

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档