wpf - 2 elements in a grid cell -
i replace dynamically label dropdownlist , checkbox in cell in grid this
private sub replaceuielementingrid(byval newuielement uielement, byval uielementtoreplace uielement, byval gridtoaddnewuielement grid) if gridtoaddnewuielement.children.contains(uielementtoreplace) grid.setrow(newuielement, grid.getrow(uielementtoreplace)) grid.setcolumn(newuielement, grid.getcolumn(uielementtoreplace)) dim pos integer = gridtoaddnewuielement.children.indexof(uielementtoreplace) gridtoaddnewuielement.children.removeat(pos) gridtoaddnewuielement.children.add(newuielement) try dim label label = directcast(uielementtoreplace, label) if (label.name.contains("activity")) dim checkbox checkbox checkbox = new checkbox() checkbox.content = "direction" checkbox.horizontalalignment = windows.horizontalalignment.right 'dim uicheckbox uielement = directcast(checkbox, uielement) grid.setrow(checkbox, grid.getrow(uielementtoreplace)) grid.setcolumn(checkbox, grid.getcolumn(uielementtoreplace)) gridtoaddnewuielement.children.add(checkbox) addhandler checkbox.click, addressof filtrerdropdownactiviteevent end if catch ex exception end try end if end sub
the problem checkbox on dropdown. tried checkbox.horizontalalignment = windows.horizontalalignment.right
dropdown takes cell width.
all want dropdown @ left , checkbox @ right can't figure how it
thank you
here final version
private sub replaceuielementingrid(byval newuielement uielement, byval uielementtoreplace uielement, byval gridtoaddnewuielement grid) if gridtoaddnewuielement.children.contains(uielementtoreplace) dim panel wrappanel = new wrappanel grid.setrow(panel, grid.getrow(uielementtoreplace)) grid.setcolumn(panel, grid.getcolumn(uielementtoreplace)) dim pos integer = gridtoaddnewuielement.children.indexof(uielementtoreplace) gridtoaddnewuielement.children.removeat(pos) panel.children.add(newuielement) try dim label label = directcast(uielementtoreplace, label) if (label.name.contains("activity")) dim checkbox checkbox checkbox = new checkbox() checkbox.content = "direction" 'checkbox.horizontalalignment = windows.horizontalalignment.right 'dim uicheckbox uielement = directcast(checkbox, uielement) panel.children.add(checkbox) addhandler checkbox.click, addressof filtrerdropdownactiviteevent end if catch ex exception end try gridtoaddnewuielement.children.add(panel) end if end sub
wrap grid or panel type around dropdown , checkbox. format it, , replace label grid (or whatever).
edit:
just more specific, end this:
<grid> <combobox /> <checkbox /> </grid>
but should go this:
<grid> <grid> <grid.columndefinitions> <columndefinition width=".50" /> <columndefinition width=".50" /> </grid.columndefinitions> <combobox grid.column="0" /> <checkbox grid.column="1" /> </grid> </grid>
Comments
Post a Comment