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

telerik:RadGridView error in GridViewComboBoxColumn not visible DisplayMemberPath

2 Answers 195 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Leonardo
Top achievements
Rank 1
Leonardo asked on 10 Dec 2015, 10:33 AM

Hi, 

anyone can help me?

 

UCMasterAttendace.xaml

        <telerik:RadGridView x:Name="gridMasterAttendancePattern"
                             Grid.Column="1"
                             Grid.ColumnSpan="7"
                             Grid.Row="3"                             
                             CanUserDeleteRows="False"
                             CanUserInsertRows="False"
                             CanUserReorderColumns="False"
                             CanUserResizeColumns="False"
                             CanUserSortColumns="False"
                             CanUserFreezeColumns="False"
                             Width="Auto"
                             Height="Auto"
                             AutoGenerateColumns="False"
                             RowIndicatorVisibility="Collapsed"
                             IsFilteringAllowed="False"
                             ShowGroupPanel="False"
                             SelectionUnit="Cell"
                             SelectionMode="Single"                             
                             Margin="5,0,0,0"
                             HorizontalContentAlignment="Center">
            <telerik:RadGridView.Columns>

                <telerik:GridViewComboBoxColumn DataMemberBinding="{Binding StatoItem}"
                                                UniqueName="Stato"                                                
                                                SelectedValueMemberPath="IDStato"
                                                DisplayMemberPath="NameStato"
                                                ItemsSourceBinding="{Binding ListaStati, Mode=TwoWay}" 
                                                Width="100">
                    <telerik:GridViewComboBoxColumn.Header>
                        <TextBlock Text="{DynamicResource statusmasterattendance}" ToolTip="{DynamicResource statusmasterattendance}" HorizontalAlignment="Center" />
                    </telerik:GridViewComboBoxColumn.Header>
                </telerik:GridViewComboBoxColumn>

                <telerik:GridViewComboBoxColumn DataMemberBinding="{Binding DoorItem}"
                                                UniqueName="Door"
                                                SelectedValueMemberPath="IDDoor"                                                
                                                DisplayMemberPath="NameDoor"
                                                ItemsSourceBinding="{Binding ListaDoor, Mode=TwoWay}" 
                                                Width="100">
                    <telerik:GridViewComboBoxColumn.Header>
                        <TextBlock Text="{DynamicResource connectmasterattendance}" ToolTip="{DynamicResource connectmasterattendance}" HorizontalAlignment="Center" />
                    </telerik:GridViewComboBoxColumn.Header>
                </telerik:GridViewComboBoxColumn>               

                <telerik:GridViewComboBoxColumn DataMemberBinding="{Binding RuleItem}"
                                                UniqueName="Rule"
                                                SelectedValueMemberPath="IDRule"
                                                DisplayMemberPath="NameRule"
                                                ItemsSourceBinding="{Binding ListaRule, Mode=TwoWay}" Width="100">
                    <telerik:GridViewComboBoxColumn.Header>
                        <TextBlock Text="{DynamicResource rulemasterattendance}" ToolTip="{DynamicResource rulemasterattendance}" HorizontalAlignment="Center" />
                    </telerik:GridViewComboBoxColumn.Header>
                </telerik:GridViewComboBoxColumn>

            </telerik:RadGridView.Columns>
        </telerik:RadGridView>

 

 

