English 中文(简体)
XAML Layout是WP7.5中的任何内容。
原标题:XAML Layout is TextWrapping Nothing in WP7.5

I ve 陷入一个奇怪的问题,一些XAML配置在Windows Telephone银灯上。 基本上,我会利用我自己的子弹点,在信.的电网中制造一些文字箱。 问题是,第一个子弹点(见下文)没有明显的理由,有扩展的文本箱。 它看不出案文。 见第一点点以下的间隔。 你也注意到,这削减了第三颗子弹的某些案文:

INCORRECT LAYOUT:

“incorrectout”/

此处为<代码><Canvas/>所有文本和子弹点的标的:

  <Canvas Canvas.Left="20.21" Canvas.Top="66" Width="775.96" Height="224.17">
    <Grid Canvas.Top="3.6" Canvas.Left="7.2" Width="762.06" Height="216.97">
      <Grid VerticalAlignment="Top">
        <Grid.RowDefinitions>
          <RowDefinition Height="Auto" />
          <RowDefinition Height="Auto" />
          <RowDefinition Height="Auto" />
          <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <Grid Grid.Row="0">
          <TextBlock LineHeight="21.6" LineStackingStrategy="BlockLineHeight" TextWrapping="Wrap" TextAlignment="Left" Foreground="#FFFFFF" FontFamily="Segoe WP" FontSize="18">
            <Run Text="The Ribbon bar in PowerPoint 2007 and 2010 replaces the menu bar in previous versions. It is designed to provide quick access to the most common features used in PowerPoint." />
          </TextBlock>
        </Grid>
        <Grid Grid.Row="1" Margin="0 0 0 6">
          <Grid.ColumnDefinitions>
            <ColumnDefinition Width="0" />
            <ColumnDefinition Width="22.5" />
            <ColumnDefinition />
          </Grid.ColumnDefinitions>
          <Grid Grid.Column="1">
            <Grid.RowDefinitions>
              <RowDefinition Height="Auto" />
              <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>
            <TextBlock Grid.Row="0" LineHeight="15.12" Foreground="#D80073" FontFamily="Wingdings" FontSize="12.6" LineStackingStrategy="BlockLineHeight">
              <Run Text="" />
            </TextBlock>
          </Grid>
          <TextBlock Grid.Column="2" LineHeight="19.2" LineStackingStrategy="BlockLineHeight" TextWrapping="Wrap" TextAlignment="Left" Foreground="#FFFFFF" FontFamily="Segoe WP">
            <Run Text="The " FontSize="16" /><Run Text="R" FontSize="16" /><Run Text="ibbon is " FontSize="16" /><Run Text="made up of various tabs that provide a fast way of performing tasks. For example, if you need to insert a picture, you click the " FontSize="16" /><Run Text="Insert" FontSize="16" FontWeight="Bold" /><Run Text=" tab and then picture. If you need to create an animation, you click on the " FontSize="16" /><Run Text="Animations" FontSize="16" FontWeight="Bold" /><Run Text=" tab and then, with any object selected, simply select the animation you prefer." FontSize="16" />
          </TextBlock>
        </Grid>
        <Grid Grid.Row="2" Margin="0 0 0 6">
          <Grid.ColumnDefinitions>
            <ColumnDefinition Width="0" />
            <ColumnDefinition Width="22.5" />
            <ColumnDefinition />
          </Grid.ColumnDefinitions>
          <Grid Grid.Column="1">
            <Grid.RowDefinitions>
              <RowDefinition Height="Auto" />
              <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>
            <TextBlock Grid.Row="0" LineHeight="15.12" Foreground="#D80073" FontFamily="Wingdings" FontSize="12.6" LineStackingStrategy="BlockLineHeight">
              <Run Text="" />
            </TextBlock>
          </Grid>
          <TextBlock Grid.Column="2" LineHeight="19.2" LineStackingStrategy="BlockLineHeight" TextWrapping="Wrap" TextAlignment="Left" Foreground="#FFFFFF" FontFamily="Segoe WP">
            <Run Text="Some " FontSize="16" /><Run Text="R" FontSize="16" /><Run Text="ibbon " FontSize="16" /><Run Text="bars are contextual – meaning they only appear when you’ve selected the corresponding object. The Drawing (shape), Picture (image) and Table (table) tabs become available and highlighted when you’ve selected those objects." FontSize="16" />
          </TextBlock>
        </Grid>
        <Grid Grid.Row="3" Margin="0 0 0 6">
          <Grid.ColumnDefinitions>
            <ColumnDefinition Width="0" />
            <ColumnDefinition Width="22.5" />
            <ColumnDefinition />
          </Grid.ColumnDefinitions>
          <Grid Grid.Column="1">
            <Grid.RowDefinitions>
              <RowDefinition Height="Auto" />
              <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>
            <TextBlock Grid.Row="0" LineHeight="15.12" Foreground="#D80073" FontFamily="Wingdings" FontSize="12.6" LineStackingStrategy="BlockLineHeight">
              <Run Text="" />
            </TextBlock>
          </Grid>
          <TextBlock Grid.Column="2" LineHeight="19.2" LineStackingStrategy="BlockLineHeight" TextWrapping="Wrap" TextAlignment="Left" Foreground="#FFFFFF" FontFamily="Segoe WP">
            <Run Text="Also" FontSize="16" /><Run Text=", when your PowerPoint application is resized, the Ribbon will minimize or display buttons. This means that the command is still available, but it may look and act slightly different" FontSize="16" /><Run Text="." FontSize="16" />
          </TextBlock>
        </Grid>
      </Grid>
    </Grid>
  </Canvas>

