I want to create a WPF Window with four buttons namely "Yes", "No", "Yes To All" and "No to All". In some cases I would need only "Yes" and "No" buttons. One way is to hide the other two buttons, change the window size and reposition the "Yes" and "No" buttons, another way is to create two windows in WPF. Once containing only "Yes" and "No" buttons and the another one with all the four buttons and launch the specific window as per the requirement. I dont want to create any other window. Is there any way using which I can achieve this with only one window and skip the reositioning of controls, may be some panel or something, I am not sure.
2 Answers
Make a panel and when u need it make the panel visible, when u don't need it you make the panel invisible.Visibilty.Collapsed
You could also use a stackpanel TUTORIAL
There are a lot of solutions to this question, just pick the right one suitable for your specific application.
Comments
You could use a StackPanel to layout the buttons. The visible buttons will be aligned correctly if the other buttons are hidden and collapsed.