Friday, April 20, 2018

UWP: How do you fix the missing Assembly References error?

This error showed up as soon as I tried to create a Blank UWP app in Microsoft Visual Studio 2017 Community. Of course you cannot create an application with missing references.


Problem.png

You first go and see what references are missing. This was my solution explorer when this happened.


Problem2

Well, it says references are missing but does not point to which one. However, the suggestion is to build the NuGet cache.

I opened up an app which had worked in another instance of VS 2017. I could see that the reference, Microsoft.NETCore.UniversalWindowsPlatform was missing.

In order to build the NuGet Cache right-click the Solution Explorer and invoke the Restore NuGet Packages menu-item as shown.


Problem3

Click on Restore NuGet Packages to open the NuGet window as shown.

Problem5

Click or search for Microsoft.NETCore.UniversalWindowsPlatform. Highlight the project from which the file is missing (in the right pane). Click Install.

You may get messages such as these, deal with them.

Problem 6


Problem 7

You should get a message that it has been restored as shown.


Problem4

Now you can verify that the reference has come back to the project.


Problem8



Thursday, April 19, 2018

How do you install SQLite ODBC?

Good question.

Probably the SQLite ODBC driver will make way for more extensive use of this zeo-configuration database. Now ODBC drivers are available to developers as posted earlier.

Please go to this site  to download your ODBC driver.

The current version are as described in my previous post. Download the one appropriate for you use:

LiteODBC_00

I downloaded the one shonw here,


LiteODBC_0

You double click the executable show above to begin the installation.

Follow the wizard. Here are some screens shown for your guidance.

LiteODBC_1



LiteODBC_2

I chose the default folder.


LiteODBC_3


LiteODBC_4
As you may know Windows OS has two ODBC Data Source (x32) and (x64). You can verify that you find the driver in the (x64) version as shown here:


LiteODBC_5

Now you start using SQLite.

Tuesday, April 17, 2018

Are there ODBC drivers available for SQLite?

ODBC drivers are indeed available for SQLite databases. You can download the version you want from this link here. The driver has been tested with the following SQLite versions:

SQLite 2.8.17 
SQLite 3.22.0
Windows NT/2000 in MS Excel 97 (MSQUERY)

The author (Chris Wolf) of the driver has wrapped the SQLite C library into a ODBC driver.

These current versions may be of interes to you:

Current version
sqliteodbc.exe [http://www.ch-werner.de/sqliteodbc/sqliteodbc.exe]
sqliteodbc_w64.exe [http://www.ch-werner.de/sqliteodbc/sqliteodbc_w64.exe]
sqliteodbc-0.9996.tar.gz [http://www.ch-werner.de/sqliteodbc/sqliteodbc-0.9996.tar.gz]
sqliteodbc-0.9996-1.src.rpm [http://www.ch-werner.de/sqliteodbc/sqliteodbc-0.9996-1.src.rpm]

How do you use Package Manager to install packages?

If you need to download, install, upgrade, configure and remove computer programs for a operating system in a consistent manner then Package Manager is the right tool you need. It has all the tools you need. Package Manager uses Windows Power Shell commandlets.

If you have Visual Studio 2017 Community or any of the newer versions, it can be invoked from the View Menu after launching Visual Studio as shown.


PM_0
When you click on Package Manager Console, the Console opens inside visual studio pane as shown.


You should use 'help' to find what all you can do with it. Here is help just for the install task.

That's all.

Monday, April 16, 2018

UWP: How do you access Page resources by code in an UWP app?-Part 2

In the previous example you have seen how to access page resource via code. As mentioned earlier, resource can also be stored in other FrameworkElements such as the 'Border' in this present example. The x:key for the 'Border' is the same as that of the Page's resource.

How do we call the resource stored in the Framework Element BORDER?

Here is the MainPage.Xaml for this post.


PageResrcs_3

It also shows the textbox, the target for the code (happens to be left out in the MSDN article here).
Both the Framework Elements Page and Border has the same x:Key.

The code to access the Page resource is as shown here (same as previous post).


PageResrcs_3

If you want to access the resource in the BORDER, you uncomment and comment code as suggested.
The app displays as shown when run.


PageResrcs_5



UWP: How do you access Page resources by code in an UWP app?

You can keep your resources, such as style, data etc. in different places on a page and then use them in your app either by declarative markup or using code.

This post shows how you may access resources in your "Page.Resources" using code.


PageResrcs_0

It has a resource which is a string and a key. The page has single TextBox named "txt1".
In the code behind you use the key to access the resource and send it to the text box.


PageResrcs_1

When you run the app this is what you see, the resource on the page appearing in the TextBox.



Saturday, April 14, 2018

UWP: How do you make all textboxes to have same properties in XAML?

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

You include the style elements you want as a Gird attribute  inside your page. If the control you use is a textbox (there are four in the above layout) then all of them will get the same style.

 In the rendered app, you will get what you designed.