Blend - PropertyChanges 没有更新

发布于 2024-09-19 02:52:59 字数 256 浏览 5 评论 0原文

我在 Silverlight 中有一个自定义控件,在我再次构建应用程序之前,通过属性窗口更改属性不会更新。可能是什么问题?

举例说吧。我有一个名为“形状”的控件。如果我选择形状类型为“辛烷值”,它应该在混合设计时表面中显示辛烷值示例。

但是,就我而言,这种情况没有发生,混合设计器不会得到更新,直到我再次构建应用程序。请就此向我提出建议。 我不想让消费者因财产价值的每一次变化而建造它,从而给他们带来麻烦。

注意:控件中所有公开的属性都是依赖属性。

I have a custom control in Silverlight, the change of property via property window is not getting updated until I build the application once again. What could be the problem?

Say for example. I have a control called Shapes. If I select type of the shape as "Octane" it should show a sample octane in blend design-time surface.

But, in my case it is not happening, the blend designer is not getting updated untill I build the application again. Please advice me on this.
I don't want to put the consumer in trouble by letting them build it for every change in property value they make.

Note: All the exposed properties in the control are dependency property.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

Smile简单爱 2024-09-26 02:53:11

我拥有的是用于应用样式的 CommonStyles 类型的属性。例如,

CommonStyles 将包含 dp,如背景、前景、厚度等,

我犯的错误是,我直接分配了如下值。在基础班。 [ShapeStyle 是 CommonStyle 类型的 dp]

//// Both properties are dp's but, assigned them like normal property. This caused the issue
ShapeBase.Background = this.Shape.ShapeStyle.Background;
ShapeBase.Foreground = this.Shape.ShapeStyle.Foreground; 

ShapeFace.Background = this.Shape.ShapeFaceStyle.Background;
...

当我更改背景属性时,它不会更新我的 ShapeBase.Background 属性。因为,它不受依赖关系的约束。

我通过 dp 绑定解决了这个问题。就像下面这样。

this.ShapeBase.SetBinding(BackgroundProperty, 
              new Binding() { 
              Source = this.Shape.ShapeStyle,
              Path = new PropertyPath("Background") });

What I had was a Properties of type CommonStyles for applying styles. For example,

CommonStyles will contains dp's like Background, Foreground, Thickness, etc.,

The mistake I done was, I directly assigned the values like below. In base class. [ShapeStyle is a dp of type CommonStyle]

//// Both properties are dp's but, assigned them like normal property. This caused the issue
ShapeBase.Background = this.Shape.ShapeStyle.Background;
ShapeBase.Foreground = this.Shape.ShapeStyle.Foreground; 

ShapeFace.Background = this.Shape.ShapeFaceStyle.Background;
...

When, I change the background property it won't update my ShapeBase.Background property. Since, it is not dependency bound.

I resolved it by, dp binding. Like below.

this.ShapeBase.SetBinding(BackgroundProperty, 
              new Binding() { 
              Source = this.Shape.ShapeStyle,
              Path = new PropertyPath("Background") });
画▽骨i 2024-09-26 02:53:09

您是否实现了属性的设置器,以便在属性值更改时控件会更新?

(顺便说一句,只是因为我很好奇,辛烷形状是什么?它与化学有关吗?)

Have you implemented the setter of your property so that the controls update when the property's value is changed?

(BTW, just because I'm curious, what's an octane shape? does it have something to do with chemistry?)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文