Home Forums WPF controls Xceed DataGrid for WPF fill combo in codebehind

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #22860 |

    How to fill a combo by codebehind without xaml ?

    Imported from legacy forums. Posted by xpel1 (had 3350 views)

    Xceed Support
    Member
    Post count: 5658

    Try the ComboBox.Loaded event.

    Imported from legacy forums. Posted by Marcus [Xceed] (had 229 views)

    User (Old forums)
    Member
    Post count: 23064

    the load combobox event do not exists , i am trying to convert a simple column in a combobox column from codebehind, and I am trying to fill this combobox with a simple strings, too.
    Thanks for your answer.

    Imported from legacy forums. Posted by xpel1 (had 272 views)

    Xceed Support
    Member
    Post count: 5658

    While the event is not originally created on the ComboBox class, it is still present, inherited from the FrameworkElement base class.

    However, based on your second description, it appears that what you need to do is to create a CellEditor and its EditTemplate in code-behind and assign the CellEditor to your simple column.

    Building a DataTemplate from code-behind requires usage of the FrameworkElementFactory class.

    Imported from legacy forums. Posted by Marcus [Xceed] (had 211 views)

    User (Old forums)
    Member
    Post count: 23064

    Is there an example using this code ? i am triying this but not works:

    Dim resoruceDic As New System.Windows.ResourceDictionary
    resoruceDic.Add(“1”, “a”)
    resoruceDic.Add(“2”, “b”)
    resoruceDic.Add(“3”, “c”)

    Dim Dt As New DataTemplate
    Dt.Resources = resoruceDic
    Dim cEditor As New Xceed.Wpf.DataGrid.CellEditor

    cEditor.EditTemplate = Dt
    Me.grid.Columns(5).CellContentTemplate = Dt
    Me.grid.Columns(5).CellEditor = cEditor

    Imported from legacy forums. Posted by xpel1 (had 4508 views)

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.