0

CaliburnとSilverlightを使用して、次のことを発見しました。

            <Button PresentationFramework:Message.Attach="ContainerCommand InstructorProfileCommand()"
                    Height="60"
                    Content="Instructor" />

次に、それが機能し、InstructorProfileCommand.Execute()メソッドが呼び出されます。ただし、私がそうする場合:

            <Button Height="60" >
                <Grid PresentationFramework:Message.Attach="ContainerCommand InstructorProfileCommand()">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition />
                        <ColumnDefinition />
                    </Grid.ColumnDefinitions>
                    <Image Source="/App.Module;Component/Icons/navigate.jpg"
                           Height="50"
                           Width="50" />
                    <TextBlock Text="Instructor Profile"
                               Grid.Column="1"
                               HorizontalAlignment="Center"
                               VerticalAlignment="Center"
                               Margin="10,0,0,0" />
                </Grid>
            </Button>

Execute()コマンドは実行されません。添付されたプロパティは、機能するための正しい場所にありますか?

JD

4

2 に答える 2

1

マルコは正しいです。ただし、添付プロパティをボタンにも移動します。

于 2010-02-02T21:44:52.550 に答える
1

私の推測では、2番目のケースでは、次の構文を使用する必要があります。

PresentationFramework:Message.Attach="Event Click = ContainerCommand InstructorProfileCommand"

トリガー(イベントクリック)が明示的に指定されていない場合、フレームワークはメッセージが添付されている要素に基づいてトリガーを推測しようとするためです。

于 2010-02-02T15:35:02.330 に答える