I would like to create a PhoneApplicationPage dynamically and navigate to that page. Is this possible?
Edit: I am developing a number of applications which will share a couple of pages. I want to avoid code duplication and create them in code once and share them across these applications.
I certainly do not want to bypass the built in page navigation by using custom content or any other means. I was hoping that I could programatically create the pages, register or inject them into the navigation system and use them the same way as if they were created at design time.
The navigation system supports loading pages created in libraries (in fact, it's often used to improve startup speeds by moving large, uncommonly used pages out of the main assembly).
Assuming you have created a Windows Phone Library project named CommonPages that incldes a page Common.xaml, you can navigate to it using the URI /CommonPages;component/Common.xaml
Remember to add a reference to your library from your main project.
Related
I'm using a VB6 application as a reference and have come across imgMain. I'm assuming its an image control, however, I cannot find the object on any of the forms. It's used to load the image. I'm just not sure what's going on with this. I'm assuming its an IMAGE CONTROL, but I cannot find this on any of the forms? it's mentioned a lot of times in teh application as it lets you view incoming faxes and stuff.
Without having a look on source code i assume It might be custom user control that was created for some reasons probably to extend basic picturebox control.
One thing i can advise you is to further inspect code and dig to code of this custom control. If code for this control is not available then see what methods and properties instances of that particular control uses and compare them with regular picturebox.
I'm building an application for Windows Phone, and I was wondering if it is possible (and how) to create a list one page of your app and use it and its content on other pages of this app.
You can develop a User Control and use it in multiple pages.
http://msdn.microsoft.com/en-us/library/windowsphone/develop/jj714088%28v=vs.105%29.aspx#BKMK_SharingXAMLUIusingaUserControl
You can use MVVM concept for this, keep your data common as Model and use it where ever you want.
If you want the UI too in common as said before use UserControl for listbox and use it wherever you want.
Thank you.
I have a WP7 application which I need to rebrand. I'm using Visual Studio 2012.
My problem is how manage brands in the most automatic way.
Lets say I developed the app for the Main Brand, and I need to restyle for the Secondary Brand.
Secondary Brand consist in change of Images and part some base styles (the base style are used and thus referenced by other style and templates which are shared).
I would prefer to have the XAP with only Images for its own Brand.
I need also to have the possibility to use the designer with one brand or another.
I tried to use a TFS Branch for this purpose, it is satisfing but at every merge (new features or bug fix in the Main Branch that must be merged in the Secondary Branch), I need to pay attention to not overwrite Images and Styles (if changed), it is an error prone process and lead to undetected and critical mistake.
I thinking about bring everything back on the main branch and manage Brands by moving all Images and Style that differs, into different 'theme' class libraries but how can I easily switch between references (I need the designer, so at design time) ? Is there a way to have different references for different solution configuration ?
Another option could be to use the Branch and the 2 theme class library, in the secondary branch the app will reference the secondary theme class library. On the paper it seems the best options, both branch will link statically the resources, they will have their designer branded, merge should not impact anything modified in the 'theme' libraries. Before try it i would like to know if anyone has a better option or foresee any problem on this.
Thank You.
I had similar project, and I can share the way I was trying to solve it.
I had following project structure
AppName.Common - here all common code, views and data templates defined
AppName.Main - here is App.xaml for main project, Resources with specific styles and images
AppName.Branded - here is App.xaml for branded project, Resources with specific styles and images. Also in App.xaml I configure IoC container, because some of behaviors were different for Branded and for Main proj.
All styles are defined in App.xaml in Resourced dictionary. So, in runtime app can resolve them. Sometimes you need to reopen solution, and also ReSharper can't support in, it fails to resolve you styles.
Blend for VS can support this structure. You just select current project as a Start-up proj.
Hope it will help you.
Don't forget, that if you navigate to View from other assembly, you need to change path.
I have a MVC 3 web application for which I would like to implement a theme/templating framework (similar to Wordpress or Joomla where you can enable or disable different themes for a site) and would like to find out what is the best way to accomplish this.
My design constraints are this. I buy HTML templates from places like Themeforest or Template Monster and want to make a number of these templates available for use in my web app. The templates you typically buy online all have very different CSS layout frameworks, so it's not possible to just drop a new CSS in your /Content/Themes/ folder and then your views work with this because you also have to make changes to the HTML in the Views. So for every new theme in /Content/Themes I also need a new set of /Views/ folders where the HTML is updated to use the proper CSS classes for that theme.
I know in an ideal world I should just have all the CSS compatible with my html views (ie theme switching is purely based on loading a new CSS), but in this case that is just not possible.
So I'm wondering if there is way to tell MVC where the current default Views folder is? A possible project structure I'm thinking of is something like this:
/Themes/Theme1/Views/(all cshtml view pages for this theme goes here)
/Themes/Theme2/Views/(etc)
I know that I can force the views like this
return View("~/Themes/Theme1/Views/Controller/Index.cshtml")
which can be extended to dynamically determine the theme folder with something like this
return View(currentThemeFolder + "/Views/Controller/Index.cshtml")
but I am wondering if there is a better way to do this? Is there someway perhaps in the global.asax to set the default "Views" folder so that the above is not necessary? There must be an entry point to the views because how do you then specify which _viewstart.cshtml file is called? And if I do go for the above design of forcing/"semi-hard-coding" the views what are the down sides to it?
I also want to say that I have not looked much at Areas in MVC 3 and I don't think that would work here, because my understanding is that it would affect your routing, and would also duplicate your model and controllers folders which I don't want. I have on central Model and Controllers folders, but just need multiple Views folders.
You can extend VirtualPathProviderViewEngine to create your own themeable view engine. Here is how: http://www.singingeels.com/Articles/Creating_a_Custom_View_Engine_in_ASPNET_MVC.aspx
Ok,
I have decided to take a look at calibun micro as people are raving about it. Note that this question is in the context of Windows Phone 7.
I have downloaded the package from nuget, cleared out the app.cs and added the bootstrapper to app.xaml. I have also created 3 folders Model, View, ViewModel.
What I would like to do first is just create a simple window with 3 textblocks but can't seem to find out how. I have read the soup to nuts and I just can't get it. I also note that Caliburn.Micro is a vm first approach but in WP7 you have to navigate to a page first.
Could anyone explain how to set up my first View and ViewModel, I think once I have that I can start from there.
Thanks a mill!
In your ViewModels folder, create a class called MyFirstViewModel. In your views folder, create a PhoneApplicationPage called MyFirstView. That's all you need. However, the phone is hardcoded to show a certain page first, so you need to update your WMAppManifest.xml if you want it to work the way you described. In that case, you need to change the DefaultTask so that it's NavigationPage property points to MyFirstView. Have a look at the HelloWP7 sample for a general demonstration of the framework's phone features.