Why ever use a multi binding converter?

Couldn't I just use a single binding converter and as a parameter pass in the DataContext and from there pick what properties I want to use?

-------------Problems Reply------------

If you pass the whole object instead of the individual properties, then the binding expression will not be re-evaluated when the individual properties change. You will be losing the benefit of the INotifyPropertyChanged mechanism.

You might want to be more explicit and take in the minimum extra information (which is just generally good programming practice), or you may want information from more than one source - e.g. Your value might be dependent on a property of the datacontext and the checked state of a checkbox somewhere else in the view.

You can do that, but the binding will not update if the relevant properties change that way. Besides the updates Multibinding is needed for more complex bindings to different controls and data-objects.

Category:c# Views:2 Time:2011-05-04

Related post

  • How can I pass a constant value for 1 binding in multi-binding? 2010-07-27

    I have a multi-binding like <TextBlock> <TextBlock.Text> <MultiBinding Converter="{StaticResource myConverter}"> <Binding Path="myFirst.Value" /> <Binding Path="mySecond.Value" /> </MultiBinding> </TextBlock.Tex

  • Binding converter as inner class? 2009-05-14

    I have a UserControl that uses a binding converter. I've made the converter an inner class of public partial class MyPanel : UserControl { public class CornerRadiusConverter : IValueConverter { How do I reference the Converter class from the XAML? Th

  • How can I refer to a binding converter in another namespace in Silverlight XAML? 2010-05-18

    Since you apparently can't create a Silverlight DataTemplate in C#, I'm trying to create one in XAML. I have a converter that I need to refer to, that I have defined in C# in another namespace. I've tried doing this: <UserControl.Resources>

  • How to programatically add a binding converter to a WPF ListView? 2010-07-07

    I am having a lot of trouble finding a good example of how to programatically create, fill and style a ListView. Every example I find tends to use a lot of XAML markup and a minimum amount of C# to switch which bit of markup is being run. This is imp

  • Silverlight Binding converter 2011-04-06

    I'm trying to bind a field to my coverter... But it seems like it's not possible... This is what I'm trying to do. Source="{Binding LeaveApproved,Converter={StaticResource CommentTypeIconConverter},ConverterParameter={Binding TypeOfWorkId}}" I want a

  • Binding converted Enum to a ComboBox 2011-04-07

    I tried to bind the following Enum to a ComboBox Public Enum PossibleActions ActionRead ActionWrite ActionVerify End Enum I can't change the Enum itself, but I do not want to display these strings. My intention is just to cut the prefix 'Action' and

  • Binding Converter using index of item in list 2011-12-06

    I have a scenario which requires me to bind a list of objects to a grid. I would like the behaviour as such that :- • When an item is added to the list it moves to the next available space in the grid. (like a wrap panel) Shown below is my current XA

  • Spring Webflow binding: Converter - java.lang.IllegalArgumentException: Each converter object must implement one of the Converter - interfaces 2012-01-30

    I have the following code in one of the Spring's XML config files: <mvc:annotation-driven conversion-service="conversionService" /> <bean id="conversionService" class="org.springframework.context.support.ConversionServiceFactoryBean">

  • How Binding Converter to a control's property can access other properties of the control 2012-04-12

    I am trying to bind a value "MaxLines" to the TextBlock's Height property in WP7 app. There is a converter to the binding which is supposed to multiple the LineHeight with the MaxLines and return the expected height. What I am trying to say is I want

  • Silverlight 2 dynamic data binding Converter 2009-04-21

    In Silverlight 2.... I have a RadioButton in my xaml code as follows: <RadioButton GroupName="Gender" Content="Male" IsChecked="{Binding Path=Gender, ConverterParameter=1, Mode=TwoWay, Converter={StaticResource RadioStringConverter}}" Width="49" H

  • Is it possible to bind/convert the items in a list of a form to a specific type in a Spring Web MVC app? 2010-07-15

    I'm building a Spring MVC app with Spring 3.0.3. I have data binding of my form working just fine, but one of the form fields is a list of items. Hypothetically speaking, my form object looks like this: public class MyForm { private String name; priv

  • XAML Tool Tip Data Context and Multi Binding 2010-10-27

    I have a ListView in my XAML and I am trying to hook up a MultiBinding Converter. <ListView Grid.Column="4" Grid.Row="1" Grid.RowSpan="5" Margin="8,0,8,8" HorizontalAlignment="Stretch" Name="lvDisplayType" ItemsSource="{Binding Path=Types}" Select

  • WPF Binding Converter for Collection 2010-11-04

    I have a WPF treeview used to display a file structure. Each treeitem has a collection of enums to determine custom status' of the item. I.E. ObservableCollection<enumType> statusCollection; I have several ellipses that are displayed when a tre

  • Using resources as convertion results in a bind converter 2011-06-01

    When I try to bind a valueconverter from a defined enum Status to brush, I get an error in my XAML designer: 'OKStatus' resource not found. The application works fine runtime, but I'm not able to see my GUI in the designer. My resources are defined i

  • what wrong with my binding convert? 2011-06-15

    I have radiobutton and I want to define binding between the radiobutton.IsChecked state and the visibility some stackpanel so I wrote this convert method: public class RadioBtnState2Visible : IValueConverter { public object Convert( object value, Typ

  • WPF Datagrid Grouping - items with binding converter not updating dynamically 2011-06-23

    Am new to WPF and using the datagrid control to group items, data is sourced from a java message Q and items are added dynamically as they arrive. Am using GroupStyle to display the Grouping name, Items Count and a custom converter that reads display

  • data binding converter for lat/long (multiple parameters) 2011-09-15

    I am using Web Services to receive a list of objects which I have then directly data bound to pushpins. However the object has coordinates as a latitude and longitude (so separate properties). Whilst I can obviously add a Geocoordinate Location prope

  • Imagebrush image source binding converter 2011-10-29

    I'm using an xml as source of my application via binding. in the xml there is a list of folders and a path for a sample image for each folder. The folder list is binded to listbox, and another display is binded to the selected item of the listbox, wh

  • Using Multi Binding in telerik Datagrid 2011-11-03

    How do I pass multiple parameters in command parameters. here is what I am trying to do: I want to send Is checked or not (I can do this by introducing a Boolean field to the object bound. But I dont want to do that) and I want to send the selected d

Copyright (C) dskims.com, All Rights Reserved.

processed in 0.161 (s). 11 q(s)