-
-
Notifications
You must be signed in to change notification settings - Fork 2.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
Eliminated the need to pass the owning BaseMetroTabControl to MetroTabItem #1624
Eliminated the need to pass the owning BaseMetroTabControl to MetroTabItem #1624
Conversation
@@ -114,14 +111,15 @@ void closeButton_Click(object sender, RoutedEventArgs e) | |||
CloseTabCommandParameter = null; | |||
} | |||
|
|||
if (OwningTabControl == null) // see #555 | |||
var owningTabControl = FindParent<BaseMetroTabControl>(this); |
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.
@thoemmi there is always a TryFindParent
function at TreeHelper
static class, maybe we can use this one...
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 noticed TreeHelper
but associated it with the TreeView
control like other XxxHelper classes.
I'll fix my code by calling TreeHelper.TryFindParent
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.
@thoemmi :-D i know, maybe TreeHelper
is better than other, it has helper funtions for visual and logical tree helper...
@thoemmi You can remove the old constructor, no problem |
Changed to use What do you think about the now obsolete c'tor? The migration guide says that all obsolete stuff has been removed. |
I've removed the obsolete c'tor |
…ontrol Eliminated the need to pass the owning BaseMetroTabControl to MetroTabItem
Thanks @thoemmi ! |
Currently
MetroTabItem
has a public propertyOwningTabControl
which is required when closing a tab (confer #555 and #631).I eliminated the need for this property by finding the
BaseMetroTabControl
at runtime. This makes it much easier to add tabs dynamically in a MVVM application, because you don't need to pass theBaseMetroTabControl
toMetroTabItem
's constructor.I kept the old, now superfluous constructor, but added a
ObsoleteAttribute
, because it is a breaking change. Feel free to remove that c'tor.