I'm playing around with windows phone and looking at writing my first window phone 7 application.
I've coded in windows 6.5 and code in c# for my daily job.
So far it's all going well. Fairly simple and for most points where i have got stuck there has been a tutorial for it.
My problem is I've implemented the Application Bar, and am using this on a number of views.
In order to keep my code DRY i'm reluctant to create the events on each page. This seams a waste of developer time.
Is there a way around this?
Should i create a base class and inherit from it?
Are the Xaml templates?
Should i just suck it up and duplicate the code?
Thanks for any help.
If you want to create and reuse an ApplicationBar, you can create as a resource in the App.xaml and create the EventHandler for the Click events of the buttons on the App.xaml.cs file and on the pages just reference that resource.
Other options in to create the ApplicationBar based only on code and in that case you can have a global function on can call on any page to create the bar.
Personally, I'd just go ahead with the code-only option!
Related
I am developing an application similar to one-note in windows phone. I wonder what control they use for storing image,text and audio files.
I tried with RichTextBox but I found that RichTextbox is readonly for windows phone
Please suggest an approch to achieve this functionality
Thanks in advance.
For those who are not aware of One-note app in windows it holds text,images and audio
files like a Flow document.
Your best bet would be to use a <Canvas>
MSDN Canvas
It can hold any other XAML object and they can quickly and easily be positioned on the canvas in both XAML and back end code
That said, you are going to have to do some custom coding to create the UI elements dynamically.
This shouldn't be to hard.
If it were me I would create an application bar and in the sub menu I would create all of the UI elements you're allowing the person to create. When they select a UIElement it adds it to the canvas and you allow it to be draggable and editable.
Is it possible to change Application Icon, Splash screen etc through code, My requirement is i need to change these items after reaching a specific date say (jan-21-2012). Is there any provision present change these contents through code?
No, you cannot change these through code. These components of your application are specified via the manifest file. Regarding the Application Icon, you can have a 'live tile' for your application which is dynamic and can be changed. See MSDN:
How to: Create, Delete, and Update Tiles for Windows Phone
Maybe this blogpost about the dynamic splashscreen can help you?
http://windowsphonegeek.com/articles/All-about-Splash-Screens-in-WP7-ndash-Creating-animated-Splash-Screen
I don't think you can change the application icon this way. Do you have to change the icons multiple times through the year? Or is it one rebranding action? In that case i would suggest submit it with the new icons/splashscreen to the marketplace when you want it to change.
Here there are couple of articles about changing Splash screen:
Creating Animated Splash screen in Windows Phone7
Windows Phone 7 better Splash screen
You can extend techincs from articles above and implement your functionality.
Regarding to "Icon" use well known WP feature - Live Tiles (nice links in answers above).
How can we create a tab control where every tab item is connected with a different listbox, so the view are different for every tab? I want to know what is the best solution for this, I tried two approaches:
All logic of tab activity is built in one class that is
mainPage.xaml.cs
For every tab I create a new class and call it when a tab event
fires
What is the best solution and if answer is second then what is procedure to add different view but the all the tab appear every time?
Or provide a link where I can get a full example of tab control usage in Windows Phone 7.
Windows Phone does not provide a TabControl implementation, however, it does provide the unique Pivot control, which provides the same level of functionality and is documented on MSDN. You might also find this post by Jeff Wilcox useful: http://www.jeff.wilcox.name/2010/08/looking-ahead-at-panorama-and-pivot/
Here is an article I wrote on how to use the TabControl in a Windows Phone Silverlight application. It does not really abide the current UI guidelines, but it works. All you need to do is use ListBox controls as proper child elements.
Is there a way to display a browser control over the top of an XNA game on Windows Phone 7?
Basically I need to display some HTML, and then allow the user to return to the game.
So it can be full-screen if need be. It could even involve switching to Internet Explorer, if there's a way to return to the game from IE?
Is this possible?
It was announced that XNA and Silverlight would be available together in the same app starting with Mango update.
That might allow you to get what you're after.
I am not certain It would be nice if we could pop an html screen like we do on the iPhone. I know if you embed an url you can open ie. but as far as I know you can only get back to your game via the hardware back button.
You are not able to directly display HTML content in your XNA application due to the differences in the UI core. You are able, however, to invoke the WebBrowserTask. All you need to do is add a reference to Microsoft.Phone and then add a using statement for Microsoft.Phone.Tasks.
I have built a wizard style user control that lets you add stackpanel based pages and flick between them.
I would like to add an application bar as part of the user control with next and previous buttons that enable/disable based on page displayed etc.
Application bar appears to be an attached property of PhoneApplicationPage. I have tried referencing Microsoft.Phone.Shell but get invalid type.
Any ideas how I can add it to my user control?
Application bar is such a pain in the a**. This control is not a Silverlight one but a native one. Maybe you can be more lucky with this solution:
http://blog.humann.info/post/2010/08/27/How-to-have-binding-on-the-ApplicationBar.aspx
The ApplicationBar is a service that is provided by the operating system, i.e. not part of the Framework, and can only be used at the page-level, not in your UserControl. In addition, the ApplicationBar does not support regular bindings as you've seen. As mentioned above there are a number of solutions that provide workarounds for this problem.
Alternatively, you could use the ApplicationBarButtonCommand and ApplicationBarButtonNavigation behaviors from the Silverlight Windows Phone Toolkit. It's a simple enough task to create your ApplicationBarMenuCommand if you need one.