I was digging a bit around Silverlight Dependency properties, mainly to see how to receive change notification when ever a dependency property is changed. In WPF, this is straight forward, you may use the DependencyPropertyDescriptor, and call AddValueChanged. Like this.
Now, how to do this in Silverlight? I roamed around a bit, but can’t really find a good way of doing that. So, here is a quick hack. The trick is to use DependencyProperty.RegisterAttached(..) to instantiate a dependency property type (Ahem). This is what we are doing below.
- Create a binding with the FrameworkElement as the source
- Use DependencyProperty.RegisterAttached(..) to create a DependencyProperty instance
- Use FrameworkElement.SetBinding(dp, binding) to associate the dependency property with the element, via the binding.
So, we’ll get a call back when ever the dependency property changes. The RegisterForNotification summarizes what I explained above.
Create a new Silverlight project, and add the above code to the code behind. And add the following controls to your xaml page.
Now, just call RegisterForNotification from where ever you need (I’ve it in the Constructor of my MainPage.cs, just under the InitializeComponent() call), like
Fire up your project, and you’ll see the message boxes when ever the value change happens. So, now it looks pretty interesting, I guess. Opens up possibilities like having Data triggers in Silverlight, probably via an attached behaviour. Need to evaluate the pros and cons of this approach, came across this scenario while doing some other hacks.
Original blog post by Anoop Madhusudanan: http://www.amazedsaint.com/2009/12/silverlight-listening-to-dependency.html
If you are looking for an application on Windows Phone 7 that will capture your screen and save into an image file, then you can download a tool (ScreenCapturer-20111023v3.xap) here:
You need a ‘developer unlocked’ phone, then side load the screen capture app.
= Steps =
1. Click “Start Capture Task” to start capturing (A timer will start, and during this period, application will listen to Camera button event)
2. You may need to wait one or several seconds, a message box will show up to let you know you can start capturing.
3. Navigate to any application, and touch Camera button to capture the screen
4. A message box will show if the capturing is success, you can capture 20 images a one time (yes, you can ask for more if you want)
5. When the Capture Task ends, a Toast will show up to let you save the captured image, tap the Toast to return to application
6. The thumbnail will list and the captured images will stored in Pictures Hub
7. Tap the thumbnail will delete the temporary image file in the application folder
= Settings Help =
* Prevent Capture Task auto run: Capture Task uses BackgroundAgent to run and wait for Camera button event, BackgroundAgent may auto run in some case, enable this option to stop auto capture.
* The Capture Task duration: How long will the Capture Task run before it stop to accept Camera button event.
= Notice =
* Game and movie is not supported in this version.
* The Capture Task only save temporary file, you need go back to application to trigger saving file to Pictures Hub.
Use it for your own risk.
Hope it helps!
So here is a less known feature that Windows Phone 7.5 “Mango” introduced to fix color bandings.
The magic attribute is
BitsPerPixel="32" inside the App tag of WMAppManifest.xml.
<?xml version=”1.0″ encoding=”utf-8″?>
– Battery life
– Performance (half as much data to move around)
– Memory (back buffers are half the size)
– Widest compatibility (not all displays used by manufacturers can handle 24/32-bit)
– Very few apps need more than 16-bit
So Windows Phone defaults to 16-bit, and apps can opt-in to 32-bit (but they may not always get it due to hardware limits).
This book combines useful, technical information about the platform, written by those who’ve been there and done it, with some stories about the people and the apps they’d written. The book will act as a handy reference that gives you a “puddy up” into developing on the platform and, importantly, helps you to avoid making the same mistakes others have made.
The answer is: use WireBear Awesemulator.
It helps Windows Phone 7 developers take screenshots and create video overlays of the WP7 Emulator. Perfect for quick marketing, demo videos, presentations, and Marketplace images.
Download link: http://awesemulator.codeplex.com/
Here is a nice video about the new features that comes with Windows Phone 7.5 like Groups, Threads, Local Scout and more.
So what is your favorite feature?
If you want to have different text on your Windows Phone 7 aplication’s Tile icon, here is the way how to achieve it.
You need to change WMAppManifest.xml file, it is inside the Properties folder in the solution.
There you will see the Title element:
<Tokens> <PrimaryToken TokenID="MyAppToken" TaskName="_default"> <TemplateType5> <BackgroundImageURI IsRelative="true" IsResource="false">Background.jpg</BackgroundImageURI> <Count>0</Count> <Title>I've changed this</Title> </TemplateType5> </PrimaryToken> </Tokens>
You can also have it blank to remove the text from Tile.