Tizen .NET: compiled binding
smozhaykin opened this issue · comments
Does Tizen .NET supports compiled bingings?
By default all content pages created in visual studio contains [XamlCompilation(XamlCompilationOptions.Compile)]
attributes. But when I add x:DataType="{x:Type vm:ViewModelType}"
in page markup, I'm getting the following error during build:
1>View\MainMenuView.xaml : XamlC error : Value cannot be null.
1>View\MainMenuView.xaml : XamlC error : Parameter name: type
There are several similar issues reported before, but I think not for Tizen: xamarin/Xamarin.Forms#4678 (comment) xamarin/Xamarin.Forms#5416 (comment)
Some people reports the same on Xamarin forum: https://forums.xamarin.com/discussion/comment/400335/#Comment_400335
I've looked through the samples and haven't seen x:DataType
usage: https://github.com/Samsung/Tizen-CSharp-Samples
If compiled bindings are not supported, are there any plans to support it?
Thanks
I don't know means of compiled binding, anyways you can declare view model on XAML
Try like this, if does not works to you, please share your project files on here
<ContentPage.BindingContext>
<vm:ViewModelType/>
</ContentPage.BindingContext>
It is a things of core component, so tizen also support it
Data bindings are working independently from platform
and xaml compile is not related with platform.
Try like this, if does not works to you, please share your project files on here
<ContentPage.BindingContext> <vm:ViewModelType/> </ContentPage.BindingContext>
It's not about setting data context.
@myroot could you please take a look:
https://github.com/smozhaykin/TizenCompiledBindingSample
There are two branches:
master
- build completes successfullyissue
- build fails:
c:\GitHub\TizenCompiledBindingSample>dotnet build -r tizen-armel -c Release TizenCompiledBindingSample\TizenCompiledBindingSample\TizenCompiledBindingSample.csproj
Microsoft (R) Build Engine version 16.7.0+7fb82e5b2 for .NET
Copyright (C) Microsoft Corporation. All rights reserved.
Determining projects to restore...
Restored c:\GitHub\TizenCompiledBindingSample\TizenCompiledBindingSample\TizenCompiledBindingSample\TizenCompiledBindingSample.csproj (in 295 ms).
MainPage.xaml : XamlC error : Value cannot be null. (Parameter 'type') [c:\GitHub\TizenCompiledBindingSample\TizenCompiledBindingSample\TizenCompiledBindingSample\TizenCompiledBindingSample.csproj]
Build FAILED.
MainPage.xaml : XamlC error : Value cannot be null. (Parameter 'type') [c:\GitHub\TizenCompiledBindingSample\TizenCompiledBindingSample\TizenCompiledBindingSample\TizenCompiledBindingSample.csproj]
0 Warning(s)
1 Error(s)
Time Elapsed 00:00:02.06
Failure diagnostic log attached:
Please update like this
x:DataType="vm:ViewModelType"
instead x:DataType="{x:Type vm:ViewModelType}"
The same:
c:\GitHub\TizenCompiledBindingSample\TizenCompiledBindingSample>dotnet build -r tizen-armel -c Release TizenCompiledBindingSample\TizenCompiledBindingSample.csproj
Microsoft (R) Build Engine version 16.7.0+7fb82e5b2 for .NET
Copyright (C) Microsoft Corporation. All rights reserved.
Determining projects to restore...
All projects are up-to-date for restore.
MainPage.xaml : XamlC error : Value cannot be null. (Parameter 'type') [c:\GitHub\TizenCompiledBindingSample\TizenCompiledBindingSample\TizenCompiledBindingSample\TizenCompiledBindingSample.csproj]
Build FAILED.
MainPage.xaml : XamlC error : Value cannot be null. (Parameter 'type') [c:\GitHub\TizenCompiledBindingSample\TizenCompiledBindingSample\TizenCompiledBindingSample\TizenCompiledBindingSample.csproj]
0 Warning(s)
1 Error(s)
Time Elapsed 00:00:01.75
branch issue_2
@smozhaykin hi,
TargetFramework tizen40
has a trouble with this feature,
You can split a project into core(netstandard2.0) and tizen platfomr(tizen40) and it successfully compiled
@myroot thanks a lot for your investigation! splitted projects work fine.