I wonder if it's possible to load ~70 buttons into WrapPanel
better way that I'm using now.
At this momment it works like:
I have table in DB, columns: productID
, productName
(which represent 70 buttons to load, so there is always 70 rows).
Now in loop, using SqlDataReader
I'm reading:
product.price (from table Product), barcode (from table Barcode) where Product.productID = myTableWithButtons.productID
If exist then:
using class to create button
returnButton(int productID, string picturePath, decimal price)
I'm returning button created from WrapPanel
, 2 textblocks and (if exist) picture inside.
If not exist - insert empty button without any text etc, and set it invisible.
Now tests: in core2 pc with 4 gb ram - tooks 0,91 sec to load in D525 processor, 2gb ram - tooks 4-5 sec to load.
Is there any way to load and insert buttons into WrapPanel
?
Maybe some List<buttons>
would be faster?
Every button have style in Resources file - gradient brush, WrapPanel
with textBlocks
as content etc.
Thanks for any reply! Regards