c# - How to remove a control from window programmatically? -


i have window button in it, , need remove or not depending on argument passed window:

    public mainwindow(bool removecontrol)     {         initializecomponent();         if (removecontrol)         {             //code remove button         }     } 

in xaml file declare normal button:

<button width="120" height="25" content="click" name="clickbutton"></button> 

i know can done doing reverse thing means add button depending of boolean parameter, need so.

you can do:

mybutton.visibility = visibility.collapsed; 

...or if want removed "logical tree"...then depends "container"/parent button in, in how remove it.


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -