Return a value from Windows 10 UWP MenuFlyout control

Using the Windows 10 UWP MenuFlyout control, but don’t see how to return a value from the selected options? You could sub-class MenuFlyoutItem, but don’t overthink it: just use the .Tag property in MenuFlyoutItem, like this:   private void button_Click(object sender, RoutedEventArgs e) { // Open a MenuFlyout var myMenuFlyout = new MenuFlyout(); // Create the menu options…

0

ScratchPad: a Windows Ink sample for Windows 10 UWP

One of the especially interesting features available in the Windows 10 UWP platform is “Windows Ink” – the ability to use a pen or stylus to draw onto the screen and capture and process the digital ink strokes. This example is a simple C# note-taking app, demonstrating how to add ink support to your own…

4

Data-bind an InkCanvas control

This task snipped enables you use XAML data binding with ink stroke data in an InkCanvas control. The InkCanvas class does not expose a dependency property for its ink stroke data, so there is no built-in target for data binding. This snippet provides a InkStrokes attached property that you can use to bind to an…

0

Windows task snippets

Snippets of ready-to-use code that accomplish small but useful tasks of interest to Universal Windows Platform (UWP) app developers. These snippets represent simple solutions to common problems, and simple recipes to help you implement new app features. Every snippet includes the using statements that it requires, which you can add to the top of your…

1

Pop a simple, local toast notification

  Eliot Cowley, Content Developer Here is how to create a text-only local toast notification in a Windows 10 UWP app. using Windows.Data.Xml.Dom; using Windows.UI.Notifications; using Windows.UI.Xaml.Controls; private static void ShowToast(string title, string content) {  XmlDocument toastXml = new XmlDocument();  string xml = $@”   <toast activationType=’foreground’>   <visual>     <binding template=’ToastGeneric’>      <text>{title}</text>      <text>{content}</text>     </binding>    </visual>   </toast>”;  toastXml.LoadXml(xml);  ToastNotification…

1

Create animations using XAML

Ivor Berry, Content Developer Here’s a quick intro on creating simple animations in XAML, based off of the Hello World” app for C#/XAML, however this can be applied to any XAML app. This example animates the opacity of two different objects in our app, but this method of animation can be used on any number…

0