Browsed by
Category: Xamarin

Xamarin Forms: Lazy load tabs in TabbedPage

Xamarin Forms: Lazy load tabs in TabbedPage

Source: https://enginecore.blogspot.com/2019/01/xamarin-forms-lazy-load-tabs-in_10.html In Xamarin Forms, we sometimes need the TabbedPage to display a tab layout. You can checkout the great official documentation hereabout how to create and use a TabbedPage. Problem: Every tab is a Page instance The TabbedPage is a multi page container where every tab is a Page object. No matter how you create the tabs (either by setting the TabbedPage.Children page collection with Page instances or by setting TabbedPage.ItemsSource and TabbedPage.ItemTemplate) the TabbedPage needs a Page instance for every tab and uses the Page.Title property to display the text header on the tab…

Read More Read More

How can I run a method in the background on my Xamarin app?

How can I run a method in the background on my Xamarin app?

Source: https://stackoverflow.com/questions/45209784/how-can-i-run-a-method-in-the-background-on-my-xamarin-app/45210187 What we did in our forms application was to make use of the Device.Timer and the Stopwatch class that available in System.Diagnostics, and Xamarin.Forms to create a very generic managed timer that we could interact with using the onStart, onSleep and onResume methods in Xamarin.Forms. This particular solution doesn’t require any special platform specific logic, and the device timer and stopwatch are non UI blocking. using Xamarin.Forms; using System; using System.Linq; using System.Diagnostics; namespace YourNamespace { public partial class…

Read More Read More

Button on Android all caps

Button on Android all caps

Solved by adding the following to your styles.xml file which can be found in the Android project under the Resources then values folders. <item name=”android:textAllCaps”>false</item>

Xamarin.Forms’s LayoutOptions

Xamarin.Forms’s LayoutOptions

Short answer Start, Center, End and Fill define the view’s alignment within its space. Expand defines whether it occupies more space if available. Theory The structure LayoutOptions controls two distinct behaviors: Alignment: How is the view aligned within the parent view?Start: For vertical alignment the view is moved to the top. For horizontal alignment this is usually the left-hand side. (But note, that on devices with right-to-left language setting this is the other way around, i.e. right aligned.)Center: The view is centered.End: Usually the view is bottom or right aligned. (On right-to-left…

Read More Read More

Xamarin – When/Why use command

Xamarin – When/Why use command

Here’s a couple short features, but you really want to do more reading on the topic of commands because there is a bunch more to know that can be covered in a thread post. This is just my ‘major benefits’ explanation. Commands are less coupled than events. Think of them as the next evolution of the Event. For example, on an event you have to subscribe directly to that instance. MyClassInstance.SomeEvent += eventHandlerMethod(); Which most times means you have to…

Read More Read More