At the beginning, some people in today's aiming Forum have developed a similar application. It seems that beginners like this application ..
First look at the picture, there is a picture with the truth
I originally wanted to use hubtile, but it was troublesome to change the style, so I simply wrote a custom control. Relatively simple. You can preview the temperature information for three days in the panel.
Before that, we can add a city and read the weather information of the city.
In addition, you can regularly update the weather forecast information to display the weather information of the preferred city on the home page.
All the data is bound as a template. The boxes for displaying the weather need to be bound with data. Previously, the data was dynamically bound and later bound to the template. However, an error is reported during the operation and the information is checked, you need to register this property.
Method of registering an attribute.
1 /// <summary>
2 // Weather Information
3 /// </Summary>
4 Public model. weathertable. City cityinfo
5 {
6 get
7 {
8 return (model. weathertable. City) base. getvalue (cityinfoproperty );
9}
10 set
11 {
12 base. setvalue (cityinfoproperty, value );
13}
14}
15 # Region
16 /// <summary>
17 // register attributes
18 /// </Summary>
19 public static dependencyproperty cityinfoproperty;
20 static weathertile (){
21 cityinfoproperty = dependencyproperty. Register (
22 "cityinfo ",
23 typeof (model. weathertable. City ),
24 typeof (weathertile ),
25 new propertymetadata (null)
26 );
27}
28 # endregion
In this way, you can bind data directly to the XAML file.
1 <my:WeatherTile
2 Margin="3"
3 CityInfo="{Binding}"
4 />
New Features
I used a reminder for scheduled task updates.
Download source code:
Http://files.cnblogs.com/lsmayday/%E5%A4%A9%E6%B0%94%E9%A2%84%E6%8A%A5.rar