WPF Binding to parent DataContext

I dont know about XamGrid but that’s what i’ll do with a standard wpf DataGrid: <DataGrid> <DataGrid.Columns> <DataGridTemplateColumn> <DataGridTemplateColumn.CellTemplate> <DataTemplate> <TextBlock Text=”{Binding DataContext.MyProperty, RelativeSource={RelativeSource AncestorType=MyUserControl}}”/> </DataTemplate> </DataGridTemplateColumn.CellTemplate> <DataGridTemplateColumn.CellEditingTemplate> <DataTemplate> <TextBox Text=”{Binding DataContext.MyProperty, RelativeSource={RelativeSource AncestorType=MyUserControl}}”/> </DataTemplate> </DataGridTemplateColumn.CellEditingTemplate> </DataGridTemplateColumn> </DataGrid.Columns> </DataGrid> Since the TextBlock and the TextBox specified in the cell templates will be part of the … Read more

WPF: how to use 2 converters in 1 binding?

This is what I did: public class CombiningConverter : IValueConverter { public IValueConverter Converter1 { get; set; } public IValueConverter Converter2 { get; set; } public object Convert( object value, Type targetType, object parameter, CultureInfo culture) { object convertedValue = Converter1.Convert(value, targetType, parameter, culture); return Converter2.Convert( convertedValue, targetType, parameter, culture); } public object ConvertBack( object … Read more

How to pass specific value to the converter parameter?

Try using x:Static markup extension: <RadioButton Content=”Female” IsChecked=”{Binding Path=Gender, Converter={StaticResource genderConverter}, ConverterParameter={x:Static model:GenderType.Female}}”/> OR, you could just pass a string and use Enum.Parse to convert that string to the enum type in the converter: <RadioButton Content=”Female” IsChecked=”{Binding Path=Gender, Converter={StaticResource genderConverter}, ConverterParameter=Female}”/> – GenderType gender = (GenderType)Enum.Parse(typeof(GenderType), parameter.ToString());

C# WPF IsEnabled using multiple bindings?

You can use a MultiBinding with a converter which implements IMultiValueConverter. Just to give an answer you can (almost) copy&paste: Static resource needed: <converterNamespace:BooleanAndConverter x:Key=”booleanAndConverter” /> The ComboBox: <ComboBox Name=”MyComboBox”> <ComboBox.IsEnabled> <MultiBinding Converter=”{StaticResource booleanAndConverter}”> <Binding ElementName=”SomeCheckBox” Path=”IsChecked” /> <Binding ElementName=”AnotherCheckbox” Path=”IsChecked” /> </MultiBinding> </ComboBox.IsEnabled> </ComboBox> The code for the converter: namespace ConverterNamespace { public class … Read more

Angular 2 add multiple classes via [class.className] binding

You can do this by simply using ngClass : Here first,second and third are the name of the classes. And instead of true/false , you can directly put your conditions over there <div [ngClass]=”{‘first’: true, ‘second’: true, ‘third’: false}”>…</div> In your case <div [ngClass]=”{‘loading-state’: loading, ‘my-class’: loading }”>…</div> Or Shorter Veriosn (as @matko.kvesic commented) <div … Read more

JavaScript Callback Scope [duplicate]

(extracted some explanation that was hidden in comments in other answer) The problem lies in the following line: this.dom.addEventListener(“click”, self.onclick, false); Here, you pass a function object to be used as callback. When the event trigger, the function is called but now it has no association with any object (this). The problem can be solved … Read more

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