Jonathan Perry
Jonathan Perry

Reputation: 3053

Embedding data inside a XAML file

I've been working on a WPF control for a few weeks now that contains a XAML-drawn map and has the ability to zoom in / out and pan the map. Also, it contains a converter that converts screen coordinates to lat / long coordinates which works pretty nice, however, the converter works based on few constant parameters that should be available when the application gets loaded.

Right now, those parameters are loaded with the non-XAML map file (.dwg file) which requires me to have a reference to an external library and the loading of the file takes up a few seconds when the application is loading for the first time, which is kinda annoying.

I wanted to store that information as constants in my C# code-behind for the XAML control, however is there a way to embed those constants in the XAML itself? Since the control should be as generic as possible and should support all maps that I will give it in the future (each having different parameters) I want the code to read the parameters from the XAML file and use it in the code.

If I wasn't clear in my question please let me know.

Upvotes: 1

Views: 353

Answers (1)

Mark Hall
Mark Hall

Reputation: 54532

You may want to look at this article. It is about Silverlight but it should be applicable. This Code Project article may be of some use also.

Upvotes: 1

Related Questions