【问题标题】:Save User Control Properties and Reload保存用户控件属性并重新加载
【发布时间】:2012-08-10 14:54:13
【问题描述】:

我创建了一个用户控件,其中包含 Show 属性可以设置为 True 或 False,另一个属性 Color 可以更改我的控件的颜色。但我希望当用户在 Windows 应用程序中使用时,用户应该能够更改这些属性。 我该怎么做???

public bool Draw1MinuteTicks
    {
        get { return this.bDraw1MinuteTicks; }
        set { this.bDraw1MinuteTicks = value; }
    }
public Color TicksColor
    {
        get { return this.ticksColor; }
        set { this.ticksColor = value; }
    }

我有这些属性。

【问题讨论】:

标签: c# .net-4.0 .net-3.5 .net-2.0


【解决方案1】:

我认为满足您需求的最简单方法是使用数据绑定。那里有一些优秀的文章,例如Josh Smith's blog post。还可以查看有关 M-V-VM 模式的文章,例如Barry Lapthorn's blog post.

问候 约尔格

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-03-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多