Welcome to the Xceed Community | Help
Community Search  

set multiple values with custom CellEditor

Sort Posts: Previous Next
  •  01-22-2008, 4:51 PM Post no. 10649

    set multiple values with custom CellEditor

    I'm hoping this is possible: I need to be able to set multiple values from a custom CellEditor. For example, if I have an object with StateProvince and Country properties, I would like to provide a CellEditor with a ComboBox of state/provinces grouped by country that would automatically set the Country property as well as the StateProvince property.

    I just don't know what the binding in the CellEditor needs to look like to make this work because the {xcdg:CellEditorBinding} and {xcdg:CellContentBinding} don't seem to give access to the object the entire DataRow is bound to? I tried the following but with no luck:

    {Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type xcdg:DataRow}}, Path=SourceObject.CountryName}

    Any help is appreciated, thanks.
  •  02-06-2008, 12:06 PM Post no. 10650 in reply to 10649

    Re: set multiple values with custom CellEditor

    I had the same issue. You need to bind to the DataContext of the DataCell. The following is an example where I only wanted the CheckBox to be visible if another value in the object was true.

    <xcdg:Column FieldName="DateActual" MinWidth="40" Title="Actual" Width="40">
    <xcdg:Column.CellContentTemplate>
    <DataTemplate>
    <CheckBox HorizontalAlignment="Center" Visibility="<b>{Binding Path=DataContext, Converter={StaticResource VisibleIfCustomDate}, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type xcdg:DataCell}}}</b>" IsChecked="{Binding Mode=OneWay}" />
    </DataTemplate>
    </xcdg:Column.CellContentTemplate>
    <xcdg:Column.CellEditor>
    <xcdg:CellEditor>
    <xcdg:CellEditor.EditTemplate>
    <DataTemplate>
    <CheckBox HorizontalAlignment="Center" Visibility="<b>{Binding Path=DataContext, Converter={StaticResource VisibleIfCustomDate}, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type xcdg:DataCell}}}</b>" IsChecked="{xcdg:CellEditorBinding}" />
    </DataTemplate>
    </xcdg:CellEditor.EditTemplate>
    </xcdg:CellEditor>
    </xcdg:Column.CellEditor>
    </xcdg:Column>

    Hope this was helpful.
View as RSS news feed in XML
Contact | Site Map | Reviews | Legal Terms of Use | Trademarks | Privacy Statement Copyright 2008 Xceed Software Inc.