屏幕加载时的绑定错误 [英] Binding errors on screen load

查看:63
本文介绍了屏幕加载时的绑定错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好



我正在使用WPF工具包中的IntegerUpDown,我正在绑定最小,最大和值属性。



当视图加载时,IntegerUpDown控件中的某些值显示0(无法触摸的无效输入),即使最小值是通过绑定设置的1(我也不能碰这个)。



为什么会这样?

为什么不是最小的强制执行屏幕加载的最小检查?

当我向下滚动视图时可能会刷新,然后应用程序崩溃。



对此有任何想法问题很好





注意:数据是从服务器接收的,可以与父应用程序通信,在某些情况下这个值已验证。我希望如果我知道是什么原因造成的,我会知道如何解决这个问题。div class =h2_lin>解决方案

我运行了一个测试:
我为每个属性添加了一个转换器,发现在xaml中编写控件时属性
的顺序是它们绑定的顺序。
我的控件编写如下:

< toolkit:IntegerUpDown = binding Min = binding Max = binding / >

一旦我颠倒了属性的顺序如下:

< toolkit:IntegerUpDown 最小 = binding Max = binding = binding / >

屏幕按预期加载崩溃。

希望这会有所帮助。


Hi all

I''m using IntegerUpDown from the WPF toolkit and I''m binding the minimum, maximum, and value properties.

When the view loads, some of the values in the IntegerUpDown control display "0" (invalid input which I can''t touch) even though the minimum is set via the binding to "1" (I can''t touch this either).

Why does this happens?
Why doesn''t the minimum enforces the minimum check on screen load?
When I scroll down the view probably refreshes as then the app crashes.

Any idea on this issue will be great


Note: The data is received from a server which can communicate with a parent application where in some cases this value is valid. I hope if I''ll know what is causing this I''ll know how to solve this the "right" way.

解决方案

I ran a test:
I added a converter to each property and found that the order of the properties
when writing the control in xaml is the order how they are bound.
My control was written as follow:

    <toolkit:IntegerUpDown Value="binding" Min="binding" Max="binding"/>

Once I inverted the order of the properties as follow:

    <toolkit:IntegerUpDown Min="binding" Max="binding" Value="binding"/>

The screen crashes on load as expected.

Hope this helps.


这篇关于屏幕加载时的绑定错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