Commit 9289f6c
Refactor AutoSuggestionListBox_PreviewMouseDown method (#3791)
Refactored `AutoSuggestionListBox_PreviewMouseDown` in `AutoSuggestBox.cs` for improved readability and efficiency:
- Early return if `_autoSuggestBoxList` is `null` or `e.OriginalSource` is not a `FrameworkElement`.
- Defined `OnSelectionChanged` inline within its usage context.
- Streamlined logic by assigning and checking `selectedItem` immediately after initial checks.
- Set `e.Handled` to `true` earlier to mark the event as handled promptly.
- Simplified equality check using `Equals` method.
- Ensured `CommitValueSelection` is called appropriately for both newly selected and already selected items.
Co-authored-by: Haizinger Lukas (BCC.EXTERN) <[email protected]>1 parent bb264a0 commit 9289f6c
1 file changed
+19
-17
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
192 | 192 | | |
193 | 193 | | |
194 | 194 | | |
195 | | - | |
196 | | - | |
197 | | - | |
198 | | - | |
199 | | - | |
200 | | - | |
201 | | - | |
202 | | - | |
203 | | - | |
204 | | - | |
205 | | - | |
206 | | - | |
207 | | - | |
208 | | - | |
209 | | - | |
| 195 | + | |
| 196 | + | |
210 | 197 | | |
211 | | - | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
212 | 207 | | |
213 | 208 | | |
214 | 209 | | |
215 | 210 | | |
216 | | - | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
217 | 219 | | |
218 | 220 | | |
219 | 221 | | |
| |||
0 commit comments