-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes #1150. #1153
Fixes #1150. #1153
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
||
_contentStoryboard.Completed += (s, a) => | ||
{ | ||
_commandContainer.Opacity = 0.0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where does this get set back to 1?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good question! In ContentGrid_ManipulationStarted the opacity is also set to 0 when the sliding starts. Then when the control has been moved the opacity is set to 1 in ContentGrid_ManipulationDelta. This PR just sets the opacity to 0 when the slide has been completed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
@@ -254,6 +254,11 @@ private void ContentGrid_ManipulationStarted(object sender, ManipulationStartedR | |||
|
|||
_contentStoryboard = new Storyboard(); | |||
_contentStoryboard.Children.Add(_contentAnimation); | |||
|
|||
_contentStoryboard.Completed += (s, a) => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to see the event unsubscribed when the control is unloaded. Can then be resubscribed when loaded if the storyboard is not null
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now this has been fixed.
@@ -522,6 +529,18 @@ private void ContentGrid_ManipulationDelta(object sender, ManipulationDeltaRoute | |||
SwipeStatus = newSwipeStatus; | |||
} | |||
|
|||
private void ContentStoryboard_Completed(object sender, object e) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The storyboard is created once, but it used every time the manipulation happens. However, the storyboard completed event is unsubscribed when it completes the first time. This means if I flick to the side twice, it will not set the opacity back to 0 the second time. Best to unsubscribe when the control is unloaded.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now that’s fixed. But what are the benefits of doing this? Shouldn’t other events also be unsubscribed when the control is unloaded?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@skendrot ping
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. It's always best practice but that's outside the scope of this PR 😄
@@ -522,6 +529,18 @@ private void ContentGrid_ManipulationDelta(object sender, ManipulationDeltaRoute | |||
SwipeStatus = newSwipeStatus; | |||
} | |||
|
|||
private void ContentStoryboard_Completed(object sender, object e) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. It's always best practice but that's outside the scope of this PR 😄
@@ -256,6 +268,12 @@ private void ContentGrid_ManipulationStarted(object sender, ManipulationStartedR | |||
_contentStoryboard.Children.Add(_contentAnimation); | |||
} | |||
|
|||
if (!_contentStoryboardCompletedIsSubscribed) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of keeping a variable if the event has been subscribed, subscribe to it when creating the storyboard and then in the loaded event check if the storyboard is not null and subscribe
private void OnLoaded(object sender, RoutedEventArgs e)
{
if (_contentStoryboard != null)
{
_contentStoryboard.Completed += ContentStoryboard_Completed;
}
}
private void OnUnloaded(object sender, RoutedEventArgs e)
{
if (_contentStoryboard != null)
{
_contentStoryboard.Completed -= ContentStoryboard_Completed;
}
}
No description provided.