This is a migrated thread and some comments may be shown as answers.

[Solved] ComboBox problem

3 Answers 97 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
sulagna
Top achievements
Rank 1
sulagna asked on 23 Dec 2010, 02:22 PM
Hi 
I have  a grid view combo box which has 2 items displayed in the jepg1 provided.
After migrating to silverlight I am only getting one value in the combo box(refer jepg2).How can I get two values?
My xaml is below:
 <telerik:GridViewComboBoxColumn DataMemberBinding="{Binding DisciplineId,Mode=TwoWay}"
                                            SelectedValueMemberPath="DisciplineId"
                                            DisplayMemberPath="DisciplineAlias" 
                                            UniqueName="Discipline" Width="80"
                                            IsResizable="False" ItemsSource="{Binding Path=ProjectDisciplineList}"                 
                                            >
                    <telerik:GridViewComboBoxColumn.Header>
                        <StackPanel>
                            <TextBlock Text="Discipline*" Width="48" />
                        </StackPanel>
                    </telerik:GridViewComboBoxColumn.Header>
</telerik:GridViewComboBoxColumn>

My view model is having the code below and I am getting value in "ProjectDisciplineList" property in the view model but only one
alies is getting displayed.I need Alies and Name both.

this.ProcessDisciplineService.GetAllProjectDisciplines(project, OnProjectProcessDisciplineLoadComplete);
       
private void OnProjectProcessDisciplineLoadComplete(ObservableCollection<Discipline> projectDisciplineList)
{
            ProjectDisciplineList = projectDisciplineList;
            OnPropertyChanged("ProjectDisciplineList");           
}           
 public ObservableCollection<Discipline> ProjectDisciplineList
        {
            get;
            set;
        }
My domain model is given below

namespace LeMonNext.Common.Entities
{
    [DataContract(Name = "Discipline")]
    public class Discipline
    {
        [DataMember]
        public int DisciplineId { get; set; }

        [DataMember]
        public string DisciplineName { get; set; }

        [DataMember]
        public string DisciplineAlias { get; set; }

        [DataMember]
        public string DisciplineDesc { get; set; }

        [DataMember]
        public bool IsSelected { get; set; }
    }
}

Please help.Thanks Maya for cell validation help.

Regards,
Sulagna

3 Answers, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 23 Dec 2010, 03:07 PM
Hello sulagna,

You may define the ItemTemplate of the GridViewComboBoxColumn as demonstrated in our online documentation.
 

Greetings,
Maya
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight
0
sulagna
Top achievements
Rank 1
answered on 24 Dec 2010, 06:57 AM
Hi Maya,
I went through the online link provided.But from where are you getting "getCities" in this  ItemsSource="{Binding Source={StaticResource getCities}}" which is mentioned below.
Is that a method call?

<telerik:GridViewComboBoxColumn Header="City"
                               DisplayMemberPath="Name"
                               SelectedValueMemberPath="ID"
                               ItemsSource="{Binding Source={StaticResource getCities}}"
                               Width="*"
                               DataMemberBinding="{Binding CityID}">
   <telerik:GridViewComboBoxColumn.ItemTemplate>
       <DataTemplate>
           <Grid>
               <Grid.ColumnDefinitions>
                   <ColumnDefinition />
                   <ColumnDefinition Width="*"></ColumnDefinition>
               </Grid.ColumnDefinitions>
               <TextBlock Text="{Binding ID}"></TextBlock>
               <TextBlock Text="{Binding Name}"  Grid.Column="1"></TextBlock>
           </Grid>
       </DataTemplate>
   </telerik:GridViewComboBoxColumn.ItemTemplate>
</telerik:GridViewComboBoxColumn>

Thanks
Sulagna
0
Pavel Pavlov
Telerik team
answered on 24 Dec 2010, 03:48 PM
Hi sulagna,

I am sorry for the confusion . It seems the static resource was badly named in our docs.

It is not a method call. It is a static resource   - an instance of IEnumerable collection of City objects.
You may substitute the ItemsSource binding , with  a setting in codebehind - something like :

MyComboColumn.ItemsSource = Cities,
where Cities is a List<City>.

Regards,
Pavel Pavlov
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight
Tags
GridView
Asked by
sulagna
Top achievements
Rank 1
Answers by
Maya
Telerik team
sulagna
Top achievements
Rank 1
Pavel Pavlov
Telerik team
Share this question
or