我是否必须通过 WPF 中的接口实现所有用户控件属性? [英] Do i have to implement all usercontrol properties by interface in WPF?
问题描述
我正在编写一堆 WPF 用户控件(不是 CommonControls!),使用接口来处理诸如对齐或内容之类的公共属性(取决于控件;TextBox 返回文本,并为每个示例标记内容).现在我可以使用 Checkbox 之类的控件,它具有不太常见的属性 IsChecked.我是否必须通过接口实现此属性,还是允许在用户控件本身中对其进行编程?
I'm programming a bunch of WPF usercontrols (not CommonControls!) using an Interface for the common properties like the alignments or the Content (depending on the control; TextBox returns the Text, and Label the Content per example). Now i get to controls like the Checkbox, which have the not so common property IsChecked. Do i have to implement this property by the Interface or is it allowed to program it in the usercontrol itself?
推荐答案
好吧,我猜这是一个愚蠢的问题.但八小时后,你不再知道,你是希拉里还是唐纳德.
Okay, i have to guess it was a dumb question. But after eight hours you don't know anymore, if you're Hillary or Donald.
答案是:一个接口可以从另一个接口继承并实现父"接口的所有成员.
The answer is: An Interface can inherit from another and implement all members from the "parent" interface.
这篇关于我是否必须通过 WPF 中的接口实现所有用户控件属性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!