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
1024
combobox fiekd in xamdatagrid
posted

Hi, I need to display one column in my xamdatagrid as combobox. So far what I did is: created a field with EdtorType of XamComboEditor                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         

<

 

igDP:Field Name="SeconderyCode" Label="—…ƒ Ž™‰">                            <igDP:Field.Settings >                                                                                  <igDP:FieldSettings AllowEdit="True" CellValuePresenterStyle="{StaticResource seconderyCodeBackgroundStyle}" EditorType="{x:Type dge:XamComboEditor}" > <igDP:FieldSettings.EditorStyle>                                                                                 <Style TargetType="{x:Type dge:XamComboEditor}">                                                      <Setter Property="DropDownButtonDisplayMode" Value="Always"/>                                    <Setter Property="ItemsProvider" Value="{DynamicResourceComboEditorListSeconderyCode}"/>                                             <Setter Property="FlowDirection" Value="LeftToRight"/>                                                      <Setter Property="HorizontalAlignment" Value="Left"/>                                                      </Style>                                                                                          </igDP:FieldSettings.EditorStyle>                                    </igDP:FieldSettings>                                                                                 </igDP:Field.Settings>                                                                                                                               </igDP:Field>                                                                                                                                                                                                                                                                        I attached the ItemsProvider as you can see to a dynamic resource which I supply in code:        

 

ComboBoxItemsProvider ip = new ComboBoxItemsProvider();                                         DataTable dt = new DataTable();                                                                        dt.Columns.Add("ID", typeof(string));                                                                        dt.Columns.Add("Name", typeof(string));                                                                        dt.Rows.Add(new object[] { "", "".PadLeft(30) });                                                            dt.Rows.Add(new object[] { "NOHON", "ŒŒ€ „… "});                                                            dt.Rows.Add(new object[] { "ONLY", "Œƒ"});                                                            dt.Rows.Add(new object[] { "WITHOUT", "ŒŒ€"});                                                            dt.Rows.Add(new object[] { "MINUS", "™Œ‰Œ‰ "});                                                dt.Rows.Add(new object[] { "EXT", "Ž‰…‡ƒ"});                                                            ip.ItemsSource = dt.DefaultView;                                                                                    ip.ValuePath = "ID";                                                                                                            ip.DisplayMemberPath = "Name";                                                                        this.Resources.Add("ComboEditorListSeconderyCode", ip);                                                

ComboBoxItemsProvider ip = new ComboBoxItemsProvider();                                         DataTable dt = new DataTable();                                                                        dt.Columns.Add("ID", typeof(string));                                                                        dt.Columns.Add("Name", typeof(string));                                                                        dt.Rows.Add(new object[] { "", "".PadLeft(30) });                                                            dt.Rows.Add(new object[] { "NOHON", "ŒŒ€ „… "});                                                            dt.Rows.Add(new object[] { "ONLY", "Œƒ"});                                                            dt.Rows.Add(new object[] { "WITHOUT", "ŒŒ€"});                                                            dt.Rows.Add(new object[] { "MINUS", "™Œ‰Œ‰ "});                                                dt.Rows.Add(new object[] { "EXT", "Ž‰…‡ƒ"});                                                            ip.ItemsSource = dt.DefaultView;                                                                                    ip.ValuePath = "ID";                                                                                                            ip.DisplayMemberPath = "Name";                                                                        this.Resources.Add("ComboEditorListSeconderyCode", ip);                                                

 

                                                                                                                                                                                    Now, the issue is that I don't want to show all of the items in each record. I wnat to be able to choose which items would be displayed and which aren't in run time according to a condition in the EditModeStarting event. How can I accompish this? By the way, I'm not sure at all that the code I wrote up until now is the most appropriate for my purpose. If you have another way you belive it should be accomplished, please, tell me. Thank U!