我有一個佈局如何剪切TextBox寬度以防止出現網格?
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="60" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Image Grid.Row="0" Grid.RowSpan="2" Grid.Column="0" Width="60" Height="60" />
<StackPanel Grid.Row="0" Grid.Column="1" Grid.ColumnSpan="2" Orientation="Horizontal">
<TextBlock Text="Title should be long" HorizontalAlignment="Left" />
<Ellipse Fill="White" Stroke="White" Width="7" Height="7" />
</StackPanel>
<TextBlock Grid.Row="1" Grid.Column="1" Text="Message" />
<TextBlock Grid.Row="1" Grid.Column="2" Text="Info" />
</Grid>
我在那裏舉辦的標題和橢圓StackPanel中有一個問題,我們的目標是通過橢圓whitch應放在最後關閉標題在線標記。但它不應該出於觀點。
我試圖把文本框和橢圓放入網格的單元格不幸它沒有幫助。
<Grid Grid.Row="0" Grid.Column="1" Grid.ColumnSpan="2">
<Grid.ColumnsDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnsDefinitions>
<TextBlock Grid.Column="0" Text="Title should be long" HorizontalAlignment="Left" />
<Ellipse Grid.Column="1" Fill="White" Stroke="White" Width="7" Height="7" />
</Grid>
在我看來,它應該呈現正確的,但橢圓再次出現在視圖端口。
這是一個Expression Blend佈局scrinshots,同樣的佈局是在運行時渲染。
網格範圍:
文本框範圍:
橢圓範圍:
所以特xtBox和橢圓是從柵:(
更新的:我需要佈局
1)簡短標題的下一個行爲,橢圓附着到標題結束
2)長標題,橢圓連接到容器的右側
我不太讓你的要求。橢圓始終位於網格中,因爲它可以延伸以適應網格,如果網格被切割。 –
當頁面大小爲HorisontalAlignment =「Stretch」時,網格不應該更大,但它不會。不管網格寬度是否固定。 –
默認情況下是stetches。無論如何,如果沒有足夠的空間,內容可能會被切斷或溢出。 –