c# - Screens using LongListSelector shared between WP7 and WP8 -


in project have library shared between wp7 , wp8 clients. library contains views, view models , other interesting data.

i want use latest version of windows phone toolkit.

the problem run while xaml code compatible, runtime error, because longlistselector exists in different assemblies in windows phone toolkit wp7 , in framework code wp8.

in wp7:

xmlns:toolkit="clr-namespace:microsoft.phone.controls;assembly=microsoft.phone.controls.toolkit" 

in wp8:

xmlns:controls="clr-namespace:microsoft.phone.controls;assembly=microsoft.phone" 

how can solve conundrum without needing duplicate xamls both platforms?

after solution decided implement:

  1. i decided library contains views wp7 wp8 not right place views in fact different in respective platforms. created 2 copies of problematic views , placed them in respective application projects wp7 , wp8.

  2. this created duplication in xaml - fortunately me xamls not complex - handful of controls, styled. created style dictionary each page , placed in alongside page in wp7 project.

  3. i linked dictionary file wp8 project. did same code behind file.

  4. in xaml files linked local dictionary file styles used on pages:

  5. with solution achieved minimal code duplication, styles still in 1 place, , differing code (xaml) placed belongs.

the final folder tree looks this:

solution |-- common library |    |-- views  |         |-- page1 +-- wp7     |-- views       |-- page1           |-- page1.xaml  (windows 7 specific markup)           |-- page1.xaml.cs (code behind file)           |-- page1.styles.xaml (common styles shared between wp7 , wp8 apps) +-- wp8 |-- views       |-- page1           |-- page1.xaml  (windows 8 specific markup)           |-- ->page1.xaml.cs (linked wp7 project)           |-- ->page1.styles.xaml (linked wp7 project) 

Comments

Popular posts from this blog

Unable to remove the www from url on https using .htaccess -