Skip to content
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

The WPF Control [Frame]'s Convention doesn't work. #417

Closed
ipooov opened this issue Feb 24, 2017 · 2 comments
Closed

The WPF Control [Frame]'s Convention doesn't work. #417

ipooov opened this issue Feb 24, 2017 · 2 comments
Labels
Milestone

Comments

@ipooov
Copy link

ipooov commented Feb 24, 2017

Hi,
I am studying Caliburn.Micro and meet a question.
I write some code like below in WPF, but it can't work successful:
<Frame x:Name="ActiveItem" NavigationUIVisibility="Hidden" />

ActiveItem is in the view's ViewModel . It bind some Page. And I have already use AddElementConvention method add Frame's convention ,like ContentControl.

I tried to get a answer:
In the method SetContentPropertyCore (in View.cs line 398)

   var contentProperty = type.GetAttributes<ContentPropertyAttribute>(true)
                                          .FirstOrDefault() ?? DefaultContentProperty;

        type.GetProperty(contentProperty.Name)
                    .SetValue(targetLocation, view, null);

here contentProperty.Name is null but contentProperty is not null.

Maybe because Frame has its own ContentPropertyAttribute but has no name :

[ContentProperty]
[DefaultEvent("Navigated")]
[DefaultProperty("Source")]
[Localizability(LocalizationCategory.Ignore)]
[TemplatePart(Name = "PART_FrameCP", Type = typeof(ContentPresenter))]
public class Frame : ContentControl, INavigator, INavigatorImpl, IJournalNavigationScopeHost, INavigatorBase, IDownloader, IJournalState, IAddChild, IUriContext

Please help resolve it and publish in next version, thanks a lot .

@nigel-sampson
Copy link
Contributor

Yup, that looks to be the problem (ContentPropertyAttribute with no name).

Thanks for reporting that.

@nigel-sampson nigel-sampson added this to the v3.1.0 milestone Feb 24, 2017
@ipooov
Copy link
Author

ipooov commented Feb 26, 2017

Thanks.
I tried to add Frame's ContentPropertyAttribute Name, And it works well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants