“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

HttpUtility.UrlEncode in Windows Phone 7?

Silverlight has the Uri.EscapeUriString and Uri.EscapeDataString which can be used to URL-encode portions of a URI such as query strings and path components and such. Even in the desktop framework, you should never take a dependency on System.Web.dll just for HttpUtility, although many developers still do it. This is bad for 3 reasons. The assembly … Read more

How should I implement ExecuteAsync with RestSharp on Windows Phone 7?

Old question but if you are using C# 5 you can have a generic execute class by creating a TaskCompleteSource that resturns a Task of T. Your code could look like this: public Task<T> ExecuteAsync<T>(RestRequest request) where T : new() { var client = new RestClient(); var taskCompletionSource = new TaskCompletionSource<T>(); client.BaseUrl = BaseUrl; client.Authenticator … Read more

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

TemplateBinding to DependencyProperty on a custom control not working

I have encountered this before, TemplateBinding does not work for custom dependency properties on controls. See these related questions: issues with template binding and binding of custom component TemplateBinding does not work in certain cases(when using TranslateTransform) I have always used this instead: {Binding MyProperty, RelativeSource={RelativeSource TemplatedParent}} It is semantically the same as TemplateBinding, and … Read more

The name ‘InitializeComponent’ does not exist in the current context. Cannot get any help on net searches [duplicate]

There are two potential causes of this. The most common is the x:Class doesn’t match up with the MainPage.xaml namespace. Make sure that x:Class in MainPage.xaml has the correct namespace. The second most common cause of this problem is that the “Build Action” is not set to “Page” for MainPage.xaml!

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