我设法创建了一个树视图组合框作为它的itempresenter使用selected item behavior 在这里。组合框 - 树视图,关闭项目选择?
<Popup x:Name="PART_Popup" AllowsTransparency="true" Focusable="false" IsOpen="{Binding IsDropDownOpen, RelativeSource={RelativeSource TemplatedParent}}" PopupAnimation="{DynamicResource {x:Static SystemParameters.ComboBoxPopupAnimationKey}}" Placement="Bottom">
<Microsoft_Windows_Themes:SystemDropShadowChrome x:Name="Shdw" Color="Transparent" MaxHeight="{TemplateBinding MaxDropDownHeight}" MinWidth="{TemplateBinding ActualWidth}">
<Border x:Name="DropDownBorder" BorderBrush="{DynamicResource {x:Static SystemColors.WindowFrameBrushKey}}" BorderThickness="1" Background="{DynamicResource {x:Static SystemColors.WindowBrushKey}}">
<ScrollViewer>
<TreeView x:Name="PART_TreeView" ItemsSource="{TemplateBinding ItemsSource}">
<Interactivity:Interaction.Behaviors>
<ComboTreeView:BindableSelectedItemBehaviour SelectedItem="{Binding RelativeSource={RelativeSource AncestorType={x:Type ComboBox} }, Path=SelectedItem, Mode=TwoWay}" />
</Interactivity:Interaction.Behaviors>
</TreeView>
</ScrollViewer>
</Border>
</Microsoft_Windows_Themes:SystemDropShadowChrome>
</Popup>
在treeview中选择一个项目正确设置组合框选定的项目。我不知道如何关闭弹出选择。每次我必须选择并点击控件以外的弹出窗口才能消失。这可以在XAML中完成吗?