トップ回答者
XamlによるFixedDocumentのテキスト選択と検索ができない

質問
-
WPF .Net Framework 4.0 で開発を行っております。
次のように Xaml を使用して DocumentViewer に FixedDocument を表示するプログラムを作成しました。
<Window x:Class="WpfApplication1.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:WpfApplication1" Title="MainWindow" Height="350" Width="525"> <Grid> <DocumentViewer> <FixedDocument> <PageContent> <FixedPage> <TextBlock FixedPage.Left="50" FixedPage.Top="100" Text="テスト" /> <TextBlock FixedPage.Left="50" FixedPage.Top="200" Text="太郎" /> </FixedPage> </PageContent> </FixedDocument> </DocumentViewer> </Grid> </Window>
プログラムを実行すると想定通りに表示されるのですが、テキスト選択(検索)ができません。
テキスト選択(検索)ができるようにするには、どのような実装が必要なのでしょうか。
宜しくお願いいたします。
回答
-
TextBlockを使っているからでしょう。TextBlockに似せたTextBoxを使用すれば良いと思います。
(参考)
Any way to make a WPF textblock selectable?
http://stackoverflow.com/questions/136435/any-way-to-make-a-wpf-textblock-selectable★良い回答には回答済みマークを付けよう! わんくま同盟 MVP - Visual C# http://d.hatena.ne.jp/trapemiya/
- 回答の候補に設定 星 睦美 2013年6月10日 0:33
- 回答としてマーク hhighbridge 2013年6月17日 23:25
すべての返信
-
TextBlockを使っているからでしょう。TextBlockに似せたTextBoxを使用すれば良いと思います。
(参考)
Any way to make a WPF textblock selectable?
http://stackoverflow.com/questions/136435/any-way-to-make-a-wpf-textblock-selectable★良い回答には回答済みマークを付けよう! わんくま同盟 MVP - Visual C# http://d.hatena.ne.jp/trapemiya/
- 回答の候補に設定 星 睦美 2013年6月10日 0:33
- 回答としてマーク hhighbridge 2013年6月17日 23:25