XAML网页(UserControl)和图片的全文载于DropBox

我找到了两种手法确定这一点:

  1. From the first bullet text, remove any three letters. This causes the bottom spacing to be removed. This is a bit weird though as the text in line #2 of the first bullet extends to the width of the grid and in the 3rd one doesn t come as close, so it doesn t make sense why this would "fix" the issue.
  2. Put a <RowDefinition Height="*" /> on the second row in the first grid instead of <RowDefinition Height="Auto" />. This is unpredictable though - if I set it to * for other rowes, it mis-sizes again. I m doing this coding from automation, so I won t be able to predict a problematic row unless I know exactly what the problem may be in advance in order to set it as * instead of Auto.

如果加以正确表述(采用上文第2号):

CORRECT LAYOUT

“correctutou”/

是否有任何人知道,在这种“打破文字总结无所作为”和如何确定/预测这种说法究竟有什么错误?

问题回答

我不敢肯定,为什么你需要<条码>。 Grid。

<Canvas Canvas.Left="20.21" Canvas.Top="66" Width="775.96" Height="224.17">

我下载了你的档案,删除了<代码>Canvas,并修改了内文本。 Grid 具有类似特性,

<Grid Canvas.Top="70" Canvas.Left="27" MaxWidth="762.06">

你可以看到我删除了<代码>H8,这确定了你的第二个问题。 <代码>Grid的长度不足以显示所有文本。

另一项改动由<代码>Width改为MaxWidth,这样,<代码>Width现在就具有自动尺寸,如果您对项目进行重新校正,请见prefer.。 现在是第二行,完全填补这一空白。

I think the real problem is once you give TextBlock a fixed Width, first it thinks the word prefer. needs to go to the next line but because the Width is a fixed value it somehow still squeezes it at the end of the line. To avoid this, you probably want to make the Width auto-sized.

我可能错了,但希望这可能是任何帮助。

在某种程度上,所有这些固定价值观的结合造成ping不平。 我的建议解决了放弃问题,同时维护了大多数这些价值观。 在上作了说明和下载。

每一组子弹点和替换2个<代码>的案文均使用1个<代码>DockPanel。 Grid前使用:

