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
315
XamComboEditor Usage in UnboundField
posted

Can someone please show me an example of how to use a XamComboEditor in an UnboundField? If I change my ViewModel in such a way to allow be to use a regular Field, the XamComboEditor works as expected. However, when I change over to an UnboundField, selecting an item in the combo list never updates the underlying ViewModel.

In my example, I have a Header class that represents each record in the grid. The Header class has a property called Coverage that contains an CoverageInfo object to hold the list of valid Policies, and the selected Policy. The list of valid policies is dependent on data contained within the Coverage and Header data. I need the user to be able to select the appropriate policy from the list of valid policies.

I suspect it has something to do with the grid treating the selected value as a string, instead of a more complex object and is having problems converting the string into the complex object. Here's a sample of what is not working:

<data:UnboundField BindingPath="Coverage.Policy" Label="Policy">

    <data:Field.Settings>

        <data:FieldSettings EditorType="{x:Type xam:XamComboEditor}">

            <data:FieldSettings.EditorStyle>

                <Style TargetType="{x:Type xam:XamComboEditor}">

                    <Setter Property="ValueType" Value="{x:Type support:PolicyInfo}" />

                    <Setter Property="ItemsSource" Value="{Binding DataItem.Policies}" />

                    <Setter Property="DisplayMemberPath" Value="Name" />

                </Style>

            </data:FieldSettings.EditorStyle>

        </data:FieldSettings>

    </data:Field.Settings>

</data:UnboundField>

Parents
No Data
Reply
  • 515
    posted

    Try it with

    <Setter Property="SelectedItem" Value="{Binding DataItem.Policy}" />

    But i am having lot's of problems with this... I'm still about to get a feeling which error occurs in which case...

Children
No Data