Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 UI ComboBox in DatagridColumn

I crate a DataGrid and I want to insert for every row in the third column a ComboBox. I am so far til now:

def getUIContent():
   my_toolProperty = sdk.ToolPropertyContainer()   

   # Define UI
   my_toolProperty.ToolPropertyContent = getCustomToolPropertyContent()
   # Update Grid
   return my_toolProperty
def getCustomToolPropertyContent():

   # Create a Grid
   my_Grid = WPFControls.Grid()

   # Add 1 Row and One Column
   # Create a DataGrid
   global myDataGrid
   myDataGrid = WPFControls.DataGrid()
   # global myComboBox
   myComboBox = WPFControls.DataGridComboBoxCollumn()

   # Add the DataGrid to the Grid 

   # Return the Grid   
   return my_Grid

# def UpdateData (it's only the Path of api / not important)

def UpdateDataGridView():

   # Retrieve grid results
   grid = sdk.getScriptFunctionReturnData()

   # Create table
   data_table = WPFData.DataTable("Contents")
   data_table.Columns.Add("Last Name")
   # Add data to the table for each name
   parts = grid['Name']
   for name in names:      
      data_table.Rows.Add(part['prename'], part['lastname'])
   # Set the IetmsSource for the data grid to the DataTable 
   myDataGrid.ItemsSource = data_table.DefaultView
   # myDataGrid.ItemsSource = myComboBox     ??? 
   # Position the DataGrid in the first row, column of the Grid
   WPFControls.Grid.SetRow(myDataGrid, 0)
   WPFControls.Grid.SetColumn(myDataGrid, 0)

Two things (1) a MRE (Minimal Reproducible Example) will help you get a faster answer -- aka if one can just copy and paste what you provided and run it the answers are much faster in coming and more accurate in their response.

(2) What are you using for your Gui -- Tkinter, PyQt, etc... this should be in your subject so that folks that are in the know about what you are asking about know that this is a item they can reply to
silly American kah-nig-hit

Top Page

Forum Jump:

Users browsing this thread: 1 Guest(s)