开发者

Embedding data inside a XAML file

开发者 https://www.devze.com 2023-04-11 12:45 出处:网络
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 coordina

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 generi开发者_运维百科c 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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消