我有一個WrapPanel,一個按鈕和另一個WrapPanel內的兩個元素。該按鈕具有動態寬度。問題是子WrapPanel假定父WrapPanel的全部寬度,由於其左邊的按鈕而溢出到右邊。WrapPanel孩子採取父母的全寬
<WrapPanel Height="200" VerticalAlignment="Top" Orientation="Vertical">
<Button x:Name="BookCover" Click="ChangeImageFile" Margin="10">
button style and content
</Button>
<WrapPanel Margin="10">
<TextBox Text="New Book"></TextBox>
<TextBox Text="Lorem ipsum dolor sit amet, eos iusto graece consetetur cu, an dicam nonumy volutpat qui, usu at nullam alienum. Est suas autem augue ad, integre vituperatoribus quo id, delicata gloriatur pro ei. Vel at nisl decore, ut eum altera commune. Nec at agam menandri, putant insolens suavitate ei mei, ea possim veritus mea. Nec nemore iuvaret detracto at, quodsi consectetuer pri id. Integre suscipit voluptua no pro, nonumes incorrupte ut mea. Delenit democritum vel in, quem tale everti vim id, id vis melius necessitatibus. Paulo signiferumque per te. Cu mei modus exerci partiendo, ad iudico adolescens mea, et stet integre civibus mea." TextWrapping="Wrap"></TextBox>
</WrapPanel>
</WrapPanel>
我怎樣才能使它適合窗口裏面?
爲什麼使用WrapPanel這個?你只需使用Grid即可。 – Bolu