windows-phone

Windows Phone 8 page lifecycle

。_饼干妹妹 提交于 2019-12-10 15:13:22
问题 I started developing an App for Windows Phone 8 and was wondering how my handling and keeping track of Page-Instances could affect performance and memory consumption. What is the usual lifecycle of a Page-Object? Can i monitor the necessity of a Page-Object staying alive? Thanks 回答1: Not so sure if what you ask is the following: Each Windows Phone Page has a constructor method which is called only once when the page is created - meaning that this method is called only once. Then comes the

Why is RestSharp AddHeader(“Accept”, “application/json”); = to a list of item?

痴心易碎 提交于 2019-12-10 15:10:39
问题 I've got this Windows Phone 8 project in C#, where I'm using RestSharp 104.4.0 to make a request to a server. The server only accepts a "Accept" type of "application/json". My code to call the request: var client = new RestClient(_jsonBaseUrl + someURL) { Authenticator = new HttpBasicAuthenticator(someUsername, somePassword) }; var request = new RestRequest(Method.POST); UTF8Encoding utf8 = new UTF8Encoding(); byte[] bytes = utf8.GetBytes(json); json = Encoding.UTF8.GetString(bytes, 0, bytes

How can I format a DatePicker to display the date format day / month / year?

依然范特西╮ 提交于 2019-12-10 14:57:55
问题 I'm using the Windows Phone 8.1 DatePicker It's displaying the date as month/day/year by default and I can't see any way to change this to the 'correct' way of day/month/year . This is how I declare the DatePicker <DatePicker Name="datePicker" HorizontalAlignment="Center" MonthFormat="{}{month.full}"/> displaying it as I can see in the linked msdn article that I can use a DateTimeFormatter in conjunction with ComboBox selectors but that's not an option for me. Is it possible? 回答1: To Edit the

Windows Phone Toolkit ListPicker Throws an Unhandled Exception

∥☆過路亽.° 提交于 2019-12-10 14:34:24
问题 I'm working on a Windows Phone 8 app. My app uses the ListPicker from the Tookit. My code in question looks like the following: <toolkit:ListPicker x:Name="myListPicker" Margin="12,-6,12,-2" Loaded="myListPicker_Loaded"> <toolkit:ListPicker.Items> <!-- Items are defined here --> </toolkit:ListPicker.Items> </toolkit:ListPicker> private void myListPicker_Loaded(object sender, RoutedEventArgs e) { if ((myListPicker != null) && (viewModel != null)) { } } Whenever the total number of items passes

Windows Phone app crashes only if downloaded from the store

自古美人都是妖i 提交于 2019-12-10 14:12:09
问题 I have a really strange problem, I developed a windows phone app that works perfectly if installed from visual studio... I uploaded on the store as beta, installed from the store, but the app crashes always on splashscreen! Thanks 回答1: If you're application uses a periodic Background Agent and you are testing it with the LaunchForTest method you should make sure that you are not calling this in your release build of the code. Protect it with appropriate conditional compile time checks: #if

Right align content in ListBox

泄露秘密 提交于 2019-12-10 13:07:33
问题 I'd like to right align some content in ListBox ItemTemplate in a way that its position doesn't change based on the width of the remaining ItemTemplate elements. Here's a screenshot of what I'd like to achieve: Here's the XAML I'm trying to use: <ListBox.ItemTemplate> <DataTemplate> <StackPanel Orientation="Horizontal"> <Grid Margin="12 12 0 0" Width="60" Height="60" VerticalAlignment="Top" Background="{StaticResource PhoneAccentBrush}"> <Image Source="/Assets/Mystery.png" /> </Grid>

How to show a comma separated number with StringFormat in XAML?

女生的网名这么多〃 提交于 2019-12-10 12:49:46
问题 My code currently shows like this: 43521 reviews , I want it be like this: 43,521 reviews . How can I do that? and is there a full reference for all possible formats in StringFormat ? couldn't find anything. thanks. <TextBlock Text="{Binding Reviews,StringFormat='{}{0} reviews'}"/> 回答1: just change your string format like this: <TextBlock Text="{Binding Reviews,StringFormat='{}{0:0,0} reviews'}"/> 回答2: This one also worked :) <TextBlock Text="{Binding Reviews,StringFormat='{}{0:N0} reviews'}"

How to refresh by pulling down the items?

邮差的信 提交于 2019-12-10 12:09:18
问题 there are lots of answers for this question, but, all of them as I see, are about getting old items at the bottom. this solution: void resultList_ItemRealized(object sender, ItemRealizationEventArgs e) { if (!_viewModel.IsLoading && resultList.ItemsSource != null && resultList.ItemsSource.Count >= _offsetKnob) { if (e.ItemKind == LongListSelectorItemKind.Item) { if ((e.Container.Content as TwitterSearchResult).Equals(resultList.ItemsSource[resultList.ItemsSource.Count - _offsetKnob])) {

Windows Phone: Parse a VCard String

删除回忆录丶 提交于 2019-12-10 12:01:22
问题 I have a VCard String that I want to parse and insert to the phone's contacts store. I checked this link http://msdn.microsoft.com/en-us/library/windowsphone/develop/jj207024(v=vs.105).aspx#BKMK_UsingtheRemoteIdHelperclass and found the following method ContactInformation info = await ContactInformation.ParseVcardAsync(IInputStream vcard); how can I convert my VCard String to an IInputStream so that I can parse it ? Thanks 回答1: I Used this class using System; using System.Collections.Generic;

getting the path of the stored image in windows phone

不问归期 提交于 2019-12-10 11:49:57
问题 I am storing the image into camera roll library.SavePictureToCameraRoll(DateTime.Now.ToString() + ".jpg", e.ImageStream); my Problem is How can i get the path of this image after storing this image. 回答1: On WP8, SavePictureToCameraRoll returns a Picture object on which you can call the GetPath method (don't forget to add the using Microsoft.Xna.Framework.Media.PhoneExtensions; ) var picture = lib.SavePicture(string.Format("test.jpg"), ms); var filePath = picture.GetPath(); Unfortunately, on