Button
次の問題に対するアドバイスが必要です。テキストフローにを埋め込みたいのですが、Button
とLabel
(またはTextBlock
)をに埋め込むとWrapPanel
、最初の図が表示されます。
代替テキストhttp://sklad.tomaskafka.com/files/wpf-wrappanel-problem.png
解決策の1つは可能性があると思いますがFlowDocument
、これはこのような単純な制御(数百のインスタンスで使用できる)には重すぎると感じています。これを実装する方法について他にアイデアはありますか?ありがとうございました!
編集:1つの解決策は次のようになります(もっと多くのものを入れることができるとは知りませんでしたTextBlock
)が、バインドする機能を失います(必要です):
<TextBlock TextWrapping="Wrap">
<Span>
<Button x:Name="MyButton" Command="{Binding Path=MyCommand}" Content="+" />
<Run x:Name="MyLabel" Text="{Binding Path=Subject}" />
<!--
Problem: binding makes following error:
A 'Binding' cannot be set on the 'Text' property of type 'Run'.
A 'Binding' can only be set on a DependencyProperty of a DependencyObject.
-->
</Span>
</TextBlock>