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
755
Dynamically set ItemSource of ComboBoxColumn
posted

Hi there, 

I am required to fulfill a requirement where depending on a DataType value in a collection member bound to the Grid, the Itemsource for the ComboBox in the row is changed. 

A Simple example would be :

The Grid has 2 Columns. One TextColumn, one ComboBoxColumn. The object bound to the Grid is a collection of Objects containing 3 properties, string Text, Dictionary<int,string> ComboOptions, and string ComboChoice.

A User creates a new Row, and enters a Value into the TextColumn cell of the new row. 

This creates an INotifyPropertyChanged event on string Text, which updates the Dictionary<int,string> ComboOptions, and should update the combobox members on the UI with a TwoWay binding. 

The User Selects something from the ComboBox and the Value of the KVP is set on the ComboChoice Property. 

I hope that is a clear Idea of what I am trying to achieve and I look forward to reading any help you can give. 

Many thanks, 

Matt.

Parents
  • 138253
    Offline posted

    Hello Matt,

     

    Thank you for your post. I have been looking into it and I created a sample project for you with the functionality you want. Please let me know if this helps you or I have misunderstood you in some way.

     

    Looking forward for your reply.

    XamGridCombo.zip
Reply Children