开发者

Working with V.V.Big XAML file

开发者 https://www.devze.com 2023-02-16 05:35 出处:网络
Have you ever tried working with a XAML file which contains thousand tons of line of code. (More specifically Drawing Brushes for whole application in my case). This file is of 20+ MB size. Whenever i

Have you ever tried working with a XAML file which contains thousand tons of line of code. (More specifically Drawing Brushes for whole application in my case). This file is of 20+ MB size. Whenever i try to add/edit anythin开发者_高级运维g in this, Visual Studio 2008 crashes (7/10 times). Then if i'm able to do my changes and try to save change then VS crashes (most of the times). It is so difficult to work with such a big file in VS (same happens in Blend too but with few occurences)

I know having such a big file doesn't come under Good Coding standards. But what should we do if somehow we come in such scenario???

The only thing I finally found was KXAML : which proved quite good. Any other suggestions ??

UPDATED I dont want to change structure of that file or go for any other approach. I'm curious to know how to work / with such file. (other editors may be)

ADD seeing the answers - I would say i'm not stuck at this point i want to know if someone got stuck then is it better way to edit such thing ?? (separating this file would be the v.first thought to avoid this problem not solution)

ADD1 Alright !! My bad, i got too optimistic regarding this thought. Considering canvass, I would ask for the best practice to split this huge file.


I might suggest you take the pro-active approach and see if you can't segment it appropriately.

Define separate ResourceDictionary files to encapsulate reused resources and suchlike; similarly, do this for other sections of the file which can be stripped out and simply referenced.

This way you can have a file containing your Brushes, a file per Style and/or ControlTemplate, and so on and so forth.

EDIT:

As per your update stating quite definitively that you don't want to actually change the file, then I can only reply to the question of 'How to work with such a large file?' with these words:

With great difficulty, pangs of irritated senses and a lot of wasted time.


I 've had the same problem in VS2010 with some huge xaml files of some old colleagues that hadn't really heard about coding standards. I can assure you that VS2010 crushes a lot too. What I ended up doing was to split the xaml files into several files and then adding them as resources or as merged dictionaries.

P.S. did you mean Kaxaml?


Have you thought about splitting the file into separate resource dictionaries files and merging them into a single dictionary?


Why it is so large?? All styles for Infragistics controls (brushes, controls styles etc) are less than 10 Mb.
You should to consider to use styles inheritance as frequently as possible. Also you should split this file to few smaller files. It is torture to work with so large file. Try to have all files smaller than for example 1000 lines.

0

精彩评论

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

关注公众号