Why different version numbers displayed on different platforms? - visual-studio-2022

Using Visual Studio 2022 Community edition, my .Net MAUI project file contains the following entry:
<ApplicationDisplayVersion>1.2.18</ApplicationDisplayVersion>
An XAML page contains a Label for displaying the version, as follows
<Label
Text="{Binding App_version}"
FontSize="12"
HorizontalTextAlignment="Center"
HorizontalOptions="Center"
/>
The ViewModel contains the following code to get the version and set the label text:
App_version = AppInfo.VersionString;
When the project is run using the Windows Machine simulator, the version number displayed is NOT correct, i.e.:
1.2.12.1
When the project is run using the Android simulator, the version number displayed is correct, i.e.:
1.2.18
Is this a bug, or is there some difference on how the version number is displayed on different platforms -- if so, where is this documented?

Related

Conditional XAML causes XBF generator error

I am trying to set the Icon property of MenuFlyoutItem on the UWP. As this is only available in contract version 4, I wanted to use conditional XAML statements in form of the IsApiContractPresent statement. Doing this, I came up with this code:
<MenuFlyout>
<MenuFlyoutItem Text="Open">
<contract4Present:MenuFlyoutItem.Icon>
<FontIcon Glyph=""/>
</contract4Present:MenuFlyoutItem.Icon>
</MenuFlyoutItem>
</MenuFlyout>
and added this line in the definition of my page:
xmlns:contract4Present="http://schemas.microsoft.com/winfx/2006/xaml/presentation?IsApiContractPresent(Windows.Foundation.UniversalApiContract,5)"
Sadly, Visual Studio is now not able to compile the project anymore, with this error message:
The XAML Binary Format (XBF) generator reported syntax error '0x09C4' : Property Not Found
Strangely, the same errors comes up, when I use the minimal example given in the documentation
<TextBlock contract5NotPresent:Text="Hello, World"
contract5Present:Text="Hello, Fall Creators Update"/>
How can I solve this error? Or is this even a bug of Visual Studio?
Apparently, this functions is only available for Minimum Build versions > 15063. Otherwise, you must use version adaptive code, and not XAML.

Use icon fonts in Windows Universal apps

Since Windows 10 has .NET introduced the property FontIcon.Glyph. If you add code below to your xaml page if gives me next char Σ.
<FontIcon FontFamily="Candara" Glyph="Σ"/>
So I was thinking can you add an other icon font like Font Awesome or Icomoon info your project?
I've download a font, added into my solution and I use this code:
<FontIcon FontFamily="ms-appx:/Fonts/FontAwesome.otf#FontAwesome" Glyph="" Foreground="Black"/>
what results into this:

External Font Not Loading in Xaml

i tried to load a downloaded font in windows phone app.
i installed the font in pc.
i tried following
<TextBlock Width="237" Text="About" FontSize="36" Height="46" LineHeight="8"
FontFamily="{StaticResource nokia}"/>
<TextBlock Width="237" Text="About"
FontFamily="/font/nokia.ttf#Nokia Cellphone" FontSize="36" Height="46" LineHeight="8"/>
why external font is not loading
It doesn't matter if the font is installed on the PC or not.
For a font to work inside your app you'll need a few things.
You'll have to set the build action to 'Content' and output to directory set to: 'Copy if newer'.
And then the hardest part - Getting the preferred family right. I usually advocate using a tool for it, because the Windows Font viewer does not always show the right one.
'dp font viewer' is the one I usually use.
For a complete guide on implementing custom fonts, you could have a look here: http://www.blendrocks.com/code-blend/2015/01/04/a-complete-guide-to-working-with-custom-fonts-in-your-windows-and-windows-phone-app

Unknown type 'AppBarButton' in XML namespace - Windows 8 Store App XAML, issues adding app bars

