locked
How to use a custom User Control in an app page

    Question

  • Hi,

    I'm building my first app, which is a game that uses a grid with a flat map of the Earth. The Grid is heavily divided into multiple columns and rows, each of which has a "Location" object, represented by a custom User Control, which seemed to be the best option as the control is a grid that holds (and shows) armies.

    I can likely create and define the "Location" object but the problem is that I don't know how to use them in the xaml page where the Earth Grid is defined. The Columns and rows have been set, but How do you insert the User Control "Location" into them?

    The Location User Control is in a file called "Location.xaml" and has its xaml.h and xaml.cpp files included and the file I want to use it in is called "GamePlay.xaml". Should I simply embed most of the "User Control" template in a resource dictionary? Will I need to declare it in "App.xaml"?

    Attached should be an image of the Grid from the page, snipped from the designer view so the columns and Rows are visible. In these squares is where I want to put the "Location" as one would do a button.

    Thanks

    Wednesday, July 30, 2014 8:56 PM

Answers

All replies