wp记账簿
程序员文章站
2022-04-30 19:30:48
xaml 代码
&nb...
xaml 代码
<grid x:name="layoutroot">
<grid.background>
<imagebrush stretch="fill" imagesource="qtrash.png"/>
</grid.background>
<grid.rowdefinitions>
<rowdefinition height="auto"/>
<rowdefinition height="*"/>
</grid.rowdefinitions>
<!--titlepanel contains the name of the application and page title-->
<stackpanel x:name="titlepanel" grid.row="0" margin="12,17,0,2">
<textblock x:name="applicationtitle" text="生活小助手" style="{staticresource phonetextnormalstyle}"/>
</stackpanel>
<!--contentpanel - place additional content here-->
<grid grid.row="1" >
<toolkit:datepicker verticalalignment="top" value="{binding datetime, mode=twoway}" x:name="datepicker" margin="48,0,0,0" horizontalalignment="left" width="159" canvas.zindex="2"/>
<toolkit:listpicker x:name="plist" margin="211,-1,-3,0" canvas.zindex="3" height="354" verticalalignment="top">
<toolkit:listpickeritem content="衣" margin="0,0,67,0"/>
<toolkit:listpickeritem content="食"/>
<toolkit:listpickeritem content="行"/>
<toolkit:listpickeritem content="住"/>
<toolkit:listpickeritem content="其他"/>
</toolkit:listpicker>
<textbox inputscope="telephonelocalnumber" textwrapping="wrap" x:name="numbermoney" margin="49,72,0,578" horizontalalignment="left" width="158" />
<button content="增加" horizontalalignment="left" margin="384,0,0,395" verticalalignment="bottom" click="button_click" width="106" />
<listbox margin="4,313,12,9" scrollviewer.verticalscrollbarvisibility="visible" foreground="blue" selectionmode="multiple" x:name="plistbox" canvas.zindex="2">
<listbox.itemtemplate>
<datatemplate>
<stackpanel orientation="horizontal" >
<textblock text="{binding datetime, mode=twoway}"/>
<textblock text="用在"/>
<textblock text="{binding kind, mode=twoway}"/>
<textblock textwrapping="wrap" text="{binding numbercost, mode=twoway}"/>
<textblock text="元"/>
</stackpanel>
</datatemplate>
</listbox.itemtemplate>
</listbox>
<button content="合计" horizontalalignment="left" margin="304,0,0,395" x:name="btntotal" click="btntotal_click" verticalalignment="bottom" d:layoutoverrides="horizontalalignment" />
<textblock height="30" foreground="blue" margin="0,286,155,0" x:name="tbtotal" text="textblock" verticalalignment="top" d:layoutoverrides="width" horizontalalignment="right" width="84" visibility="collapsed" />
<button content="统计" horizontalalignment="left" margin="139,0,0,397" x:name="button1" verticalalignment="bottom" click="button1_click" rendertransformorigin="-2.351,0.486" d:layoutoverrides="horizontalalignment" />
<:chart visibility="collapsed" xmlns:vc="clr-namespace:visifire.charts;assembly=slwpvisifire.charts"
x:name="mychart"
lightingenabled="false" borderthickness="0" padding="2,2,2,0"
zoomingenabled="false" animationenabled="false" margin="0,321,0,49" tabnavigation="cycle">
<vc:chart.titles>
<vc:title padding="0,0,0,5" verticalalignment="top" horizontalalignment="center"
fontstyle="italic" fontweight="bold"/>
</vc:chart.titles>
<vc:chart.axesx>
<vc:axis margin="0,-4,0,4">
<vc:axis.axislabels>
<vc:axislabels angle="0"/>
</vc:axis.axislabels>
</vc:axis>
</vc:chart.axesx>
</vc:chart>
<button content="保存到手机" click="btnsavetophone_click" x:name="btnsavetophone" horizontalalignment="right" margin="0,252,319,0" verticalalignment="top" width="174">
<!--<custom:interaction.triggers>
<custom:eventtrigger eventname="click">
<ic:navigatetopageaction targetpage="/mainpage.xaml"/>
</custom:eventtrigger>
</custom:interaction.triggers>-->
</button>
<textblock horizontalalignment="left" margin="8,22,0,0" textwrapping="wrap" text="时间" verticalalignment="top"/>
<textblock margin="8,89,0,0" textwrapping="wrap" text="花销" verticalalignment="top" horizontalalignment="left" width="50"/>
</grid>
</grid>
后台代码
private void btnsavetophone_click(object sender, routedeventargs e)
{
xmlwritersettings xmlwritersettings = new xmlwritersettings();
xmlwritersettings.indent = true;
using (isolatedstoragefile myisolatedstorage = isolatedstoragefile.getuserstoreforapplication())
{
using (isolatedstoragefilestream stream = myisolatedstorage.openfile("cost.xml", filemode.create))
{
xmlserializer serializer = new xmlserializer(typeof(observablecollection<costrecord>));
using (xmlwriter xmlwriter = xmlwriter.create(stream, xmlwritersettings))
{
serializer.serialize(xmlwriter, pp);
}
}
}
}
网上找的,哈哈其他的就不上了微软审核的人说图标不符合审核要求,没有通过,做美工的帮忙搞一个图标吧
摘自 gis-man