UCMaterAttendace.xaml.cs

 public class MasterAttendance
        {
            public List<Stato> ListaStati { get; set; }

            public int StatoItem { get; set; }

            public List<Door> ListaDoor { get; set; }

            public int DoorItem { get; set; }

            public bool IsDoor1Programmed { get; set; }

            public bool IsButton1Enabled { get; set; }

            public bool IsDoor2Programmed { get; set; }

            public bool IsButton2Enabled { get; set; }

            public bool IsDoor3Programmed { get; set; }

            public bool IsButton3Enabled { get; set; }

            public bool IsDoor4Programmed { get; set; }

            public bool IsButton4Enabled { get; set; }

            public bool IsDoor5Programmed { get; set; }

            public bool IsButton5Enabled { get; set; }

            public bool IsDoor6Programmed { get; set; }

            public bool IsButton6Enabled { get; set; }

            public bool IsDoor7Programmed { get; set; }

            public bool IsButton7Enabled { get; set; }

            public bool IsDoor8Programmed { get; set; }

            public bool IsButton8Enabled { get; set; }

            public bool IsDoor9Programmed { get; set; }

            public bool IsButton9Enabled { get; set; }

            public bool IsDoor10Programmed { get; set; }

            public bool IsButton10Enabled { get; set; }

            public bool IsDoor11Programmed { get; set; }

            public bool IsButton11Enabled { get; set; }

            public bool IsDoor12Programmed { get; set; }

            public bool IsButton12Enabled { get; set; }

            public List<Rule> ListaRule { get; set; }

            public int RuleItem { get; set; }
        }

        public class Stato
        {
            public int IDStato { get; set; }

            public string NameStato { get; set; }
        }

        public class Door
        {
            public int IDDoor { get; set; }

            public string NameDoor { get; set; }
        }

        public class Rule
        {
            public int IDRule { get; set; }

            public string NameRule { get; set; }
        }

 

        private List<Stato> ListaStati { get; set; }

        private List<Door> ListaDoor { get; set; }

        private List<Rule> ListaRule { get; set; }

        private List<MasterAttendance> ListaMasterAttendance { get; set; }

 
        private void PopulateListaStati()
        {
            ListaStati = new List<Stato>();

            for (int i = 0; i < 2; i++)
            {
                var item = new Stato();

                item.IDStato = i;

                switch (i)
                {
                    case 0:
                        item.NameStato = this.FindResource("privacypatternstateinactive").ToString();
                        break;

                    case 1:
                        item.NameStato = this.FindResource("privacypatternstateactive").ToString();
                        break;
                }

                ListaStati.Add(item);
            }
        }

        private void PopulateListaDoor()
        {
            ListaDoor = new List<Door>();

            for (int i = 0; i < 13; i++)
            {
                var item = new Door();

                item.IDDoor = i;

                if (i == 0)
                {
                    item.NameDoor = "";
                }
                else
                {
                    item.NameDoor = "D" + i;
                }

                ListaDoor.Add(item);
            }
        }

        private void PopulateListaRule()
        {
            ListaRule = new List<Rule>();

            for (int i = 0; i < 2; i++)
            {
                var item = new Rule();

                item.IDRule = i;

                switch (i)
                {
                    case 0:
                        item.NameRule = this.FindResource("privacypatternruleunlock").ToString();
                        break;

                    case 1:
                        item.NameRule = this.FindResource("privacypatternrulelock").ToString();
                        break;
                }

                ListaRule.Add(item);
            }
        }

        private void PopulateGridPrivacyPattern()
        {
            for (int i = 0; i < 8; i++)
            {
                var item = new MasterAttendance();

                item.IsButton1Enabled = true;
                item.IsButton2Enabled = true;
                item.IsButton3Enabled = true;
                item.IsButton4Enabled = true;
                item.IsButton5Enabled = true;
                item.IsButton6Enabled = true;
                item.IsButton7Enabled = true;
                item.IsButton8Enabled = true;
                item.IsButton9Enabled = true;
                item.IsButton10Enabled = true;
                item.IsButton11Enabled = true;
                item.IsButton12Enabled = true;

                item.ListaStati = ListaStati;
                item.StatoItem = 0;
                item.ListaDoor = ListaDoor;
                item.DoorItem = 0;
                item.ListaRule = ListaRule;
                item.RuleItem = 0;

                ListaMasterAttendance.Add(item);
            }

            gridMasterAttendancePattern.ItemsSource = ListaMasterAttendance;
        }

 

Output in image

 

Thank you

Leonardo

 




2 Answers, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 14 Dec 2015, 04:52 PM
Hello Leonardo,

Can you please take a look at RadGridView's documentation on ComboBox Column, as the proper usage of the control is demonstrated in it? You can also check out the ComboBox Column, ComboBox Column ItemsSource Binding SDK Examples using the SDK Samples Browser. Particularly for difficulties on Bindng GridViewComboBoxColumn I suggest you taking a look at this, this and this forum threads.

I hope you will find the provided resources helpful.

Best Regards,
Stefan X1
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Leonardo
Top achievements
Rank 1
answered on 15 Dec 2015, 10:17 AM

Hi Stefan,

thanks for the reply, 

I try solutions.

 

 Best Regards,

Leonardo

Tags
GridView
Asked by
Leonardo
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Leonardo
Top achievements
Rank 1
Share this question
or