I've seen many posts similar to the issue I am facing but their solutions have failed to resolve mine. I could use some fresh eyes on this one. I currently cant access any of the properties related to time of my TimePicker object from Telerik. The error message I get when trying to access RadTimePicker.Time is "The type Nullable<> is defined in an assembly that is not referenced". And when I try to access RadTimePicker.MaximumTime is "The type TimeSpan is defined in an assemby that is not referenced. You must add a reference to assemby 'netstandard, Version=2.0.0.0, Cultural=neutral,..." However, I can make a new TimeSpan object anywhere else in the code.
I have added a reference to the .netstandard version just as the intellisence has suggested. I have updated the .netstandard to match both my projects. Currently 2.0.3. Also brought it down to 2.0.0 at one point as well. I have uninstalled xamarin.forms and all related xamarin forms nuget packages and reinstalled those. Did the same with Telerik controls.
One discrepancy I found is xamarin.controls is only installed in my ios project and when I try to install in on my shared project i get "NU1202: Package Xamarin.Controls 1.0.3 is not compatible with netstandard1.3 (.NETStandard,Version=v1.3). Package Xamarin.Controls 1.0.3 supports: portable-net45+win8+wp8 (.NETPortable,Version=v0.0,Profile=Profile78)" But I had to change the framework from PCL to .NetStandard to get Telerik installed in the project so that kind of confuses me as well.
Thanks, I'll post some code below but don't think it will be super helpful either way.
txtMobTime.Unfocused += (object sender, FocusEventArgs e) =>
{
if (string.IsNullOrEmpty(txtMobTime.Time))
{
_ticket.TicketMobilityTime = null;
NLTickets.Update(_ticket);
}
else
{
try
{
_ticket.TicketMobilityTime = txtMobTime.Time;
NLTickets.Update(_ticket);
}
catch (Exception ex)
{
DisplayAlert("Invalid Entry", "Please enter a valid time for this value.", "OK");
}
NLTickets.Update(_ticket);
}
};
Cross check the class library's project PackageReferences with the example csproj below (assuming you're using the latest version as of the date of my reply):
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<ProduceReferenceAssembly>true</ProduceReferenceAssembly>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DebugType>portable</DebugType>
<DebugSymbols>true</DebugSymbols>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Telerik.UI.for.Xamarin" Version="2020.2.624.1" />
<PackageReference Include="Xamarin.Forms" Version="4.7.0.968" />
...
</ItemGroup>
...
</Project>
Key takeaways:
I'm a little suspicious of obsolete Xamarin.Controls package. Though it should technically work if it only requires .NET standard 1.6, but it could have a dependency on an older version of Xamarin (v2.5.1 or earlier).