不要显示"主持人"和" port"领域。请帮助找到错误。
<!--ContentPanel – поместите здесь дополнительное содержимое-->
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="10,0,14,0">
<TextBlock HorizontalAlignment="Left" Margin="10,10,0,0" TextWrapping="Wrap" Text="{Binding LocalizedResources.ConnectionName, Source={StaticResource LocalizedStrings}}" VerticalAlignment="Top"/>
<TextBox x:Name="TitleServer" HorizontalAlignment="Left" Height="72" Margin="0,37,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="446"/>
<TextBlock HorizontalAlignment="Left" Margin="11,109,0,0" TextWrapping="Wrap" Text="{Binding LocalizedResources.Host, Source={StaticResource LocalizedStrings}}" VerticalAlignment="Top"/>
<StackPanel Margin="0,130,10,436" Orientation="Horizontal">
<TextBox HorizontalAlignment="Left" x:Name="Host" TextWrapping="Wrap" Height="72" Width="345"/>
<TextBox HorizontalAlignment="Left" x:Name="Port" TextWrapping="Wrap" Height="72" Width="100" InputScope="Number"/>
</StackPanel>
<TextBlock HorizontalAlignment="Left" Margin="11,210,0,0" TextWrapping="Wrap" Text="{Binding LocalizedResources.Login, Source={StaticResource LocalizedStrings}}" VerticalAlignment="Top"/>
<TextBox x:Name="Login" HorizontalAlignment="Left" Height="72" Margin="0,236,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="446"/>
<TextBlock HorizontalAlignment="Left" Margin="11,314,0,0" TextWrapping="Wrap" Text="{Binding LocalizedResources.Password, Source={StaticResource LocalizedStrings}}" VerticalAlignment="Top"/>
<TextBox x:Name="Password" HorizontalAlignment="Left" Height="72" Margin="0,340,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="446"/>
</Grid>
答案 0 :(得分:1)
将StackPanel的visibility-property设置为Collapsed
或Hidden
。或者,如果您愿意,可以单独在每个TextBox控件上设置此属性。
<StackPanel Visibility="Collpased" Margin="0,130,10,436" Orientation="Horizontal">
<TextBox HorizontalAlignment="Left" x:Name="Host" TextWrapping="Wrap" Height="72" Width="345"/>
<TextBox HorizontalAlignment="Left" x:Name="Port" TextWrapping="Wrap" Height="72" Width="100" InputScope="Number"/>
</StackPanel>
有关MSDN属性的更多信息:
答案 1 :(得分:1)
试试这个
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="10,0,14,0">
<TextBlock HorizontalAlignment="Left" Margin="10,10,0,0" TextWrapping="Wrap" Text="{Binding LocalizedResources.ConnectionName, Source={StaticResource LocalizedStrings}}" VerticalAlignment="Top"/>
<TextBox x:Name="TitleServer" HorizontalAlignment="Left" Height="72" Margin="0,37,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="446"/>
<TextBlock HorizontalAlignment="Left" Margin="11,109,0,0" TextWrapping="Wrap" Text="{Binding LocalizedResources.Host, Source={StaticResource LocalizedStrings}}" VerticalAlignment="Top"/>
<StackPanel Margin="0,130,10,0" Orientation="Horizontal" VerticalAlignment="Top">
<TextBox HorizontalAlignment="Left" x:Name="Host" TextWrapping="Wrap" Height="72" Width="345"/>
<TextBox HorizontalAlignment="Left" x:Name="Port" TextWrapping="Wrap" Height="72" Width="100" InputScope="Number"/>
</StackPanel>
<TextBlock HorizontalAlignment="Left" Margin="11,210,0,0" TextWrapping="Wrap" Text="{Binding LocalizedResources.Login, Source={StaticResource LocalizedStrings}}" VerticalAlignment="Top"/>
<TextBox x:Name="Login" HorizontalAlignment="Left" Height="72" Margin="0,236,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="446"/>
<TextBlock HorizontalAlignment="Left" Margin="11,314,0,0" TextWrapping="Wrap" Text="{Binding LocalizedResources.Password, Source={StaticResource LocalizedStrings}}" VerticalAlignment="Top"/>
<TextBox x:Name="Password" HorizontalAlignment="Left" Height="72" Margin="0,340,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="446"/>
</Grid>
问题在于StackPanel的保证金属性。请注意,我也添加了 VerticalAlignment 属性。
实际上你只需要使用StackPanel作为ContentPanel而不是 使用Grid,这样您就可以将控件放在一个订单下面 没有任何保证金。这将更容易