Creating A Custom Preview Window Size

For instance, if you are using say the Rapberry Pi 7″ screen you’ll want to preview it as a 800 x 480 pixel screen, but there isn’t one. To create a new custom size open the following folder in Windows Explorer C:\Program Files (x86)\Windows Kits\10\DesignTime\UAP\Devices\1033\ Copy one of the existing display .xml definition files.Name it, […]

Read More

App Background Colour

It can be important to set the apps background colour, for instance if you are using page transitions. In App.xmal.cs add this in the OnLaunched() function:

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

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

.Windows and Pages General

Every app consists of one or more windows with one or more pages. A new Blank App template project is given a single window with a single page called MainPage. It defines what the user sees once your app has loaded and the splash screen has gone away. MainPage, like any page that would be […]

Read More