C# is one of the top 5 languages that people use around the world and the app-building over the Xamarin platform is on rise. Xamarin is a prominent choice among developers and the reason behind it is β β Seamless Functionalityβ. Launched in 2011, Xamarin offers code re-usability and sharing codes with other platforms while giving access to native APIβs.
You could also find all the answers here π https://www.fullstack.cafe/Xamarin.
Answer:
Xamarin is a Cross Platform Mobile Development technology by Microsoft where we can develop the native app using the same code base across all platforms (iOS, Android, UWP) using the C# language. Xamarin uses two approaches for the app development:
- Xamarin.Forms and
- Xamarin Native.
Xamarin.Forms uses MVVM & XAML while Xamarin Native uses native UI technology and MVC or MVVMCross Architecture.
π Source: codeproject.com
Answer:
The ListView and TableView controls are so similar, you can think of them as a single control. The major difference between the two is the manner in which they lay out their items, and itβs easy to change the layout so each control emulates the other.
-
The ListView control displays its data stacked vertically, much like a standard listbox. Use this control to display an ordered list of data, especially long lists that require scrolling like a list of email messages, a list of contacts, or search results.
-
The TableView control displays its data stacked horizontally in rows (although you can alter this behavior and have it displayed in columns first, as well). You use this control when you need more space for rich visualization of each item to be displayed.
One of the big differences is ListView provides you a ItemsSource and a Itemtemplate and TableView does not. So items must be added as children manually.
π Source: greenstechnologys.com
Answer:
We can use WebView control to display static
HTML string
. WebView
can be used to display Websites, HTML string, Documents, Local Files depending on the platform support.
π Source: codeproject.com
Answer:
Xamarin.Forms's Application
class exposes the Application.Current.Properties
Dictionary
which is used to store the simple Key-Value pair data. The Properties
dictionary uses a string
key and stores an object value.
π Source: codeproject.com
Answer:
-
Margin
property represents the distance between the element and its adjacent elements and is used to control the element's rendering position, and the rendering position of its neighbors. Margin can be specified onLayout
andView
classes. -
Padding
property represents the distance between anElement
and the child elements of it and thus it is used to separate the control from its own content.Padding
values can be specified onLayout
classes.
Suppose, two adjacent elements have a margin of value 20 pixels assigned, what will be the distance between these two elements? Why?
The distance between two elements will be 40 pixels in this case, because, Margin
property values are Additive
. In addition to this, if Margin
and Padding
both are applied, then the distance between element and its content will be Margin + Padding
.
π Source: codeproject.com
Answer:
Frame
: It contains a single element as a child having a default padding of 20.Grid
: It is used when UI components are to be arranged into Rows & Columns.StackLayout
: It is used when UI components are to be arranged either horizontally or vertically.ScrollView
: It enables the scrolling for a child element if required. It has one child only.
There are other Layout Controls too like AbsoluteLayout
, RelativeLayout
, ContentView
, ContentPresenter
, etc.
π Source: codeproject.com
Answer:
On some button click event of First Page, we can call the following method, which will navigate to the second page:
await Navigation.PushAsync (new MySecondPageXaml (), true);
We have to use the "Navigation
" property which is available under ContentPage
class (XAML Page's code behind). So this navigation can be written in the Page's code behind file.
π Source: codeproject.com
Answer:
Lifecycle methods are set of methods which get executed when application enters into a specific state. Following are such methods:
OnStart
: Executes when application starts from the beginningOnSleep
: Executes each time when application goes into the backgroundOnResume
: Executes when application comes into the foreground from the Sleeping state
π Source: codeproject.com
Answer:
App.cs is the main class of the app which offers features like:
- MainPage: It helps to set the initial page for the app.
- Properties Dictionary: It helps us store simple values across lifecycle states.
- Static Current Property: It gives the instance of the current application object.
π Source: codeproject.com
Answer:
Xamarin.Forms can consists of four (this varies based on requirements) projects under one solution.
- .NET Standard, PCL or Shared Project
- iOS Project
- Android Project
- UWP Project
Here, .NET Standard, PCL or Shared Project contains all UI & Business logic inside it.
iOS, Android, UWP contains platform specific code containing Renderers or Dependency Services Implementations.
π Source: codeproject.com
Answer:
C# & F#
π Source: codeproject.com
Answer:
Xamarin.Forms is a Cross-Platform Toolkit which helps share Business Logic as well as UI using XAML across all supported platforms.
It uses MVVM pattern along with Binding into the XAML UI to accomplish this. It produces pure native controls for each individual platforms. Using Xamarin.Forms, we can share the whole business logic as well as UI among all supporting platforms like iOS, Android and UWP. It also provides a way for platform specific customization of any native controls using Renderers. Thus, we can almost share about 80-90% of code across platforms. We can say Xamarin is the King of Cross Platforms.
π Source: codeproject.com
Answer:
Xamarin.Forms is used when:
- Less platform-specific code is required
- Code sharing is more important than custom UI
- UI is not complex
Xamarin Native is used when:
- Lot of platform specific code is required
- Custom UI is more important then code sharing
- Many platform-specific APIs are used
π Source: codeproject.com
Answer:
Xamarin allows two different ways of creating applications, based on the amount of code reusability and customization:
-
The first approach is the Traditional Native Approach wherein platform-specific apps using Xamarin.iOSiOS and Xamarin.Android can be made. This way of creating apps is generally used when there is a lot of customization specific to the platform is required as it allows direct access to platform-specific APIs. Xamarin.iOS is used for iOS applications and Xamarin.Android is used to create Android applications.
-
The second approach is creating apps through Xamarin.Forms approach. Xamarin.Forms are used when there is a possibility of reuse of a lot of platform-independent code and the focus is less on custom UI. The platform-independent code is separated and kept in Shared Project or PCL or .NET Standard Library and Platform Specific projects consume this common code by including it.
π Source: knowledgehut.com
Answer:
Pages are Xamarin Forms generic representation of Cross Mobil Application Screens. A Page occupies most or all of a screen and contains a single child.
On IOS, the Page is mapped to ViewController, on Android, it is mapped to somewhat like Activity and on Universal Windows Platform, it is mapped to Β Page. Pages can be of several types, viz. Master /Detail Page, navigational Page, Carousel Page, Tabbed Page, Template Page, etc.
π Source: knowledgehut.com
See π Answer
See π Answer
See π Answer
See π Answer
See π Answer
See π Answer
See π Answer
See π Answer
See π Answer
See π Answer
See π Answer
See π Answer
See π Answer
See π Answer
See π Answer
See π Answer
See π Answer
See π Answer
See π Answer
See π Answer
See π Answer
See π Answer
See π Answer
See π Answer
See π Answer
See π Answer
See π Answer
See π Answer
See π Answer
See π Answer
See π Answer
See π Answer
See π Answer
See π Answer
See π Answer
See π Answer
See π Answer
See π Answer
See π Answer
See π Answer
See π Answer
See π Answer
See π Answer
See π Answer
See π Answer
See π Answer
See π Answer
See π Answer
See π Answer
See π Answer
See π Answer
See π Answer
See π Answer
See π Answer
See π Answer
See π Answer
Q72: What is the disadvantage of Xamarin to using for example Objective-C or Java for iOS and Android separately? βββββ
See π Answer
See π Answer
Q74: Can we really declare Parametrized ViewModel instance as BindingContext in XAML? βββββ
See π Answer
See π Answer
See π Answer
See π Answer
See π Answer
See π Answer
See π Answer
See π Answer
See π Answer
See π Answer