简体   繁体   English

如何实现多路复用器控件

[英]How to implement a mux control

I've implemented two different controls that allow a user to create and edit a filter for their data. 我实现了两个不同的控件,它们允许用户创建和编辑其数据的过滤器。 Both controls have a DependencyProperty called Filter that implements my IFilter interface. 这两个控件都有一个名为Filter的DependencyProperty,它实现了我的IFilter接口。 One of the controls implements a RegularExpression filter, the other control implements a SelectionFilter (A list box where the select what items they want to filter on). 其中一个控件实现了RegularExpression筛选器,另一个控件则实现了SelectionFilter(一个列表框,用于选择要筛选的项目)。

I'd now like to create a control that combines these filters into a CompoundFilterControl . 我现在想创建一个将这些过滤器组合到CompoundFilterControl中的控件。 The CoumpoundFilterControl should allow the user to select what type of filter they'd like to use. CoumpoundFilterControl应该允许用户选择他们想要使用的过滤器类型。 CompoundFilterControl

Ideally I'd like my CompoundFilterControl to also have a Filter DependancyProperty. 理想情况下,我希望我的CompoundFilterControl也具有Filter DependancyProperty。 Depending on which Tab is selected, I'd like the Filter from the appropriate control to be selected. 根据选择的选项卡,我希望从适当的控件中选择“过滤器”。

I have no idea how to do this. 我不知道该怎么做。 The only thought I've had is impelementing the TabControl's SelectionChanged event and attempting to Dynamically bind the appropriate sub-control's Filter property to the CompoundFilterControl's Filter DependancyProperty. 我唯一想到的是实现TabControl的SelectionChanged事件,并尝试将适当的子控件的Filter属性动态绑定到CompoundFilterControl的Filter DependancyProperty。 Is this correct? 这个对吗?

如果我了解您要执行的操作,则可以让您的组合控件也实现IFilter,并且该IFilter实现仅在所选选项卡中调用该控件的IFilter接口

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM