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

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
   UpdateDataGridData()
   
   return my_toolProperty
def getCustomToolPropertyContent():

   # Create a Grid
   my_Grid = WPFControls.Grid()

   # Add 1 Row and One Column
   my_Grid.RowDefinitions.Add(WPFControls.RowDefinition())
   my_Grid.ColumnDefinitions.Add(WPFControls.ColumnDefinition())
  
   # Create a DataGrid
   global myDataGrid
   myDataGrid = WPFControls.DataGrid()
   
   # global myComboBox
   myComboBox = WPFControls.DataGridComboBoxCollumn()

   
   # Add the DataGrid to the Grid 
   my_Grid.Children.Add(myDataGrid)

   # Return the Grid   
   return my_Grid

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

@apex_sdk.errorhandler
def UpdateDataGridView():

   # Retrieve grid results
   grid = sdk.getScriptFunctionReturnData()

   # Create table
   data_table = WPFData.DataTable("Contents")
   data_table.Columns.Add("Prename")
   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)
Reply


Messages In This Thread
UI ComboBox in DatagridColumn - by BollerwagenIng - Aug-30-2019, 11:04 AM
RE: UI ComboBox in DatagridColumn - by Denni - Sep-03-2019, 02:27 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  [PyQt] How can I sync Combobox index to other combobox index? nickzsche 2 2,369 Jan-03-2022, 12:29 PM
Last Post: Axel_Erfurt

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020