How can I data bind a list of strings to a ListBox in WPF/WP7?

If simply put that your ItemsSource is bound like this: YourListBox.ItemsSource = new List<String> { “One”, “Two”, “Three” }; Your XAML should look like: <ListBox Margin=”20″ Name=”YourListBox”> <ListBox.ItemTemplate> <DataTemplate> <StackPanel Orientation=”Horizontal”> <TextBlock Text=”{Binding}” /> </StackPanel> </DataTemplate> </ListBox.ItemTemplate> </ListBox> Update: This is a solution when using a DataContext. Following code is the viewmodel you will be … Read more

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

Add custom header in HttpWebRequest

You use the Headers property with a string index: request.Headers[“X-My-Custom-Header”] = “the-value”; According to MSDN, this has been available since: Universal Windows Platform 4.5 .NET Framework 1.1 Portable Class Library Silverlight 2.0 Windows Phone Silverlight 7.0 Windows Phone 8.1 https://msdn.microsoft.com/en-us/library/system.net.httpwebrequest.headers(v=vs.110).aspx

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

How to hash a password

Most of the other answers here are somewhat outdated considering today’s best practices. The most robust password-hashing algorithm that’s natively available in .NET is PBKDF2, represented by the Rfc2898DeriveBytes class. The following code is in a stand-alone class in this post: Another example of how to store a salted password hash. The basics are really … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)