WinRT XamlToolkit Calendar Control

2019-09-06 03:54发布

问题:

im trying to implement a calendar control for my WinRT universal app.

So i looked to this for PC and this for Phone.

So i installed both packages set it in xaml and im getting exactly this error

In that post, the answer (that seems to be from the creator of the control) says that it has been fixed in 1.7.2.0, but it is not, im using 1.7.2.0 and getting the same error.

I have the tried to create the control at code like this:

    calendar = new WinRTXamlToolkit.Controls.Calendar();
    calendar.SetValue(Grid.RowProperty, 1);
    root.Children.Add(calendar);

Exactly same error.

Then i uninstall pc calendar to use only phone version like this:

        #if WINDOWS_PHONE_APP
        calendar = new WinRTXamlToolkit.Controls.Calendar();
        calendar.SetValue(Grid.RowProperty, 1);
        root.Children.Add(calendar);
        #endif  

Exactly same error.

So now im totally lost, this is the exception im getting:

A first chance exception of type 'System.IO.FileNotFoundException' occurred in WinRTXamlToolkit.Controls.Calendar.DLL

How can i solve that error and implement calendar in both PC and Phone versions or, at least, only the Phone version.

Thanks in advance.

回答1:

Sorry, you are right. It seems like there is a bug - the phone version of the calendar dll has an unnecessary reference to the core WinRTXamlToolkit library for the phone which is not configured as a dependency in the NuGet package. For now the solution is to also add the base toolkit dll package for your phone project: "WinRT XAML Toolkit for Windows Phone 8.1". I will remove the unnecessary reference in the next release (soon).