.Buttons General

Tapped vs Click Click – TOUCH OR KEYBOARD – Same as tapped plus can be triggered from keyboard input also if the button has focus. Tapped – NOT KEYBOARD – triggered for a finger press, mouse button click, or pen tap Any mouse button click raises a Tapped event.  A mouse left button click also raises a […]

Read More

.Images General

Add an image Stretch options: None – No scaling is done. Fill – Image will fill the space and aspect ratio is ignored. Uniform – Show the entire image with blank space in one axis if needed. UniformToFill – Ensure the whole space is filled and the aspect ration is preserved, cropping if necessary. Adding image […]

Read More

Update UI From Background Thread

Calling A Method On The UI Thread async void SomethingHappened() { await Windows.ApplicationModel.Core.CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { this.textBlock.Text = “Failure capturing video.”; }); } Set New Screen Page From Other Threads async void SetMainScreenPage(int Page) { await Windows.ApplicationModel.Core.CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { Windows.UI.Xaml.Controls.Frame rootFrame = Windows.UI.Xaml.Window.Current.Content as Windows.UI.Xaml.Controls.Frame; switch (Page) { case 1: rootFrame.Navigate(typeof(MainPage)); break; case 2: […]

Read More

Run a task on a background thread

You can’t create a background thread for a task, but you can schedule it via a static RunAsync method on the Windows.System.Threading.ThreadPool class. Create a high priority thread that runs forever

Read More

.Threads General

Thread Types Universal apps have the following types of threads: UI threads Typcailly an app has a single UI thread, because an app typically has a single window (if there are multiple windows then each will have its own thread). UI threads should be kept free to handle input and update the UI – long […]

Read More

Grid

  Proportional Sizing (star sizing) When a single row’s height or column’s width is set to *, it occupies all the remaining space. When multiple rows or columns use *, the remaining space is divided equally between them. Rows and columns can place a coefficient in front of the asterisk (like 2* or 5.5*) to […]

Read More

Get element final position and size

Sometimes you need to know exactly where an  element is. Get window relative position static Point GetPositionInWindow( FrameworkElement element) { GeneralTransform transform = element.TransformToVisual( null); return transform.TransformPoint( new Point() /* Represents 0,0 */); } Get the bounding rectangle static Rect GetBoundsInWindow( FrameworkElement element) { GeneralTransform transform = element.TransformToVisual( null); return transform.TransformBounds( new Rect( 0, 0, […]

Read More

.Add Elements To A Window

  Adjusting Properties Of An Element Select it in the window and look at the properties panel. Properties / Events Use the spanner / Lightning bolt buttons next to the name Accessing all of the properties If you have arrange by category selected you are only shown the basic properties.  To see all of the […]

Read More

.XAML General

XAML is just XML, but with a set of rules about its elements and attributes and their mapping to objects, their properties, and the values of those properties (among other things). You can think of XAML as a clean, modern reinvention of HTML and CSS.  In universal apps, XAML serves essentially the same purpose as […]

Read More

main() function

"App.xaml" contains the class code that initialises the project and is the logical equivalent of main(). Constructor Effectively the app’s main method. The plumbing that makes it the app’s entry point is enabled by an “Entry point” setting in the package manifest (on the Application tab). When you create a project, Visual Studio automatically sets […]

Read More