hello everybody,

can you do something like this:
dim x as integer=1
button_x.visibility=Windows.Visibility.Hidden

i have about 24 buttons on my form that i need to change the visibility for.
which buttons need to be changes - is a variable i get from database query.
so i'll get several rows of numbers like this:
1
12
15
20

and will need to change all those buttons' visibility.
i thought i'd make a loop that goes through each row and change the button of that number.

thanks a lot!

   Sub SetVisibility()
      Dim i As Int32 = 1
      CType(Me.FindName("Button_" & i.ToString), Control).Visibility = Windows.Visibility.Hidden
   End Sub

can i ask sometnig else about the buttons?
when i disable a button it greys out, naturaly
but is there a way to disable the button with out greying it out?

because that button has an image as backround and it should stay as it was, even when it's not clickable

thanks :)

I do not use WPF much, but I believe the "IsHitTestVisible" property is the one that you want to set to false and not the "IsEnabled" property.

works!!
thank you so much :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.