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
500
Error getting value from XamMultiColumnComboEditor.SelectedItem
posted

Hi,

With the following code i m facing the captioned problem.

Xaml:

<CollectionViewSource x:Key="v_EXSTDNT_MASTERViewSource" d:DesignSource="{d:DesignInstance my:V_EXSTDNT_MASTER, CreateList=True}">

<Grid DataContext="{StaticResource v_EXSTDNT_MASTERViewSource}" HorizontalAlignment="Left" Margin="33,104,0,0" Name="grid1" VerticalAlignment="Top" Height="35" Width="483">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="71*" />
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="35" />
                <RowDefinition Height="695*" />
            </Grid.RowDefinitions>
            <!--<Label Content="Select Student:" HorizontalAlignment="Left" Margin="49,81,0,588" VerticalAlignment="Center" Width="104" Grid.Row="1" />-->
            <ig:XamMultiColumnComboEditor Name="xamMultiColumnComboEditor1" DisplayMemberPath="NAME" SelectedItem="STDNT_CODE" HorizontalAlignment="Left" ItemsSource="{Binding}" Margin="131,3,0,3" VerticalAlignment="Center" Width="346" AutoGenerateColumns="False" IsTabStop="True" AllowMultipleSelection="False" Height="29" Grid.Column="2">
                <ig:XamMultiColumnComboEditor.Columns>
                    <ig:TextComboColumn HeaderText="Code" Key="STDNT_CODE"/>                       
                    <ig:TextComboColumn HeaderText="Name" Key="NAME"/>
                    <ig:TextComboColumn HeaderText="Father Name" Key="FATHER_NAME"/>
                    <ig:TextComboColumn HeaderText="Date of Birth" Key="DATE_OF_BIRTH"/>
                    <ig:TextComboColumn HeaderText="Place of Birth" Key="PLACE_OF_BIRTH"/>
                    <ig:TextComboColumn HeaderText="Gender" Key="GENDER"/>
                </ig:XamMultiColumnComboEditor.Columns>
            </ig:XamMultiColumnComboEditor>
        </Grid>

 

Code Behind:

private ObjectQuery<V_EXSTDNT_MASTER> GetV_EXSTDNT_MASTERQuery(Entities entities)
        {
            // Auto generated code

            System.Data.Objects.ObjectQuery<ExStudentInfo.V_EXSTDNT_MASTER> v_EXSTDNT_MASTERQuery = entities.V_EXSTDNT_MASTER;
            // Returns an ObjectQuery.
            return v_EXSTDNT_MASTERQuery;
        }

        private void Window_Loaded(object sender, RoutedEventArgs e)
        {

            ExStudentInfo.Entities entities = new ExStudentInfo.Entities();
            // Load data into V_EXSTDNT_MASTER. You can modify this code as needed.
            System.Windows.Data.CollectionViewSource v_EXSTDNT_MASTERViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("v_EXSTDNT_MASTERViewSource")));
            System.Data.Objects.ObjectQuery<ExStudentInfo.V_EXSTDNT_MASTER> v_EXSTDNT_MASTERQuery = this.GetV_EXSTDNT_MASTERQuery(entities);
            v_EXSTDNT_MASTERViewSource.Source = v_EXSTDNT_MASTERQuery.Execute(System.Data.Objects.MergeOption.AppendOnly);           
            
        }

Accessing the value:

//int selItem = this.xamMultiColumnComboEditor1.SelectedItem;         listBox1.Items.Add(this.xamMultiColumnComboEditor1.SelectedIndex);
listBox1.Items.Add(this.xamMultiColumnComboEditor1.SelectedItems);
listBox1.Items.Add(this.xamMultiColumnComboEditor1.SelectedItem);

Result:

Also guide/alter the above code so that i get the xamMultiColumnComboEditor1 sorted for the Code field.

An early reply will be highly appreciated.


Regards,

Sohail Kazmi.