Group framework elements to apply property

Butachan 21 Reputation points

Hi, I have many textbox that I want to control (change visibility) programmaticaly.
But I can not find a good way to do it.
So for now my cs contains this outrageous code:

                     lab_code.Visibility = Visibility.Visible;  
                    lab_destinataire.Visibility = Visibility.Visible;  
                    Form_code.Visibility = Visibility.Visible;  
                    Form_destinataire.Visibility = Visibility.Visible;  
                    Titre_clients.Visibility = Visibility.Visible;  
                    lab_traffic.Visibility = Visibility.Visible;  
                    Form_trafic.Visibility = Visibility.Visible;  
                    Form_bgpcli.Visibility = Visibility.Visible;  
                     lab_plat.Visibility = Visibility.Collapsed;  
                    Form_plateforme.Visibility = Visibility.Collapsed;  

I'd like to put them together (like giving the same css class name) then change their property pls

A language based on Extensible Markup Language (XML) that enables developers to specify a hierarchy of objects with a set of properties and logic.
778 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Hui Liu-MSFT 47,101 Reputation points Microsoft Vendor

    Hi,@Butachan .Welcome Microsoft Q&A.
    You could bind the first 8 text boxes to property MyVisibility and the last two text boxes to property MyVisibility1 . Here is sample code

    complete code:


    The result:
    designer screenshot.

    screenshot of initial value.


    Screenshot of the modified value.



    If the response is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

  2. Butachan 21 Reputation points

    I finally used ohter methods that are easier but less adjustable

    1) wrap the elements in a grid

    2) use a foreach( control texb in ...)


    0 comments No comments