View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0001402 | NoesisGUI | C# SDK | public | 2019-01-28 09:49 | 2020-04-21 16:55 |
| Reporter | ai_enabled | Assigned To | sfernandez | ||
| Priority | normal | Severity | minor | ||
| Status | resolved | Resolution | no change required | ||
| Product Version | 2.2.0b5 | ||||
| Target Version | 3.0.0 | Fixed in Version | 3.0.0 | ||
| Summary | 0001402: RangeBase.ValueChanged new value broken | ||||
| Description | Hi guys, I've noticed that for a Slider control RoutedPropertyChangedEventArgs<double>.NewValue always contains the same value which is incorrect. As a workaround, I'm using Slider.Value directly inside my ValueChanged event handler. Regards! | ||||
| Platform | Any | ||||
| has duplicate | 0001656 | closed | sfernandez | Incorrect args for Slider.ValueChanged event |
|
This is happening because your changes from float to double are only on the C# side. Native code still stores everything in float, and in that particular case, as you are asking for a RoutedPropertyChangedEventArgs<double> and the data stored in memory are 2 floats, the raw conversion is accessing unknown memory. You can hack your code in NoesisEvents.cs by forcing the use of float args in case T is double. It should work as RangeBase.ValueChanged is the only control using these float args: public T OldValue Anyway, I will try to find a way to make this more robust in the native side. |
|
|
Thank you for a quick reply, Sergio! I'm reporting this as a bug as it was working fine before. So something has been changed. Regarding the possible solution - I see it's possible to modify Extend.GetNativePropertyType so that it will return NativePropertyType.Float for double and decimal (and NativePropertyType.NullableFloat for the nullable counterparts). Then you can rewrite GetOld/New value to use something like that:
Seems to work fine here! |
|
|
With C# 7.1 you can use it like this for better performance:
|
|
|
Hi Sergio, |
|
|
No, it will have no side effects, it is safe to use it in your case. |
|
| Date Modified | Username | Field | Change |
|---|---|---|---|
| 2019-01-28 09:49 | ai_enabled | New Issue | |
| 2019-01-29 11:34 | sfernandez | Assigned To | => sfernandez |
| 2019-01-29 11:34 | sfernandez | Status | new => assigned |
| 2019-01-30 13:44 | sfernandez | Status | assigned => feedback |
| 2019-01-30 13:44 | sfernandez | Note Added: 0005425 | |
| 2019-01-30 14:18 | ai_enabled | Note Added: 0005427 | |
| 2019-01-30 14:18 | ai_enabled | Status | feedback => assigned |
| 2019-01-30 14:21 | ai_enabled | Note Added: 0005428 | |
| 2019-01-30 14:22 | ai_enabled | Note Edited: 0005428 | |
| 2019-01-30 14:23 | ai_enabled | Note Edited: 0005428 | |
| 2020-04-15 13:12 | sfernandez | Relationship added | has duplicate 0001656 |
| 2020-04-15 17:28 | ai_enabled | Note Added: 0006213 | |
| 2020-04-16 10:12 | sfernandez | Status | assigned => feedback |
| 2020-04-16 10:12 | sfernandez | Target Version | => 3.0.0 |
| 2020-04-16 10:12 | sfernandez | Note Added: 0006215 | |
| 2020-04-21 16:55 | sfernandez | Status | feedback => resolved |
| 2020-04-21 16:55 | sfernandez | Resolution | open => no change required |
| 2020-04-21 16:55 | sfernandez | Fixed in Version | => 3.0.0 |