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

Comments

Projects
None yet
2 participants
@ipooov

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

This comment has been minimized.

Show comment
Hide comment
@nigel-sampson

nigel-sampson Feb 24, 2017

Contributor

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

Thanks for reporting that.

Contributor

nigel-sampson commented Feb 24, 2017

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

Thanks for reporting that.

@nigel-sampson nigel-sampson added the bug label Feb 24, 2017

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

@ipooov

This comment has been minimized.

Show comment
Hide comment
@ipooov

ipooov Feb 26, 2017

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

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