Notifications
Clear all

[Closed] Color text in ListBox

Hey guys!
I want to bring up an old topic.
How can I change the color of a row in listbox depending on its content? For example, if the string contains “blablabla”, then it is blue, if it does not contain – green

3 Replies

There is a solution for color by index,

brush = if mod arg.index 2 == 0 then brushes.Red else brushes.Orange

but I’m interested in the content of the string and here I’m stuck

1 Reply
(@serejah)
Joined: 11 months ago

Posts: 0

get item contents and check whatever you need

brush = if MatchPattern dnListBox.items.item[arg.index] pattern:"*a*" then brushes.Red else brushes.Black -- alternate between red and black

any item containing ‘a’ char is red now
%D0%B8%D0%B7%D0%BE%D0%B1%D1%80%D0%B0%D0%B6%D0%B5%D0%BD%D0%B8%D0%B5

Great, man! Thanks!
Every time everything turns out to be easier than i think!