@@ -22,7 +22,7 @@ namespace winrt {
22
22
23
23
namespace winrt ::SliderWindows::implementation {
24
24
25
- SliderView::SliderView (winrt::IReactContext const & reactContext) : m_reactContext(reactContext) {
25
+ SliderView::SliderView (winrt::IReactContext const & reactContext) : m_reactContext(reactContext), isSliding( false ) {
26
26
RegisterEvents ();
27
27
}
28
28
@@ -55,10 +55,6 @@ namespace winrt::SliderWindows::implementation {
55
55
void SliderView::UpdateProperties (winrt::IJSValueReader const & reader) {
56
56
m_updating = true ;
57
57
58
- bool updatedValue = false ;
59
- bool updatedMaxValue = false ;
60
- bool updatedMinValue = false ;
61
-
62
58
auto const & propertyMap = JSValueObject::ReadFrom (reader);
63
59
64
60
for (auto const & pair : propertyMap) {
@@ -69,27 +65,27 @@ namespace winrt::SliderWindows::implementation {
69
65
if (propertyValue.IsNull ()) {
70
66
this ->ClearValue (xaml::Controls::Primitives::RangeBase::ValueProperty ());
71
67
}
72
- else {
73
- updatedValue = true ;
68
+ else if (!isSliding) {
74
69
m_value = propertyValue.AsDouble ();
70
+ this ->Value ( m_value );
75
71
}
76
72
}
77
73
else if (propertyName == " maximumValue" ) {
78
74
if (propertyValue.IsNull ()) {
79
75
this ->ClearValue (xaml::Controls::Primitives::RangeBase::MaximumProperty ());
80
76
}
81
77
else {
82
- updatedMaxValue = true ;
83
78
m_maxValue = propertyValue.AsDouble ();
79
+ this ->Maximum ( m_maxValue );
84
80
}
85
81
}
86
82
else if (propertyName == " minimumValue" ) {
87
83
if (propertyValue.IsNull ()) {
88
84
this ->ClearValue (xaml::Controls::Primitives::RangeBase::MinimumProperty ());
89
85
}
90
86
else {
91
- updatedMinValue = true ;
92
87
m_minValue = propertyValue.AsDouble ();
88
+ this ->Minimum ( m_minValue );
93
89
}
94
90
}
95
91
else if (propertyName == " step" ) {
@@ -169,17 +165,6 @@ namespace winrt::SliderWindows::implementation {
169
165
}
170
166
}
171
167
172
- // This is to mitigate platform bugs related to the order of setting min/max values in certain XAML controls.
173
- if (updatedMaxValue) {
174
- this ->Maximum (m_maxValue);
175
- }
176
- if (updatedMinValue) {
177
- this ->Minimum (m_minValue);
178
- }
179
- if (updatedValue) {
180
- this ->Value (m_value);
181
- }
182
-
183
168
m_updating = false ;
184
169
}
185
170
@@ -200,13 +185,16 @@ namespace winrt::SliderWindows::implementation {
200
185
eventDataWriter.WriteObjectEnd ();
201
186
} );
202
187
onValueChangeSent = true ;
188
+ onSlidingCompleteSent = false ;
189
+ onSlidingStartSent = false ;
203
190
}
204
191
}
205
192
206
193
void SliderView::OnManipulationStartingHandler ( winrt::IInspectable const & sender,
207
194
xaml::Input::ManipulationStartingRoutedEventArgs const & args )
208
195
{
209
- if ( !m_updating )
196
+ isSliding = true ;
197
+ if ( !m_updating && !onSlidingStartSent )
210
198
{
211
199
auto self = sender.try_as <xaml::Controls::Slider>();
212
200
@@ -236,17 +224,16 @@ namespace winrt::SliderWindows::implementation {
236
224
eventDataWriter.WriteObjectEnd ();
237
225
} );
238
226
onSlidingCompleteSent = true ;
227
+ isSliding = false ;
239
228
}
240
229
onValueChangeSent = false ;
241
- onSlidingStartSent = true ;
242
- onSlidingCompleteSent = false ;
243
230
}
244
231
}
245
232
246
233
void SliderView::OnManipulationCompletedHandler ( winrt::IInspectable const & sender,
247
234
xaml::Input::ManipulationCompletedRoutedEventArgs const & args )
248
235
{
249
- if ( !m_updating && onSlidingCompleteSent == false )
236
+ if ( !m_updating )
250
237
{
251
238
auto self = sender.try_as <xaml::Controls::Slider>();
252
239
@@ -263,7 +250,9 @@ namespace winrt::SliderWindows::implementation {
263
250
} );
264
251
onSlidingCompleteSent = true ;
265
252
onValueChangeSent = false ;
253
+ onSlidingStartSent = false ;
266
254
}
255
+ isSliding = false ;
267
256
}
268
257
269
258
const double SliderView::CalculateStepFrequencyPercentageValue (const double & stepPropertyValue) const noexcept {
0 commit comments