Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/unity3d/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Xaml WP8文本块高度_Xaml_Windows Phone 8_Windows Phone_Textblock - Fatal编程技术网

Xaml WP8文本块高度

Xaml WP8文本块高度,xaml,windows-phone-8,windows-phone,textblock,Xaml,Windows Phone 8,Windows Phone,Textblock,我在MainPage.xaml上有一些TextBlock,它们之间的距离很小,看起来很均匀。但是,最后一个文本框更大,允许对文本进行包装。我面临的问题是,当我用大量内容填充文本框时,所有的文本块似乎彼此粘着 要解释的图像: 左边的图像很好,但正如你在右边的图像中看到的,当我完全填充这个框时,所有的文本块都神奇地粘在一起 标记: <ScrollViewer x:Name="LayoutRoot" Background="Transparent"> <Grid>

我在MainPage.xaml上有一些TextBlock,它们之间的距离很小,看起来很均匀。但是,最后一个文本框更大,允许对文本进行包装。我面临的问题是,当我用大量内容填充文本框时,所有的文本块似乎彼此粘着

要解释的图像:

左边的图像很好,但正如你在右边的图像中看到的,当我完全填充这个框时,所有的文本块都神奇地粘在一起

标记:

<ScrollViewer x:Name="LayoutRoot" Background="Transparent">
    <Grid>
        <!--TitlePanel contains the name of the application and page title-->
        <StackPanel Grid.Row="0" Margin="12,17,0,635">
            <TextBlock Text="Project" Style="{StaticResource PhoneTextNormalStyle}"/>
            <TextBlock Text="Project" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
        </StackPanel>

        <Grid x:Name="ContentPanel" Margin="12,161,12,0">

            <toolkit:ListPicker x:Name="myObj" ItemsSource="{Binding myobj, ElementName=this, Mode=OneTime}" Margin="12,12,12,537" >
                <toolkit:ListPicker.ItemTemplate>
                    <DataTemplate>
                        <StackPanel>
                            <TextBlock Text="{Binding Name, Mode=OneTime}" FontSize="{StaticResource PhoneFontSizeSmall}"/>
                            <TextBlock Text="{Binding Id, Mode=OneTime}" FontSize="{StaticResource PhoneFontSizeSmall}" Visibility="Collapsed"/>
                        </StackPanel>
                    </DataTemplate>
                </toolkit:ListPicker.ItemTemplate>
                <toolkit:ListPicker.FullModeItemTemplate>
                    <DataTemplate>
                        <StackPanel>
                            <TextBlock Text="{Binding Name, Mode=OneTime}" Padding="5" FontSize="{StaticResource PhoneFontSizeLarge}"/>
                            <TextBlock Text="{Binding Id, Mode=OneTime}" FontSize="{StaticResource PhoneFontSizeSmall}" Visibility="Collapsed"/>
                        </StackPanel>
                    </DataTemplate>
                </toolkit:ListPicker.FullModeItemTemplate>
            </toolkit:ListPicker>
            <toolkit:PhoneTextBox Height="auto" Name="txtName" Margin="0,70,0,456" Hint="Name" Text="{Binding Name, Mode=TwoWay}" LostFocus="TxtName_OnLostFocus"/>
            <toolkit:PhoneTextBox Height="auto" Name="txtAddress" Margin="0,138,0,388" Hint="First Line of Address" Text="{Binding Address, Mode=TwoWay}" LostFocus="TxtAddress_OnLostFocus"/>
            <toolkit:PhoneTextBox Height="auto" Name="txtEmail" Margin="0,206,0,320" Hint="Email Address" Text="{Binding Email, Mode=TwoWay}" LostFocus="TxtEmail_OnLostFocus"/>
            <toolkit:PhoneTextBox Height="auto" Name="txtTelephone" Margin="0,274,0,252" Hint="Telephone" Text="{Binding Telephone, Mode=TwoWay}" LostFocus="TxtTelephone_OnLostFocus"/>
            <toolkit:PhoneTextBox Height="auto" Name="txtComments" Margin="0,340,0,71" Hint="Comments" TextWrapping="Wrap"/>
        </Grid>
    </Grid>
</ScrollViewer>


有人看到明显的问题了吗?

我通过将文本块上的
Height=“auto”
替换为
Height=“80”
解决了这个问题。

我想问题在于你的边距。而且XAML的效率也不高

你为什么不把行添加到你的网格中,把每个文本框放在它自己的行中呢?这将帮助你避免硬编码边距,这将导致结果混乱

或者另一种方法是将everuthing放入垂直堆栈面板中