Angular lazy one-time binding for expressions

Yes. You can prefix every expressions with ::, even the ones in ngIf or ngClass: <div ng-if=”::(user.isSomething && user.isSomethingElse)”></div> <div ng-class=”::{classNameFoo: user.isSomething}”></div> Actually, the code simply checks that the two first characters in the expression are : in order to activate the one-time binding (and then removes them, thus the parenthesis aren’t even needed). Everything … Read more

WPF Bind to itself

Short answer:{Binding} is not a shortcut for “binding to itself” (in the sense of RelativeSource.Self). Rather, {Binding} is equivalent to {Binding Path=.}, which binds to the current source. To elaborate: A binding has a source and a path. You can do a “binding to itself”, for example, by using <myUIControl myProperty=”{Binding RelativeSource={RelativeSource Self}, Path=x}” /> … Read more

WPF Error: Cannot find governing FrameworkElement for target element

Sadly any DataGridColumn hosted under DataGrid.Columns is not part of Visual tree and therefore not connected to the data context of the datagrid. So bindings do not work with their properties such as Visibility or Header etc (although these properties are valid dependency properties!). Now you may wonder how is that possible? Isn’t their Binding … Read more

how to pass an integer as ConverterParameter?

Here ya go! <RadioButton Content=”None” xmlns:sys=”clr-namespace:System;assembly=mscorlib”> <RadioButton.IsChecked> <Binding Path=”MyProperty” Converter=”{StaticResource IntToBoolConverter}”> <Binding.ConverterParameter> <sys:Int32>0</sys:Int32> </Binding.ConverterParameter> </Binding> </RadioButton.IsChecked> </RadioButton> The trick is to include the namespace for the basic system types and then to write at least the ConverterParameter binding in element form.

WPF Binding StringFormat Short Date String

Try this: <TextBlock Text=”{Binding PropertyPath, StringFormat=d}” /> which is culture sensitive and requires .NET 3.5 SP1 or above. NOTE: This is case sensitive. “d” is the short date format specifier while “D” is the long date format specifier. There’s a full list of string format on the MSDN page on Standard Date and Time Format … Read more

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