Can't set webListBox backgroundColor?

i can’t use
on opening
'me.style.BackgroundColor = color.Gray
'me.style.ForegroundColor = color.White

on weblistbox, it won’t compile
we can’t change the background color of weblistbox ?

i’m trying bootstarp style like in xdc travis hill video, pretty cool :slight_smile: didn’t find background color change tho
thx

You can change the background color using some CSS. For example add this to the App.HTMLHeader to get a red (ugly but clearly shows the change) listbox

<style>
	.XojoListBox .DTFC_ScrollWrapper,
	.XojoListBox .table,
	.XojoListBox .dataTables_wrapper tr.buffer,
    .table-striped tbody tr:nth-of-type(odd) {
	  background-color: transparent !important;
	}
	table.dataTable thead .sorting:before, table.dataTable thead .sorting_asc:before, table.dataTable thead .sorting_desc:before, table.dataTable thead .sorting_asc_disabled:before, table.dataTable thead .sorting_desc_disabled:before {
	    content: "" !important;
	}

	table.dataTable thead .sorting:after, table.dataTable thead .sorting_asc:after, table.dataTable thead .sorting_desc:after, table.dataTable thead .sorting_asc_disabled:after, table.dataTable thead .sorting_desc_disabled:after {
	    content: "" !important;
	}
	.table-bordered,
	.table-bordered thead td, .table-bordered thead th,
	.table-bordered td, .table-bordered th,
	.dataTables_wrapper.no-footer .dataTables_scrollBody {
	  border: 0 !important;
	}
	.dataTables_wrapper.no-footer .dataTables_scrollBody {
		background: red !important;
	}
</style>
1 Like

Hi Philippe, is this (attached) what you’re trying to do, to change the bgnd of one (or more) rows within a listbox?

Screenshot 2022-05-01 at 06.18.45

thx, i’m trying dark gray layer for listbox and page trying web page colors, i’m a bit noob at page web.

i’m wondering how to prioritize beetween a theme dropped from bootswatch and code in the app.hearderhtml, and code in the opening event ot the control, thats what’s i have now.

thanks, how did you find how to write this ? from html composer ?
i have put :

This thread should help you customize the WebListBox:

This work is done using the browser’s built-in inspector and some DOM/CSS knowledge.

1 Like

Try using the Hex value of the color you want. Also, I believe darkgray should be without caps.
Oh and I’m learning form @Anthony_G_Cyphers . I learned this a while ago reading the thread Anthony just linked to.

1 Like

Just curious, is the ultimate goal to programmatically set the whole WebListBox, or are you wanting a technique that can let you set each Cell and (or) Row with unique specific Background colors? I’ve had great success using WebListBoxStyleRenderer and setting each Cell’s style on the fly. (not to take away from CSS, WebListBoxStyleRenderer just happened to be my solution path)

1 Like