Hi all
I have a user control that gives some options for a layer (include layer name and some comboboxes depend of the specific layer).
When I press a button to open the Dockpane I would like to insert this user control once for each layer in the map and fill them up.
If I have 3 layers I will insert 3 user controls into the Dockpane and if I have 5 layers - 5 user controls.
No need to get the event of adding layers, I assume the user will press the button if he change the number of layers.
Any code samples?
Thanks
Hi Mody,
I would use DataGrid in your case. I have similar situation with my workspace properties. Each property has simple value or value you can choose from combobox. Each combobox has different sets of available values. What you need is a list of custom objects with layer and other properties inside. Other things will do bindings.
You can use DataGridComboBoxColumn for columns for comboboxes or make your own template for column.
My implementation of DataGrid:
Hi Gintautas
I made a few tests but I am not able to fill each combobox in a different line with different values.
The values is determine by my program and not taking from any table.
Can you put a few lines of code?
Thanks
Hi Mody,
You need to use different templates in xaml for each combobox column. The xaml source of my previous picture is very difficult . It uses triggers and etc.. I have tried to simplify xaml but I am not really sure about bindings validity.
I got this part but the question is how do you do DataGrid.Items.Add in runtime adding different combobox values to each row.
You need to use ObservableCollection for datagrid binding and object of your collection must implement INotifyPropertyChanged. I implement IEditableObject too.
Then you create new item you must to fill StringValues and ComboValue properties too depending on your layer object.