question

6666666 avatar image
0 Votes"
6666666 asked JarvanZhang-MSFT edited

About the custom control renderer?

If I create a custom control I have to create its rendererer in xamarin.android and xamarin.ios.

but In xamarin.forms not xamarin.android and xamarin.ios can there be three files that

view.iOS.cs,view.android.cs,view.cs be the three renderer ?

which means view.iOS.cs will be in ios.

I do not need to write the code in each project?

dotnet-xamarin
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

JarvanZhang-MSFT avatar image
0 Votes"
JarvanZhang-MSFT answered JarvanZhang-MSFT edited

Hello,​

Welcome to our Microsoft Q&A platform!

I do not need to write the code in each project?

Sorry, we cannot do that. Xamarin.Forms user interfaces are rendered using the native controls of the target platform. For some extended functions, we need achieve it on each platform using the native code. So it'll be necessary to create the .cs file in each project.

Best Regards,

Jarvan Zhang


If the response is helpful, please click "Accept Answer" and upvote it.

Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


· 7
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

But I find that there are many codes are in the same folder.

 view1.android.cs
 view1.iOS.cs
0 Votes 0 ·

I couldn't find the similar code in my test project. Could you please post more details about the 'code'?

0 Votes 0 ·

Then how to write a custom control and update it to the nuget? to use in xamarin.forms?

0 Votes 0 ·
Show more comments

Hi, @6666666
I have not heard from you for a couple of days. Please let me know if there is anything that I can help here.

0 Votes 0 ·