Sunday, April 15, 2018

On designing TextBoxes in a Universal Windows Platform projects

I will be describing two aspects of the design. The first one deals with providing adequate space between textboxes when you have more than one. The second deals with designing textboxes so that they have the same style regarding back gorund color: font size and font family.

Controlling space between controls

The easiest way is use the Margin in your control.

The syntax is Margin="left, top, right, bottom"

The next image shows code and design time layout where all textboxes have some space between them. The Button is still attached to the last textbox.

Continued here.

Styling textboxes for uniformity

All textboxes having the same properties such as font style, font size, bordering etc. is essential for making apps to have a good visual appeal.

There are various ways you can do it, but here is a simple example of doing it.

I will be using the example in my previous post as it will simplify writing for me.

I will be using the layout in the next image from my above post:


PlaceSpaceBetweenControls..._2

This is how you modify the XMAL markup for the MainPage.xaml

Continued here.


Friday, April 13, 2018

On Connecting to SQLite from a UWP app - Part 1

SQLite is the right relational daatabase with zero configuration for mobile apps. There is a recipe in Microsoft documentation on using a SQLite database in a UWP app. This should be quite straight forward given a recipe but there are problems. Probably because of a plethora of versions of just about everything.

This post is not about a successful follow up of the recipe to its successful end, but steps in the way of achieving, trying to document as much as possible, firstly to find where things did not happen as expected, secondly to make sure it works, at least for me.

The computer is Windows 10 Version 1803, build 17133.73
SQLite for Universal Windows Platform added via Extensions and Update

The Solution for the app, UWPDataTest:

Universal Windows project-UWPDataTest
DataAccessLibrary -DataAccesLibrary


UWPDataTestPost_0


Microsoft.NETCore.UniversalWindowsPlatform used in the DataAccessLibrary(version 6.0.8)


UWPDataTestPost_2

Installed Microsoft.NETCore.UniversalWindowsPlatform


UWPDataTestPost_2a

DataAccessLibrary referenced in UWPDataTest


UWPDataTestPost_3

Using DataAccessLibrary in MainPage.xaml.cs


UWPDataTestPost_4

Using DataAccessLibrary in app.xaml.cs


UWPDataTestPost_5


DataAccess class made static.


UWPDataTestPost_6

Cannot add using Microsoft.Data.SQLite to class library. Data is not an option. If you add it and try to build you get build errors.


UWPDataTestPost_7
Build errors: DataAccessLibrary.dll could not be found. The DataAccessLibrary build has errors.


UWPDataTestPost_8.png

Error persists after upgrading the SQLite version from within VS Studio 2017.


UWPDataTestPost_9.png

Microsoft Visual Studio 2017 Community edition used.


UWPDataTestPost_10.png

I am not sure where the sqliteSample.db is in the computer. It does not seem to be present anywhere, although search is not guaranteed to work always.


UWPDataTestPost_11.png

The problem at present seems to be related to the absence of SQLite on the computer. Perhaps there is an independent source for the database.
Another possible source of error could be the Insiders Preview build may not support the SQLite added.

In VS2015 I did not face any problem, https://hodentekmsss.blogspot.com/2017/03/querying-sqlite-database-using-rsqlite.html

Tuesday, April 10, 2018

Workaround to fix the C++ Windows Console application template loading error

In a previous post I described an error wherein the C++ Windows Console Application failed to load.

 Visual Studio Community 2017 also failed to open a previous C++ Windows Console Application project (created two days earlier). There was no problem with C# programs.

Well, the reason could be the Windows 10 OS Update on 4/4/2018.  I believe some of the other people also place the blame on the Update.

There were two suggestions from the Microsoft MSDN forum, one of which suggested upgrading to a recent version and the other to repair the present installation.

I decided to try yet another way, to modify by removing DESKTOP Development with C++ related items and then , add the Desktop items after verifying whether the Modification did anything at all to the VS Community 2017.

To my surprise, although I removed the desktop item in the installer screen, I could still create a C++ Windows Console application without getting the previously documented error.

Am I happy, yes I can proceed with what I want to do. But I am a bit disheartned that the removal did not remove the items from the New Project window after modification.

Here are the installer options:


The check box for DeskTop Development with C++ (about 512MB) was unchecked and the Modify button was clicked.

You need to close any running programs:



You may need to close running programs.


After modification, the VS 2017 Community  is launched.

I was expecting not to find Windows Console Application under C++ templates, but I was surprise to find that the template was still available.


Just to be sure, I invoked the installer one more time and tried the modify option. I found that the Desktop Development with C++ was unchecked.






DMCA.com Protection Status