🕓 7 MIN We are proud to …
Long-pressing is a powerful gesture that enables users to access secondary options, shortcuts, or context menus by simply pressing and holding on an element.
Here’s a quick and helpful way to add long press events in your Uno Platform applications offering a simple yet effective way to enhance user interactions. From creating contextual menus and quick access shortcuts to adding interactive elements, the potential applications of long press events are virtually limitless.
Let’s create a button in our XAML file as a demonstration. To start, we need to give it a name. For this example, we’ll name it “Longpress”. Then, we’ll create a Right Tapped handler and name it “Blog”. Finally, we’ll add our content so that we can see the button when we execute the code.
Now, we need to set up a void event handler that will allow the user to implement what actions they want to be performed when the user does a long press. For our example, we will make it so that the button’s background color changes to white.
private void Blog(object sender, RightTappedRoutedEventArgs e)
{
Longpress.Background = new SolidColorBrush(Colors.Black);
}
Adding the RightTapped event handler is easy and straightforward but key to leveraging the Long Press functionality in the Uno Platform. By employing this approach, we can now start adding long press interactions and enriching user experiences in our Uno applications.
For those new to the Uno Platform, it allows for creating pixel-perfect, single-source C# and XAML apps that run natively on Windows, iOS, Android, macOS, Linux and Web via WebAssembly. In addition, it offers Figma integration for design-development handoff and a set of extensions to bootstrap your projects. Uno Platform is free, open-source (Apache 2.0), and available on GitHub.
To upgrade to the latest release of Uno Platform, please update your packages to 4.9 via your Visual Studio NuGet package manager! If you are new to Uno Platform, following our official getting started guide is the best way to get started. (5 min to complete)
Tags:
🕓 7 MIN We are proud to …
🕓 10 MIN Each release, we don’t …
🕓 9 MIN Ever wondered how to …
Uno Platform
360 rue Saint-Jacques, suite G101,
Montréal, Québec, Canada
H2Y 1P5
USA/CANADA toll free: +1-877-237-0471
International: +1-514-312-6958
Necessary cookies are absolutely essential for the website to function properly. This category only includes cookies that ensures basic functionalities and security features of the website. These cookies do not store any personal information.
Any cookies that may not be particularly necessary for the website to function and is used specifically to collect user personal data via analytics, ads, other embedded contents are termed as non-necessary cookies. It is mandatory to procure user consent prior to running these cookies on your website.
Uno Platform 5.2 LIVE Webinar – Today at 3 PM EST – Watch