Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/svg/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# WPF-ReactiveUI InvokeCommand不工作_C#_Wpf_Reactiveui - Fatal编程技术网

C# WPF-ReactiveUI InvokeCommand不工作

C# WPF-ReactiveUI InvokeCommand不工作,c#,wpf,reactiveui,C#,Wpf,Reactiveui,我正在尝试学习ReactiveUI,所以我正在制作示例应用程序,但我在InvokeCommand方面遇到了问题。基本上每次更改SearchPhrase属性时,都应该调用我的showsearchphrase命令 以下是我的看法: <StackPanel Grid.Column="1" Grid.Row="1" Orientation="Horizontal" VerticalAlignment="Center" > <TextBox Width="100" H

我正在尝试学习ReactiveUI,所以我正在制作示例应用程序,但我在
InvokeCommand
方面遇到了问题。基本上每次更改
SearchPhrase
属性时,都应该调用我的
showsearchphrase命令

以下是我的看法:

<StackPanel Grid.Column="1" Grid.Row="1" Orientation="Horizontal"
    VerticalAlignment="Center" >


    <TextBox Width="100" Height="20" 
     Text="{Binding Path=SearchPhrase, UpdateSourceTrigger=PropertyChanged}" />
</StackPanel>
这是我的问题:


该命令需要一个
单元

this.WhenAnyValue(x => x.SearchPhrase)
    .Where(x => !string.IsNullOrWhiteSpace(x))
    .Select(_ => System.Reactive.Unit.Default) //<--
    .InvokeCommand(ShowSearchPhraseCommand);
this.whenyValue(x=>x.SearchPhrase)
.Where(x=>!string.IsNullOrWhiteSpace(x))
.Select(=>System.Reactive.Unit.Default)//
this.WhenAnyValue(x => x.SearchPhrase)
    .Where(x => !string.IsNullOrWhiteSpace(x))
    .Select(_ => System.Reactive.Unit.Default) //<--
    .InvokeCommand(ShowSearchPhraseCommand);
public ReactiveCommand<string, System.Reactive.Unit> ShowSearchPhraseCommand { get; private set; }
...
ShowSearchPhraseCommand = ReactiveCommand.Create<string>(ShowSearchPhraseCommandHandler);