『XAMLプログラミング WPFアプリケーションの概要と開発』(Microsoft株式会社 川西裕幸/高橋忍)ソフトバンククリエイティブのpp.221に、「RichTextBoxコントロールでは、ほぼすべてのコンテンツを格納できる」とあり、XAMLで、
<RichTextBox> <FlowDocument> <Paragraph> <Button>Button</Button> </Paragraph> </FlowDocument> </RichTextBox> のような例を掲載しています。 そこで試してみたところ、なるほどボタンは配置できるのですが、そのボタンがグレーで実行不能になってしまいます。 Windows7, VisualStudio2010 Express, C#, 対象のフレームワークは.NET Framework4。 新規のプロジェクトでWPFアプリケーションを作り、 <Window x:Class="WpfApplication1.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" Height="350" Width="525"> <Grid> <RichTextBox > <FlowDocument> <Paragraph> <Button Content="Button" Height="23" Name="button1" Width="75" /> </Paragraph> </FlowDocument> </RichTextBox> <Button Content="Button" Height="23" Name="button2" Width="75" /> </Grid> </Window> だけで検証して不能状態です。 なぜbutton1は不能なのでしょう? プロパティを見ると、IsEnabledという項目があるので、チェックしようとしてみると、黒い縁取りのある◆のマークになり、チェックできない状態です。ちなみに、RichTextBoxの外に配置したボタンbutton2はIsEnabledがtrueです。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
退会済みユーザー
2015/05/31 15:04