<Canvas Canvas.Left="20.21" Canvas.Top="66" Width="775.96" Height="224.17">
    <Grid Canvas.Top="3.6" Canvas.Left="7.2" Width="762.06" Height="216.97">
        <Grid VerticalAlignment="Top">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>
            <Grid Grid.Row="0">
                <TextBlock LineHeight="21.6" LineStackingStrategy="BlockLineHeight" TextWrapping="Wrap" TextAlignment="Left" Foreground="#FFFFFF" FontFamily="Segoe WP" FontSize="18">
                    <Run Text="The Ribbon bar in PowerPoint 2007 and 2010 replaces the menu bar in previous versions. It is designed to provide quick access to the most common features used in PowerPoint." />
                </TextBlock>
            </Grid>
            <my:DockPanel Grid.Row="1" HorizontalAlignment="Left" Name="dockPanel1" VerticalAlignment="Top" Margin="0 0 0 6">
                <TextBlock Width="22.5" LineHeight="15.12" Foreground="#D80073" FontFamily="Wingdings" FontSize="12.6" LineStackingStrategy="BlockLineHeight">
                    <Run Text="" />
                </TextBlock>
                <TextBlock LineHeight="19.2" LineStackingStrategy="BlockLineHeight" TextWrapping="Wrap" TextAlignment="Left" Foreground="#FFFFFF" FontFamily="Segoe WP">
                    <Run Text="The " FontSize="16" /><Run Text="R" FontSize="16" /><Run Text="ibbon is " FontSize="16" /><Run Text="made up of various tabs that provide a fast way of performing tasks. For example, if you need to insert a picture, you click the " FontSize="16" /><Run Text="Insert" FontSize="16" FontWeight="Bold" /><Run Text=" tab and then picture. If you need to create an animation, you click on the " FontSize="16" /><Run Text="Animations" FontSize="16" FontWeight="Bold" /><Run Text=" tab and then, with any object selected, simply select the animation you prefer." FontSize="16" />
                </TextBlock>
            </my:DockPanel>
            <my:DockPanel Grid.Row="2" HorizontalAlignment="Left" Name="dockPanel2" VerticalAlignment="Top" Margin="0 0 0 6">
                <TextBlock Width="22.5" LineHeight="15.12" Foreground="#D80073" FontFamily="Wingdings" FontSize="12.6" LineStackingStrategy="BlockLineHeight">
                    <Run Text="" />
                </TextBlock>
                <TextBlock LineHeight="19.2" LineStackingStrategy="BlockLineHeight" TextWrapping="Wrap" TextAlignment="Left" Foreground="#FFFFFF" FontFamily="Segoe WP">
                    <Run Text="Some " FontSize="16" /><Run Text="R" FontSize="16" /><Run Text="ibbon " FontSize="16" /><Run Text="bars are contextual – meaning they only appear when you ve selected the corresponding object. The Drawing (shape), Picture (image) and Table (table) tabs become available and highlighted when you ve selected those objects." FontSize="16" />
                </TextBlock>
            </my:DockPanel>
            <my:DockPanel Grid.Row="3" HorizontalAlignment="Left" Name="dockPanel3" VerticalAlignment="Top" Margin="0 0 0 6">
                <TextBlock Width="22.5" LineHeight="15.12" Foreground="#D80073" FontFamily="Wingdings" FontSize="12.6" LineStackingStrategy="BlockLineHeight">
                    <Run Text="" />
                </TextBlock>
                <TextBlock Grid.Column="2" LineHeight="19.2" LineStackingStrategy="BlockLineHeight" TextWrapping="Wrap" TextAlignment="Left" Foreground="#FFFFFF" FontFamily="Segoe WP">
                    <Run Text="Also" FontSize="16" /><Run Text=", when your PowerPoint application is resized, the Ribbon will minimize or display buttons. This means that the command is still available, but it may look and act slightly different" FontSize="16" /><Run Text="." FontSize="16" />
                </TextBlock>
            </my:DockPanel>
        </Grid>
    </Grid>
</Canvas>

这个小组可能还适合其他部分的工作。





相关问题
Silverlight Rich text box control

Our team decided that we need our own custom Rich text box control for Silverlight app we are developing. We looked at existing controls mentioned at A good rich text control for Silverlight but ...

Silverlight ImageBrush not rendering (with Bing Map Control)

I m trying to add an image to a Pushpin instance from the Silverlight Bing Map Control, but I can t seem to get it to render (the pushpin renders fine). This is probably a general WPF question rather ...

Silverlight OpenFileDialog DoEvents equivalent

I m processing large files after they are selected by the user. My code looks like the following: if (FileDialog.ShowDialog() == true) { // process really big file } This freezes up the UI so ...

list of controls with templates in silverlight

Does anyone know where to find a list of controls that you can set the template on in Silverlight? I ve wasted several hours now trying to create control templates only to find that the control doesn ...

Silverlight, Updating the UI during processing

I have a simple silverlight multifile upload application, and i want to provide the user with some feedback, right now its only in a test phase and i dont have the webservice. Somehow i cant get the ...

Silverlight 3 - FindName returns null

This looks a bug to me.. Using Silverlight 3 and i have a user control defined in XAML and trying to access the object during runtime returns a null. <Grid> <common:CommonGridEditPanel x:...

silverlight 3 collection binding

Someone please help me understand why this binding does not work... I have a class called SelectionManager with a property called dates which is populated by a WCF service. The property is an ...

热门标签