How to post data using HttpClient?

You need to use: await client.PostAsync(uri, content); Something like that: var comment = “hello world”; var questionId = 1; var formContent = new FormUrlEncodedContent(new[] { new KeyValuePair<string, string>(“comment”, comment), new KeyValuePair<string, string>(“questionId”, questionId) }); var myHttpClient = new HttpClient(); var response = await myHttpClient.PostAsync(uri.ToString(), formContent); And if you need to get the response after post, … Read more

“UpdateSourceTrigger=PropertyChanged” equivalent for a Windows Phone 7 TextBox

Silverlight for WP7 does not support the syntax you’ve listed. Do the following instead: <TextBox TextChanged=”OnTextBoxTextChanged” Text=”{Binding MyText, Mode=TwoWay, UpdateSourceTrigger=Explicit}” /> UpdateSourceTrigger = Explicit is a smart bonus here. What is it? Explicit: Updates the binding source only when you call the UpdateSource method. It saves you one extra binding set when the user leaves … Read more

Developing cross platform mobile application [closed]

My answer here covers some of the technical limitations of cross-platfrom tools but let me expand a bit: I think that cross-platform tools have historically always been also-rans because such tools have the wrong philosophical focus. All the selling points for cross-plaform tools are the benefits they bring to developers. They are sold on the … Read more

Parsing HTML with c#.net [duplicate]

Give the HTMLAgilityPack a look into. Its a pretty decent HTML parser http://html-agility-pack.net/?z=codeplex Here’s some code to get you started (requires error checking) HtmlDocument document = new HtmlDocument(); string htmlString = “<html>blabla</html>”; document.LoadHtml(htmlString); HtmlNodeCollection collection = document.DocumentNode.SelectNodes(“//a”); foreach (HtmlNode link in collection) { string target = link.Attributes[“href”].Value; }

Windows Phone 7 (WP7) Change a button’s background color on click

What you need to do is create a button template that modifies the Pressed visual state. In blend, select your button, click the menu item “Object”->”Edit Template”->”Edit a Copy…” and a new template is created. In the States window, select the Pressed visual state in the CommonStates visual state group. Now select ButtonBackground in the … Read more