Browsed by
Category: Xamarin

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