Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Have you considered setting the visibility of the TextBoxes to <code>Hidden</code>? This will "hide" the space that is assigned for the TextBoxes. Assuming their are no other controls in the StackPanel, then it will not be visible.</p> <p>Of course, this solution may make some naive assumptions about your implementation.</p> <p>If you need the more complex scenario, I would attempt the following: Note: This is psuedocode - may not compile..</p> <p>1) Use a MultiBinding</p> <pre><code>&lt;StackPanel&gt; &lt;StackPanel.Visibility Converter={StaticResource visibilityConverter}&gt; &lt;MultiBinding.Bindings&gt; &lt;Binding ElementName="textBox1" Path="Visibility" /&gt; &lt;Binding ElementName="textBox2" Path="Visibility" /&gt; &lt;Binding ElementName="textBox3" Path="Visibility" /&gt; &lt;/MultiBinding.Bindings&gt; &lt;/StackPanel.Visibility&gt; &lt;/StackPanel&gt; </code></pre> <p>2) Declare the Converter</p> <pre><code>&lt;Window.Resources&gt; &lt;local:VisibilityConverter x:Key="visibilityConverter" /&gt; &lt;/Window.Resources&gt; </code></pre> <p>3) Define the Converter</p> <pre><code>public class VisibilityConverter : IMultiValueConverter { public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) { Visibility text1Vis = (Visibility)values[0]; Visibility text2Vis = (Visibility)values[1]; Visibility text3Vis = (Visibility)values[2]; if (text1Vis == text2Vis == text3Vis == Visibility.Collapsed) return Visibility.Collapsed; return Visibility.Visible; } } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload