フロー ビューアーで選択したテキストをパラメーターとしてコマンドに取得しようとしています
<FlowDocumentScrollViewer Name="_OutputBox">
<FlowDocument>
<FlowDocument.ContextMenu >
<ContextMenu>
<MenuItem Header="New"
Command="{Binding AddDefaultTriggerCommand}"
CommandParameter="{Binding ElementName=_OutputBox, Path=Selection}">
</MenuItem>
</ContextMenu>
</FlowDocument.ContextMenu>
</FlowDocument>
</FlowDocumentScrollViewer>
モデルクラスで:
private RelayCommand<System.Windows.Documents.TextSelection> _AddDefaultTriggerCommand;
public ICommand AddDefaultTriggerCommand
{
get
{
...
this._AddDefaultTriggerCommand = new RelayCommand<TextSelection>(
AddDefaultTriggerCommandExecuted,...)
...
}
}
問題は、ハンドラーに渡されるパラメーターが常に nullであることです。
private void AddDefaultTriggerCommandExecuted(System.Windows.Documents.TextSelection parameter)...
何か不足していますか?標準の Windows コピー コマンドは、選択したテキストをどのように取得しますか?