1

この背後にある問題を理解するのを手伝ってください。修正です。テキスト表示で必要な動作を得るのにかなりの問題があります。

特定の長さの文字列では、TextBlock はラップアラウンドしますが、2 行目を表示するようにコントロールを更新しないため、テキストの一部が消えてしまいます。

これは XamlPad では正常に機能しますが、Silverlight 3 および Expression blend 3 では機能しません。

<Grid x:Name="LayoutRoot" Background="{x:Null}">
    <Grid.RowDefinitions>
        <RowDefinition Height="Auto"/>
        <RowDefinition Height="Auto"/>
    </Grid.RowDefinitions>
    <Grid.ColumnDefinitions>
        <ColumnDefinition Width="Auto"/>
        <ColumnDefinition Width="Auto"/>
    </Grid.ColumnDefinitions>
<Border CornerRadius="20,20,20,20" Grid.ColumnSpan="2" Grid.RowSpan="2" BorderBrush="#FF000000" BorderThickness="1,1,1,1">
    <Border.Background>
        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
            <GradientStop Color="#FF2100FF"/>
            <GradientStop Color="#FFFFFFFF" Offset="1"/>
        </LinearGradientBrush>
    </Border.Background>
</Border>

<TextBlock x:Name="eventName" Grid.Column="1" Text="Amazing Music" FontSize="24" Margin="5,5,10,5" HorizontalAlignment="Left" VerticalAlignment="Top" Padding="0,0,0,0"/>
<TextBlock x:Name="eventDescription" Grid.Column="1" Grid.Row="1" Text="Amazin music in that house" TextWrapping="Wrap" FontSize="14" Margin="5" HorizontalAlignment="Left" VerticalAlignment="Top" MaxWidth="300" />
</Grid>
4

2 に答える 2

1

ブラウリオは何かに夢中になっていると思います。スタックパネルのテキストをボーダーでラップすることで、正しくラップしてサイズを調整することができました。この XAML を、幅と高さが設定されていない新しいユーザー コントロールにドロップします。

<Border CornerRadius="20,20,20,20" BorderBrush="#FF000000" BorderThickness="1,1,1,1" 
    Height="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Width="192"
    Padding="5">
    <Border.Background>
        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
            <GradientStop Color="#FF2100FF"/>
            <GradientStop Color="#FFFFFFFF" Offset="1"/>
        </LinearGradientBrush>
    </Border.Background>
    <StackPanel>
        <TextBlock x:Name="eventName" Text="Amazing Music" FontSize="24" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Padding="0,0,0,0"/>
        <TextBlock x:Name="eventDescription" Text="Amazin music in that house" TextWrapping="Wrap" FontSize="14" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" MaxWidth="300" />
    </StackPanel>
</Border>
于 2009-04-22T04:36:56.820 に答える
0

うーん....問題がグリッド上にある可能性があります。自動または*で再生する必要があるかどうかを確認するために、ダミーのスタックパネルでそれを試してください...

一方、修正領域内に TextBlock を表示する必要がある場合は、

http://www.tipsdotnet.com/TechBlog.aspx?PageIndex=0&BLID=7

乾杯ブラウリオ

于 2009-04-20T18:47:59.990 に答える