Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1385
Binding to data in the FooterTemplate
posted

I'm doing MVVM using the XamMultiColumnComboEditor, and would like to use the FooterTemplate to display some data from the view model.  When I try to bind to something, it doesn't seem to come through.  If I simply bind to the datacontext of the editor ({Binding}), the value is null.

Is there something special I need to do to bind data there?

  • 29105
    Verified Answer
    Offline posted

    Hello Walter,

    Thank you for reaching out. What are you trying to display in the Footer about the DataContext of the editor? eg. SelectedItem

    The FooterTemplate is not in the same context of the combo and you need drill up to the parent to get the components datacontext. You can  use a ElementName binding, for example and then the Path would equal your text to be displayed.

    The following example would show the first record value of a given field, called FirstName.

    <ig:XamMultiColumnComboEditor x:Name="combo" Height="25" ItemsSource="{Binding}" DisplayMemberPath="FirstName" >

    <ig:XamMultiColumnComboEditor.FooterTemplate>

    <DataTemplate >

    <Border BorderThickness="1"

    CornerRadius="7"

    BorderBrush="Black"

    Margin="10">

    <TextBlock VerticalAlignment="Center"

    Margin="5"

    Text="{Binding ElementName=combo, Path=DataContext[0].FirstName}"/>

    </Border>

    </DataTemplate>

    </ig:XamMultiColumnComboEditor.FooterTemplate>

    </ig:XamMultiColumnComboEditor>

    Let me know if you have any questions.