View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0002045 | NoesisGUI | C# SDK | public | 2021-06-10 19:00 | 2024-09-02 17:02 |
| Reporter | DavidYawCSpeed | Assigned To | sfernandez | ||
| Priority | normal | Severity | major | ||
| Status | feedback | Resolution | open | ||
| Product Version | 3.0.12 | ||||
| Target Version | 3.1 | ||||
| Summary | 0002045: IsDoubleTapEnabled should inherit parent to child | ||||
| Description | Whether a double-tap event is raised depends on the value of IsDoubleTapEnabled for the specific control that the tap is directly over. For a Button, this isn't necessarily the button object itself, but the Border that draw the colored background, the TextBlock that contains the text of the button, etc. IsDoubleTapEnabled is currently set on each individual component. In order to enable/disable double-tap for a button, IsDoubleTapEnabled currently needs to be set on all the child objects as well. If it were inherited instead, then setting it on the Button would be all that was necessary. | ||||
| Steps To Reproduce | In our application, we only use double-tap in two very small places. In the other 99% of the application, we want rapid tapping to be interpreted as many single taps. Therefore, we switch the default value of IsDoubleTapEnabled to false, and only set it to true in the two spots we actually use double-tap.
However, this doesn't work: IsDoubleTapEnabled needs to be set on whatever is directly under the mouse when the tap happens. For a plain text button, that means setting it on the Border and TextBlock inside the button. The opposite is also true: If I don't change the default value, and set IsDoubleTapEnabled=False on a Button, its DoubleTapped event still gets raised. IsDoubleTapEnabled needs to be set to false on all the controls inside the Button to make DoubleTapped not get raised, and interpret it as two Tap events instead. (If this change is made, then we can switch it from overriding the default value of the property, to just setting it on the top-level Window, and letting it be inherited. Way easier.) | ||||
| Platform | Any | ||||
|
Not needed for 3.1.2 - Bryan |
|
|
I've been thinking about this and came up with a solution that doesn't break compatibility with Blend. Instead of changing the default property to inherit, you can create an attached inherited property that will be in charge of updating the default property: public static class TouchHelper Then you can use it in the xaml as you suggested, disabling it for the whole window, and then enabling it only on the controls you need it: <Window x:Class="UIShell.MainWindow" |
|
|
This looks like it'll work well. I've added the changes into our application, with one minor change: I changed GetIsDoubleTapEnabled to return "bool?", rather than plain "bool". I am somewhat concerned about how this would interact with some control setting UIElement.IsDoubleTapEnabled directly: If some control has UIElement.IsDoubleTapEnabled set, and I have TouchHelper.IsDoubleTapEnabled set on MainWindow, then the value from MainWindow might overwrite the value set on the individual control. That said, I'm not sure what to do about it: Calling ReadLocalValue would tell me if it was still default, but don't think it's possible to tell the difference between a non-default because it was set explicitly in that control's XAML, or because TouchHelper set it previously. Perhaps set it up so that TouchHelper would set up a binding from UIElement.IsDoubleTapEnabled to TouchHelper.IsDoubleTapEnabled, but only if there's no local value or another binding set up? I know how to check if there's no local value, or if there's a previously-evaluated binding, but I'm not sure how to tell if there's a binding set up, but hasn't been evaluated yet. But that probably doesn't matter, since we're in control of every element that gets loaded in our application, |
|
|
The idea of this attached property is that you don't deal with the original one, you shouldn't mix the use of both properties. |
|
|
That should be fine. It's only a concern because we do consume a third-party component. I don't have the source to the most recent version of that component, but I do have source to an older version, and that version doesn't touch IsDoubleTapEnabled, so we should be good. |
|
|
Is it fine to mark this as resolved with the attached property solution? |
|
| Date Modified | Username | Field | Change |
|---|---|---|---|
| 2021-06-10 19:00 | DavidYawCSpeed | New Issue | |
| 2021-06-11 00:35 | sfernandez | Assigned To | => sfernandez |
| 2021-06-11 00:35 | sfernandez | Status | new => assigned |
| 2021-06-11 00:35 | sfernandez | Target Version | => 3.1 |
| 2021-06-11 05:01 | DavidYawCSpeed | Steps to Reproduce Updated | |
| 2021-12-03 15:17 | noesisChris | Note Added: 0007645 | |
| 2022-03-03 13:32 | sfernandez | Status | assigned => feedback |
| 2022-03-03 13:32 | sfernandez | Note Added: 0007829 | |
| 2022-03-10 02:27 | DavidYawCSpeed | Note Added: 0007850 | |
| 2022-03-10 02:27 | DavidYawCSpeed | Status | feedback => assigned |
| 2022-03-10 11:21 | sfernandez | Status | assigned => feedback |
| 2022-03-10 11:21 | sfernandez | Note Added: 0007851 | |
| 2022-03-10 15:44 | DavidYawCSpeed | Note Added: 0007855 | |
| 2022-03-10 15:44 | DavidYawCSpeed | Status | feedback => assigned |
| 2022-03-17 11:28 | sfernandez | Status | assigned => feedback |
| 2022-03-17 11:28 | sfernandez | Note Added: 0007867 |