如何发送包含逗号(,)的字符串作为 Caliburn Micro 中的操作参数?

How to send a string that contains comma(,) as an action parameter in caliburn micro?

我正在尝试访问我的视图模型中的字符串。

<Image Source="info.png"
    cal:Message.Attach="[Event MouseEnter]=[Action MouseOverCallOut('By default, This will be selected')]"/>

在我的视图模型中,没有触发此事件:

public void MouseOverCallOut(string callOutText)
{
  CallOutMsg = callOutText;
}

如果您从 string 中删除逗号 (,),它应该可以工作。这对我有用:

<Image Source="info.png" cal:Message.Attach="[Event MouseEnter]=[Action MouseOverCallOut('By defaultThis will be selected')]" Margin="5,0,5,0" />

显然,Caliburn.Micro 由于某种原因无法处理逗号。

如果确实需要逗号,可以使用不可见的 TextBlock:

<TextBlock x:Name="txt" Text="By default, This will be selected" Visibility="Collapsed" />
<Image Source="info.png" cal:Message.Attach="[Event MouseEnter]=[Action MouseOverCallOut(txt.Text)]" Margin="5,0,5,0" />