lable 、 textboxes 、 grid などの複数のコントロールがある Silverlight フォーム (xaml) があります。いくつかのシナリオでは、いくつかのコントロールを非表示にする必要があります。
ctrl.Visibility = Visibility.Collapsed;
フォームからコントロールを非表示にしますが、コントロールによって消費されるスペースは縮小されません。私が欲しいのは、それらのコントロールが非表示のときに、フォームの他のコントロールが自動的にシフトアップすることです。
<controls:ChildWindow x:Class="IPVWorkbench.Views.CommentsDialog"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"
xmlns:telerikGrid="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.GridView"
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
xmlns:ipvmodel="clr-namespace:IPVWorkbench.Models"
Width="557" Height="800"
Title="Comments" xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk">
<Grid x:Name="LayoutRoot" Margin="2">
<Grid.RowDefinitions>
<RowDefinition Height="104" />
<RowDefinition Height="Auto" />
<RowDefinition Height="28" />
<RowDefinition Height="72" />
<RowDefinition Height="72" />
<RowDefinition Height="50" />
<RowDefinition Height="72" />
<RowDefinition Height="72" />
<RowDefinition Height="23" />
<RowDefinition Height="32" />
<RowDefinition Height="21*" />
</Grid.RowDefinitions>
<Button x:Name="CancelButton" Content="Cancel" Click="CancelButton_Click" Width="75" Height="23" HorizontalAlignment="Right" Margin="0,6,5,3" Grid.Row="9" TabIndex="8" />
<Button x:Name="OKButton" Content="OK" Click="OKButton_Click" Width="75" Height="23" HorizontalAlignment="Left" Margin="373,6,0,3" Grid.Row="9" TabIndex="7" />
<TextBox Height="45" HorizontalAlignment="Left" Grid.Row="3" Margin="34,0,0,11" Name="txtComments" VerticalAlignment="Bottom" Width="454" TextWrapping="Wrap" VerticalScrollBarVisibility="Auto" TabIndex="1" />
<sdk:Label Height="28" Content="Comments:" Grid.Row="3" HorizontalAlignment="Left" Margin="34,0,0,0" Name="commentsLabel" VerticalAlignment="Top" Width="120" />
<sdk:Label Height="17" Content="Trader Comments:" Grid.Row="7" HorizontalAlignment="Left" Margin="34,4,0,0" Name="traderCommentsLabel" VerticalAlignment="Top" Width="120" />
<TextBox Height="36" HorizontalAlignment="Left" Grid.Row="7" Margin="34,22,0,0" Name="traderCommentsTextBox" VerticalAlignment="Top" Width="454" TextWrapping="Wrap" VerticalScrollBarVisibility="Auto" TabIndex="5" />
<TextBlock Height="78" HorizontalAlignment="Left" Margin="34,12,0,0" Name="messageTextBox" Text="TextBlock" VerticalAlignment="Top" Width="454" />
<CheckBox Content="Is Trader Review Complete?" Height="16" Grid.Row="8" HorizontalAlignment="Left" Margin="34,4,0,0" Name="isTraderReviewCompleteCheckBox" VerticalAlignment="Top" TabIndex="6" />
<TextBox Height="40" HorizontalAlignment="Left" Grid.Row="6" Margin="34,24,0,0" Name="escalationCommentsTextBox" VerticalAlignment="Top" Width="454" TextWrapping="Wrap" VerticalScrollBarVisibility="Auto" TabIndex="4" />
<sdk:Label Content="Escalation Comments:" Height="16" Grid.Row="6" HorizontalAlignment="Left" Margin="34,4,0,0" Name="escalationCommentsLabel" VerticalAlignment="Top" Width="120" />
<ComboBox Height="23" HorizontalAlignment="Left" Grid.Row="5" Margin="34,22,0,0" Name="escalationReasonComboBox" VerticalAlignment="Top" Width="454" ItemsSource="{Binding EscalationEnum}" TabIndex="3" />
<sdk:Label Content="Escalation Reason:" Height="23" Grid.Row="5" HorizontalAlignment="Left" Margin="34,4,0,0" Name="escalationReasonLabel" VerticalAlignment="Top" Width="120" />
<TextBox Height="48" HorizontalAlignment="Left" Grid.Row="4" Margin="34,17,0,0" Name="txtUserNotes" VerticalAlignment="Top" Width="454" VerticalScrollBarVisibility="Auto" TabIndex="2" TextWrapping="Wrap" />
<sdk:Label Height="25" HorizontalAlignment="Left" Grid.Row="4" Margin="34,0,0,0" Name="userNotesLabel" VerticalAlignment="Top" Width="102" Content="User Notes:" />
<!--START: Added by Rohit Vyas for HPQC#1967-->
<sdk:Label Content="Are you sure you want to send these positions for approval?" Height="18" HorizontalAlignment="Left" Margin="34,2,0,0" Grid.Row="2" Name="lblSure" VerticalAlignment="Top" Width="454" />
<Grid x:Name="PositionNotTaken" Grid.Row="1" Visibility="Collapsed" >
<Grid.RowDefinitions>
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<sdk:Label Content="Positions That are not eligible:" Height="19" HorizontalAlignment="Left" Margin="34,2,0,0" Grid.Row="0" Name="lblpositionsNotValid" VerticalAlignment="Top" Width="285" />
<telerikGrid:RadGridView x:FieldModifier="public" x:Name="EditableGV" AutoGenerateColumns="True" Margin="34,29,25,45" Height="141">
</telerikGrid:RadGridView>
</Grid>
<!--END: Added by Rohit Vyas for HPQC#1967-->
</Grid>
</controls:ChildWindow>