windows-phone-7

why my scrollviewer don't work in WP7?

限于喜欢 提交于 2020-01-06 08:16:32
问题 I have a scrollviewer that has a listbox in it. I want to have the scrollviewer automatically scroll by using ScrollToHorizontalOffset each time the timer tick (scroll 100 each 1 second). However it won't work, the timer work fine but the scrollviewer just won't move. Here is my code, please help! DispatcherTimer timer = new DispatcherTimer(); double current = 0; // Constructor public MainPage() { InitializeComponent(); timer = new DispatcherTimer(); this.imagesScrollview.Loaded += new

How to cancel reading from a Stream obtained using HttpWebResponse.GetResponseStream()?

旧街凉风 提交于 2020-01-06 08:14:09
问题 I use HttpWebResponse.BeginGetResponse() method to make a request to my server. In the "Request Complete" notification I do the following (no error handling code included): HttpWebResponse response = (HttpWebResponse)myHttpWebRequest.EndGetResponse(result); BinaryReader streamReader = new BinaryReader(response.GetResponseStream()); while ((readSize = streamReader.Read(buffer, 0, buffer.Length)) > 0) { ... } My question is if it is OK to store the Stream obtained from response

NullreferenceException when using NavigationService

这一生的挚爱 提交于 2020-01-06 08:12:12
问题 I'm encountering a problem with my WP7 app: I'm trying to make a login page prompt only when the app can't detect any stored username or password values; however, I keep running into a NullReferenceException when I try to navigate to my login page. My code looks like this, and it's in the contructor: if (!checkLogin()) { NavigationService.Navigate(new Uri("/LoginPage.xaml", UriKind.Relative)); } And checkLogin is just a function that returns either true or false depending or not the isolated

How to fit the HTML content to the web browser in Windows Phone 7

青春壹個敷衍的年華 提交于 2020-01-06 07:27:46
问题 I am trying to resize the browser with the size of html content. I have try with following code. private void WebBrowser_OnLoaded(object sender, RoutedEventArgs e) { String htmlHead = "<html><head><meta charset='UTF-8'/><meta name=\"viewport\" content=\"width='480', initial-scale='1'\"/>{0}</head><body onload=\"ResizeWebBrowser()\"><center>{1}</center></body></html>"; myWebView.NavigateToString(String.Format(htmlHead, getScript(), getHTMLContent())); myWebView.IsScriptEnabled = true;

windows phone 7 image checkbox

不羁岁月 提交于 2020-01-06 07:26:34
问题 I'm trying to create a simple checkbox, which is an image instead of the classic one. I managed to create the control and assign it different behaviours, but I can't make it to work when checking/unchecking. Here's the code : <UserControl.Resources> <ControlTemplate x:Key="CheckboxImageTemplate" TargetType="CheckBox"> <Image Name="imgTreble" MinWidth="100" Source="Images/treble_unchecked.png"/> </ControlTemplate> </UserControl.Resources> <StackPanel x:Name="LayoutRoot" Background="

How to transform array into textfile?

末鹿安然 提交于 2020-01-06 07:09:27
问题 I am currently creating a windows phone 7 application. How do I transform all the values of an array to textfile so I can print out all the values stored in that particular array inside another page listbox, and then store inside an isolated storage. Thanks! :( I tried this method but it doesn't work. For ViewList.xaml.cs private void addListBtn_Click(object sender, RoutedEventArgs e) { //Obtain the virtual store for application IsolatedStorageFile myStore = IsolatedStorageFile

WP7 Deeplink to Marketplace

我们两清 提交于 2020-01-06 07:08:08
问题 Does anyone know what code to use specifically to jump from within a Windows Phone 7 application to the application's listing in the Marketplace? 回答1: Refer to the sample code for MarketplaceDetailTask here. How to: Use Launchers for Windows Phone 来源: https://stackoverflow.com/questions/4331112/wp7-deeplink-to-marketplace

WebClient download weird behavior

二次信任 提交于 2020-01-06 04:59:26
问题 It seems that i have this weird behavior in my Web Client My application goes in this scenario: 1-user browse topics and it's replies (Loaded from the web using URL & DownloadStringAsync) 2-he add a reply in the topic 3- I re-load the replies of the comment again from the web But the new added reply don't appear on the new downloaded result although it appears when viewing the URL on the Web , The reply appears only if the application is closes and re-opened. I want to view the reply in the

MvvmLight print message to debug

女生的网名这么多〃 提交于 2020-01-06 03:52:17
问题 Is there a simple way to print all Messenger.Default.Send() to debug? Don't want to override them. 回答1: Create a function in an abstract ViewModel that everyone inherits from, which uses a define or global variable to determine if it debugs as well/instead. This could also be if you're running as Debug or Release. public abstract BaseViewModel public SendMessage() { if(DEBUG) // The global variable, or definition, or current run type - whatever Debug.WriteLine(); // else // Commented if you

issues with template binding and binding of custom component

浪尽此生 提交于 2020-01-06 03:41:08
问题 I'm new to the world of WP7 and .net programming for that matter and i need help. I have a custom component that has a property that uses template binding. <TextBlock Text="{TemplateBinding Info}" FontSize="20" Grid.Row="1" TextWrapping="{TemplateBinding TextWrap}"/> I defined the dependency properties in the .cs file. Now in my page.xaml i placed the custom component like so, <rounded:RoundedImageView x:Name="pivotItem1" Info="Test bind" BorderBrush="White" ImageSrc="Images/default_service