I'm new to developing Windows 8 apps, and am having trouble getting my XAML file to recognise generated code for adding AppBars and CommandBars.
I am getting the error "Unknown type [something] in XML namespace" for a number of elements I am trying to add, here is my example below:
If I re-open my solution this is temporarily displayed as a warning rather than an error. Also navigating to http://schemas.microsoft.com/winfx/2006/xaml/presentation just produces "The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.".
This is all default code. my class namespace (e.g. MyApp.MainPage) matches the MainPage code behind namespace. I am at a loss and have been battling this for hours. I also intermittently changes from this error to 'InitializeComponent' does not exist in the current context". I have spent hours on XAML permissions errors in the past few days and don't want to waste any more time with errors in default generated code! :(
EDIT: I have tried this on three different machines, using both Windows 8 and Windows 8.1, both new projects and the existing project I have described in this post.
My guess is that you are using Visual Studio 2012 (Windows 8 apps). If so, you should use Button:
<Page.TopAppBar>
<AppBar>
<StackPanel Orientation="Horizontal">
<Button Style="{StaticResource AppBarButtonStyle}">A</Button>
<Button Style="{StaticResource AppBarButtonStyle}">B</Button>
</StackPanel>
</AppBar>
</Page.TopAppBar>
To use AppBarButton, you must use Visual Studio 2013 (Windows 8.1 apps):
<Page.TopAppBar>
<AppBar>
<StackPanel Orientation="Horizontal">
<AppBarButton>
<AppBarButton.Icon>
<FontIcon Glyph="A"/>
</AppBarButton.Icon>
</AppBarButton>
<AppBarButton>
<AppBarButton.Icon>
<FontIcon Glyph="B"/>
</AppBarButton.Icon>
</AppBarButton>
</StackPanel>
</AppBar>
</Page.TopAppBar>
Also, CommandBars are only available in Windows 8.1.

Can't access font resource in Silverlight class library

I have a reasonably large Silveright 3.0 project on the go, and I'm having issues accessing a couple of custom font resources from within one of the assemblies.
I've got a working test solution where I have added a custom font as a resource, and can access it fine from XAML using:
<TextBlock Text="Test" FontFamily="FontName.ttf#Font Name" />
The test solution consists of the TestProject.Application and the TestProject.Application.Web projects, with all the fun and games obviously in the TestProject.Application project
However, when I try this in my main solution, the fonts refuse to show in the correct type face (instead showing in the default font). There's no difference in the way the font has been added to project between the test solution and the main solution, and the XAML is identical.
However, there is a solution layout difference. In the main solution, as well as having a MainApp.Application and MainApp.Application.Web project, I also have a MainApp.Application.ViewModel project and a MainApp.Application.Views project, and the problem piece of XAML is the in the MainApp.Application.Views project (not the .Application project like the test solution).
I've tried putting the font into either the .Application or .Application.Views project, tried changing the Build Action to Content, Embedded Resource etc, all to no avail.
So, is there an issue accessing font resources from a child assembly that I don't know about, or has anyone successfully done this?
My long term need will be to have the valid custom fonts being stored as resources in a separate .Application.FontLibrary assembly that will be on-demand downloaded and cached, and the XAML controls in the .Application.Views project will need to reference this FontLibrary assembly to get the valid fonts. I've also tried xcreating this separate font library assembly, and I can't seem to get the fonts from the second assembly.
As some additional information, I've also tried the following font referencing approaches:
<TextBlock Text="Test" FontFamily="/FontName.ttf#Font Name" />
<TextBlock Text="Test" FontFamily="pack:application,,,/FontName.ttf#Font Name" />
<TextBlock Text="Test" FontFamily="pack:application,,,/MainApp.Application.Views;/FontName.ttf#Font Name" />
<TextBlock Text="Test" FontFamily="pack:application,,,/MainApp.Application.Views;component/FontName.ttf#Font Name" />
And a few similar variants with different assembly references/sub directories/random semi colons.
And so far nothing works... anyone struck this (and preferably solved it)?
This code works for me:
... FontFamily="/(DLL);Component/(DIR-optional)/(Font_file)#(Font_name)"/> ...