imultivalueconverter

Using IMultiValueConverter to pass multiple CommandParameters to viewModel

萝らか妹 提交于 2021-02-07 12:35:30
问题 I have the following code: <DataGridTemplateColumn Header="Security"> <DataGridTemplateColumn.CellTemplate> <DataTemplate> <Button Name="Security" Content="{Binding Path=totalSecurities}" Command="{Binding Source={StaticResource viewModel}, Path=filterGridCommand}"> <Button.CommandParameter> <MultiBinding Converter="{StaticResource PassThroughConverter}"> <Binding Path="sector"/> <Binding ElementName="Security" Path="Name"/> </MultiBinding> </Button.CommandParameter> </Button> </DataTemplate>

Converter shows System.Data.Entity.DynamicProxies when bind to EF Model

。_饼干妹妹 提交于 2020-01-30 08:17:06
问题 I am writing a WPF MVVM Application. I am trying to use a converter to display a contact name in the combobox. I do not think I can use the DisplayMemberPath since a "fullname" column does not exist. The ComboBox is being bound to a class within a class using Entity Framework. Given the following: .cs Files public class Car { public int CarId { get; set; } public string Make { get; set; } public string Model { get; set; } public string Year { get; set; } public Contact Owner { get; set; } }

MultiBinding Converter in CheckBox.IsChecked not called

青春壹個敷衍的年華 提交于 2020-01-16 19:11:48
问题 I have a custom combobox a multiselectioncombobox if you will, the thing is the selections depend on an other collection. I tried to bind ComboBox.IsChecked property to MultiBinding Converter but the converter isn't called. <DataTemplate> <StackPanel Orientation="Horizontal" x:Name="ItemStack" VirtualizingStackPanel.IsVirtualizing="False"> <CheckBox x:Name="CheckBoxItem" Command="{Binding SelectItem, RelativeSource={RelativeSource AncestorType={x:Type MultiSelectionComboBox}}}"

Correct way to not implement ConvertBack on a IMultiValueConverter

我的梦境 提交于 2020-01-06 04:41:28
问题 I have an object that implements IMultiValueConverter . It is used to bind visibility of a column based upon a particular permutation of a specific bool value and a specific enum value, both part of the bound data. The ConvertBack method self evidently has no meaning. On a regular IValueConverter, I could return Binding.DoNothing, but that is not an object[] so won't compile. I currently throw an exception, but that doesn't feel ideal. Is there a better way? 回答1: The correct way to implement

What has happened to MultiBinding between .NET 3.5 and .NET 4.5?

我只是一个虾纸丫 提交于 2020-01-03 15:22:54
问题 We are currently in the process of converting a project from version 3.5 to version 4.5 of .NET. We set a text box IsEnabled flagged using a multi binding with a multi binding converter. Each of the bindings has their own converter. All worked well in .NET 3.5 but in .NET 4.5 the target type that is passed to the child converter is of type object instead of bool. Is this a known issue? has MS refactored the multi binding to not pass the target type to child converters. I created a simplified

Does WPF have a set of default binding converters available?

依然范特西╮ 提交于 2019-12-25 07:58:57
问题 When creating WPF user controls I often find myself creating small converter classes when binding values. Often you need to do similar conversions, and it made me wonder whether I might be missing some existing available implementations. Does the .NET library contain any implementations of IValueConverter or IMultiValueConverter? Has there been any attempt made to create a library of reusable value converters? 回答1: There are not many built-in, public are: BooleanToVisibilityConverter

Binding to DataGridColumn with IMultiValueConverter encounters issues while using a similiar IValueConverter does not

假如想象 提交于 2019-12-24 06:45:02
问题 I have 2 Datagrid checkbox columns each with a binding. <DataGrid ItemsSource="{Binding}" Name="DataGrid1" DataContext="{Binding Source={StaticResource TableViewSource}}"> <DataGridCheckBoxColumn Header="Required" Width="50" MinWidth="50"> <DataGridCheckBoxColumn.Binding> <Binding Path="Required" Converter="{StaticResource DateTimeToBooleanConverter}"/> </DataGridCheckBoxColumn.Binding> </DataGridCheckBoxColumn> <DataGridCheckBoxColumn Header="Required Test" Width="60" MinWidth="60">

Can't access datacontext in multivalueconverter

我怕爱的太早我们不能终老 提交于 2019-12-24 04:55:07
问题 I have a usercontrol which I need to set a specific DataContext on. The usercontrol uses multivalueconverters. However, the binding in multivalueconverter fails to use the datacontext. It works fine for regular value converters. Anyone know what is going on? To clarify, below code is not similar to my real code, it's just a sample reproducing my issue. FOr example, my multivalueconverters take more than one argument. XAML: <Window x:Class="MultConvTest.Window1" xmlns="http://schemas.microsoft