C# 用户控件的嵌套属性

C# 用户控件的嵌套属性,c#,asp.net,properties,user-controls,C#,Asp.net,Properties,User Controls,我已经创建了用户控件并定义了所有属性。我能够在设计时访问/修改该属性。这里我需要知道如何将嵌套属性赋予同一个控件 例如,考虑默认属性“字体”,它具有诸如“粗体”、“斜体”、“名称”等子属性。这样,我需要自定义控件中嵌套的属性。 实际上,我需要在web应用程序中为用户控件提供类似这样的嵌套属性 提前感谢。尝试将所有属性更改为依赖属性。例如: public static DependencyProperty TextProperty = DependencyProperty.Register("

我已经创建了用户控件并定义了所有属性。我能够在设计时访问/修改该属性。这里我需要知道如何将嵌套属性赋予同一个控件

例如,考虑默认属性“字体”,它具有诸如“粗体”、“斜体”、“名称”等子属性。这样,我需要自定义控件中嵌套的属性。

实际上,我需要在web应用程序中为用户控件提供类似这样的嵌套属性


提前感谢。

尝试将所有属性更改为依赖属性。例如:

 public static DependencyProperty TextProperty = DependencyProperty.Register("Text", typeof(string), typeof(Choice));
     public string Text
     {
          get { return (string)GetValue(TextProperty); }
          set { SetValue(TextProperty, value); }
     }

     public static DependencyProperty Choice4Property = DependencyProperty.Register("Choice4", typeof(Choice), typeof(MyControl));
     public Choice Choice4
     {
          get { return (Choice)GetValue(Choice4Property); }
          set { SetValue(Choice4Property, value); }
     }

谢谢你的建议。请分享SetValue和GetValue方法的defn代码片段。