问题标签 [valueconverter]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
320 浏览

wpf - 使用值转换器时如何更新视图模型的属性?

我有一个文本框,我使用一个值转换器来设置文本属性,因为这个值取决于数据网格的选择。所以我使用这段代码:

Normallt我用这种方式:

但在这种情况下,我需要一个转换器,但我也想更新 dataContext 中的一个属性。

这可能吗,或者如果我使用转换器,我无法更新 dataContext 中的属性?

谢谢。

编辑:

我试着变得更清楚一点。

我有一个具有文本框的视图。我想根据转换器设置这个文本框。此转换器使用视图模型中名为 myDataGridSelectedItems 的属性。但是我在视图模型中有其他属性,称为 myTextBox,当文本框使用从转换器接收的值更新其值时,我希望更新它。

所以我想将视图的 Text 属性绑定到视图模型中的两个属性。

0 投票
1 回答
1258 浏览

delphi - 不兼容的类型:“字节”和“字符串”

我在以下函数上收到编译器错误Incompatible types: 'Byte' and 'String' :

我想将磁盘大小转换为字符串。如何解决这个问题呢?

0 投票
1 回答
586 浏览

java - 货币转换器 - 需要帮助

我很难在我的货币转换器中找到问题的根源。

以下是错误:

线程“AWT-EventQueue-0”java.lang.NumberFormatException 中的异常:对于输入字符串:“”在 java.lang.NumberFormatException.forInputString(Unknown Source) at java.lang.Integer.parseInt(Unknown Source) at java.lang .Integer.parseInt(Unknown Source) at Adam_Markros_Valutaomvandlare.actionPerformed(Adam_Markros_Valutaomvandlare.java:116) at javax.swing.AbstractButton.fireActionPerformed(Unknown Source) at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source) at javax.swing。 DefaultButtonModel.fireActionPerformed(Unknown Source) at javax.swing.JToggleButton$ToggleButtonModel.setPressed(Unknown Source) at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source) at java.awt.Component.processMouseEvent(Unknown Source) at javax.swing.JComponent。processMouseEvent(Unknown Source) at java.awt.Component.processEvent(Unknown Source) at java.awt.Container.processEvent(Unknown Source) at java.awt.Component.dispatchEventImpl(Unknown Source) at java.awt.Container.dispatchEventImpl( Unknown Source) at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source) at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source) at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) ) 在 java.awt.Container.dispatchEventImpl(Unknown Source) 在 java.awt.Window.dispatchEventImpl(Unknown Source) 在 java.awt.Component.dispatchEvent(Unknown Source) 在 java.awt.EventQueue.dispatchEventImpl(Unknown Source) 在java.awt.EventQueue.access$000(未知来源)在 java.awt.EventQueue$1。在 java.security.AccessController.doPrivileged(Native Method) 在 java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source) 在 java.security.AccessControlContext$1 的 java.awt.EventQueue$1.run(Unknown Source) 运行(Unknown Source) .doIntersectionPrivilege(Unknown Source) at java.awt.EventQueue$2.run(Unknown Source) at java.awt.EventQueue$2.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.security.AccessControlContext $1.doIntersectionPrivilege(Unknown Source) at java.awt.EventQueue.dispatchEvent(Unknown Source) at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) at java.awt.EventDispatchThread。 java.awt 中的 pumpEventsForHierarchy(未知来源)。java.awt.EventDispatchThread.run(Unknown Source) 处 java.awt.EventDispatchThread.pumpEvents(Unknown Source) 处的 EventDispatchThread.pumpEvents(Unknown Source) 线程“AWT-EventQueue-0”java.lang.NumberFormatException:对于输入字符串: "" at java.lang.NumberFormatException.forInputString(Unknown Source) at java.lang.Integer.parseInt(Unknown Source) at java.lang.Integer.parseInt(Unknown Source) at Adam_Markros_Valutaomvandlare.actionPerformed(Adam_Markros_Valutaomvandlare.java:119)在 javax.swing.AbstractButton.fireActionPerformed(Unknown Source) 在 javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source) 在 javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source) 在 javax.swing.JToggleButton$ToggleButtonModel.setPressed(Unknown来源)在 javax.swing。plaf.basic.BasicButtonListener.mouseReleased(Unknown Source) at java.awt.Component.processMouseEvent(Unknown Source) at javax.swing.JComponent.processMouseEvent(Unknown Source) at java.awt.Component.processEvent(Unknown Source) at java. awt.Container.processEvent(Unknown Source) at java.awt.Component.dispatchEventImpl(Unknown Source) at java.awt.Container.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt。 LightweightDispatcher.retargetMouseEvent(Unknown Source) at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source) at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source) at java.awt.Container.dispatchEventImpl(Unknown Source) at java.awt.Window。在 java.awt.Component 的 dispatchEventImpl(Unknown Source)。dispatchEvent(Unknown Source) at java.awt.EventQueue.dispatchEventImpl(Unknown Source) at java.awt.EventQueue.access$000(Unknown Source) at java.awt.EventQueue$1.run(Unknown Source) at java.awt.EventQueue$1 .run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source) at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source) at java.awt.EventQueue $2.run(Unknown Source) at java.awt.EventQueue$2.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source) at java.awt。 java.awt.EventDispatchThread 中的 EventQueue.dispatchEvent(Unknown Source)。pumpOneEventForFilters(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.pumpEvents( Unknown Source) at java.awt.EventDispatchThread.run(Unknown Source) 线程“AWT-EventQueue-0”中的异常 java.lang.NumberFormatException:对于输入字符串:“” at java.lang.NumberFormatException.forInputString(Unknown Source) at java.lang.Integer.parseInt(Unknown Source) at java.lang.Integer.parseInt(Unknown Source) at Adam_Markros_Valutaomvandlare.actionPerformed(Adam_Markros_Valutaomvandlare.java:119) at javax.swing.AbstractButton.fireActionPerformed(Unknown Source) at javax.swing .AbstractButton$Handler。actionPerformed(Unknown Source) at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source) at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source) at javax.swing.DefaultButtonModel.setPressed(Unknown Source) at java.awt。 Component.processMouseEvent(Unknown Source) at javax.swing.JComponent.processMouseEvent(Unknown Source) at java.awt.Component.processEvent(Unknown Source) at java.awt.Container.processEvent(Unknown Source) at java.awt.Component。 dispatchEventImpl(Unknown Source) at java.awt.Container.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source) at java.awt.LightweightDispatcher.processMouseEvent(未知来源)在 java.awt.LightweightDispatcher。dispatchEvent(Unknown Source) at java.awt.Container.dispatchEventImpl(Unknown Source) at java.awt.Window.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt.EventQueue.dispatchEventImpl( Unknown Source) at java.awt.EventQueue$000(Unknown Source) at java.awt.EventQueue$1.run(Unknown Source) at java.awt.EventQueue$1.run(Unknown Source) at java.security.AccessController.doPrivileged (Native Method) at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source) at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source) at java.awt.EventQueue$2.run(Unknown Source) at java.awt.EventQueue$2 .run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.security.AccessControlContext$1。doIntersectionPrivilege(Unknown Source) at java.awt.EventQueue.dispatchEvent(Unknown Source) at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForHierarchy( Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.run(Unknown Source)java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.run(Unknown Source) 的 pumpEvents(Unknown Source)java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.run(Unknown Source) 的 pumpEvents(Unknown Source)

0 投票
2 回答
7797 浏览

c++ - 将 char 转换为 double


我正在为我的硬件编写数据采集代码。

但是,我需要找到我收集的数据的平均值。

这就是问题所在,获取的数据是unsigned char格式的,我需要将其转换为double格式。此外,收集的数据是指数形式的 [1.789232E-05]。

有没有可能的方法将 a 转换unsigned chardoublethen 再回来?

我有一个double j和一个unsigned char a[200]
无符号字符由 1.789232E-05 组成。如何将该数据转换为双倍?

谢谢!

0 投票
1 回答
1464 浏览

objective-c - 在分钟内转换浮点数或双精度数(aufiofile 的长度):秒毫秒

您好,我试图在 Objective C 中找到一个解决方案,以使音频文件的长度包括毫秒。目前我只有这个代码:

问题是这样的:我想获得更精确的时间位置,分钟:秒:毫秒

你们中的一些人有解决方案吗?

谢谢

0 投票
4 回答
4166 浏览

java - 从列表转换数组浮动[]

我有一个清单如下:

我想将此数组列表转换为数组浮点数。

我的代码:

但它在我的代码中显示错误,如上所述。你能帮助我吗?

0 投票
1 回答
5980 浏览

c# - C# 如何将 Environment.TickCount 转换为 HH:mm:ss:ms

我正在尝试将 int 值 Environment.TickCount 转换为格式 dd:HH:mm:ss:ms (days:hours:minutes:seconds:milliseconds)

有没有一种简单的方法可以做到这一点,或者我应该将 Environment.TickCount 除以 60,然后除以 3600,然后除以 216000,等等?

0 投票
1 回答
248 浏览

c# - 数字转换器(字符串格式的大整数)

我正在尝试用 C# 编写一个将大数字(字符串格式)转换为任何数字系统的类,我在How to convert a gi-normous integer (in string format) to hex format? (C#)

此代码也适用于任何数字系统(2^n 基数),只需对代码进行一些修改。

问题是我不理解算法的逻辑(for语句)。有人可以解释这部分代码:

例如,为了使此代码将十进制字符串转换为字符串 base64,我需要更改掩码以便它可以计算六位,而不是十六进制系统的四位,然后将数字右移 6将剩余的添加到下一个字节。

最后只需更改查找表即可打印结果

我不完全理解的是for循环中的这一行

这条线以及循环在每次迭代时对结果的每个字节做了什么?最重要的是,为什么?

0 投票
1 回答
5454 浏览

c++ - C ++小字符到十六进制函数?

我正在尝试找到一种非常轻量级的方法来对 char 或 md5 进行十六进制处理,下面有两个示例。

下面以使用两个 PHP 函数为例。

MD5:

十六进制:

这是最轻量级的方法。我在想一些大的字符数组到它的十六进制值而不是循环foreach char,但不确定。

0 投票
1 回答
441 浏览

.net - 使用 Mono.Cecil 调用 Convert.ToSingle(string parameter)

正如标题所说,我想用 Mono.Cecil 调用该方法,但我不知道该怎么做。