The mysery of when to add that extra property path junk

This is a note post since I know I will want to come back to this again;

From: http://stackoverflow.com/questions/4640573/round-brackets-in-xaml-syntax

The parentheses indicate that this property in a PropertyPath should be constructed using a partial qualification. It can use an XML namespace to find the type with an appropriate mapping. The ownerType searches types that a XAML processor has access to, through the XmlnsDefinitionAttribute declarations in each assembly. Most applications have the default XML namespace mapped to the http://schemas.microsoft.com/winfx/2006/xaml/presentation namespace, so a prefix is usually only necessary for custom types or types otherwise outside that namespace. propertyName must resolve to be the name of a property existing on the ownerType. This syntax is generally used for one of the following cases:

  • The path is specified in XAML that is in a style or template that does not have a specified Target Type. A qualified usage is generally not valid for cases other than this, because in non-style, non-template cases, the property exists on an instance, not a type.
  • The property is an attached property.
  • You are binding to a static property.

 

 

Posted in Uncategorized | Leave a comment

Trick to see if you have a soft Steering Wheel in use

I’m sure there are some people that love the soft Steering Wheel. But sometimes, very rarely, they cause a problem when you are trying to arrange your page. One little trick you could use is to utilize the fact that the Bottom App Bar will be pushed up the screen to make room for the Steering Wheel. If we can compare the top position of the App Bar then we can assume that the Steering Wheel is in play;

GeneralTransform bottomAppBarTransform = this.TransformToVisual(this.BottomCommandBar);

Point appBarPosition = bottomAppBarTransform.TransformPoint(new Point(0, 0));

var pageHeight = this.ActualHeight;
var appbarHeight = this.BottomCommandBar.ActualHeight;

if (pageHeight - Math.Abs(appBarPosition.Y) > appbarHeight)
{
      // Hello Steering Wheel
}

Hopefully someone out there will reply with a, “no just use this simple API”. That would be nice.

Posted in Uncategorized | 1 Comment

The data area passed to a system call is too small

Got caught out with this nice error today; The data area passed to a system call is too small

I was creating a file and writing some text to it. The problem was that although the file was writing to disk correctly I couldn’t write any contents to it. Turns out it was because the full path file length was 256. Given that as soon as you write to iso store the path has already consumed ~100 chars you have to be really tight with your allowed app-relative paths. Should also be filed under, ‘why OS, why only 256!’

 

Posted in Uncategorized | Leave a comment

Is the DLLImport you want to use supported by the Store?

I know I’m going to forget this within the next 10 mins, so I thought I’d write it down. If you are using DLLImport in your UWP project and you’re not sure if the Store will allow it, then you can check for yourself by looking at the Supported API XML files in the certification kit folder. For me that’s;

C:\Program Files (x86)\Windows Kits\10\App Certification Kit

The files depend on the target architecture but you probably only need to check one of them, e.g. SupportedAPIs-x86.xml

 

 

Posted in Uncategorized | Leave a comment

Problem hosting a LAN game in Unreal Tournament?

Just installed the classic UT from Steam and discovered that LAN gaming doesn’t work. When you try and host a game you get;
Your network configuration may not be compatible with
hosting matches. Please check your router’s manual for
instructions on setting up “Port forwarding” or a “DMZ
server”.

The easiest way around this is to get the Host to write down their IP address. Then they should start a LAN game as normal, ignore the dumb error message. Then the other players start UT open the console (F10) and type; open {Host IP Address}

NB if you the client gets an error complaining that they don’t have Steam Authentication then they should close UT, go to Task Manager and kill any Steam processes and try again.

I checked, it is almost 2016 and we’re having to do this :s

Posted in Games, Uncategorized | Leave a comment

Text sizing, symbols and icons

Consider the following XAML;

<TextBlock Text="W" />

; – displays the letter ‘W’ using the text semantics

<SymbolIcon Symbol="Accept" />

– displays the accept tick symbol

<FontIcon FontFamily="Candara" Glyph="& #x3A3;"/> 

– displays the sigma sign as an font icon

<FontIcon FontFamily="Segoe MDL2 Assets" Glyph="& #xE001;"/>

– displays the accept tick again, but as a font icon from the MDL2 assets font family

<TextBlock FontFamily="Segoe MDL2 Assets" Text="& #xE001;" />

– displays the accept tick again but as a text element.

The above all basically do the same. They differ by the semantics, e.g. a screen reader can make different choices based on a text block vs. font icon. However, a not so obvious difference is how they react to the user changing the text size. The following image shows the above rendered with text set to largest and then back to normal text.

image

As you might be able to see, the TextBlock happily resizes the characters, be it a ‘W’ or the tick. The other mechanisms keep the original size. This is important if you want to create buttons in your app. Should your buttons resize with the text or not? Your choice of how you render the symbol/icon will decide the behaviour. IMO it becomes a question of resize vs. element semantics. ‘You make’s your choice’.

Posted in Uncategorized | Tagged | Leave a comment

How to display icons in Appbar’s secondary menu

By default the secondary menu from an AppBar does not display a icon. However, it’s pretty trivial to change.

<Page.BottomAppBar>
   <CommandBar>
      <AppBarButton Label="A" Icon="Accept" >
         <CommandBar.SecondaryCommands>
           <AppBarButton Label="B" Icon="Accept" Style="{StaticResource AppBarButtonStyle1}" />
         </CommandBar.SecondaryCommands>
   </CommandBar>
</Page.BottomAppBar>

Then in the AppBarButtonStyle1 change the overflow, here is very quick hack to prove the point;

 <VisualState x:Name="Overflow"
  <Storyboard>
     <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="ContentRoot">
        <DiscreteObjectKeyFrame KeyTime="0" Value="Visible"/>
     </ObjectAnimationUsingKeyFrames>
     <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="OverflowTextLabel">
        <DiscreteObjectKeyFrame KeyTime="0" Value="Collapsed"/>
     </ObjectAnimationUsingKeyFrames>
  </Storyboard>
 </VisualState>

and that gives you

secondary

Obviously that is ugly but it is the base of how to provide the icons

Posted in UniversalApps, Windows 10 | Tagged | Leave a comment