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
Post a Comment