From the course: .NET MAUI: Beyond the Basics

Unlock the full course today

Join today to access over 24,400 courses taught by industry experts.

Constructors and factories

Constructors and factories - .NET MAUI Tutorial

From the course: .NET MAUI: Beyond the Basics

Constructors and factories

- [Instructor] Sometimes doing layouts and SAML, isn't quite as straightforward when it comes to edge cases. An example of this is when we have a custom layout or view with a constructor that requires parameters or A factory method, there are some limitations in SAML compared to doing this in C sharp code. It is relatively easy to pass known static value types to the constructor in SAML but dynamic data coming from a view model isn't quite so easy. We also should remember that any sort of data binding isn't available to us. Data binding only works with properties and a constructor isn't a property. Let's look at our starting project. Here we have two custom views, one in the main project and one in the library projects. The one in the main project has a constructor on it. So I'll go under views and name view, and open this up. And we can see that we've got a constructor for the name view class, and it's a single string,…

Contents