<Button Margin="0,0,5,0" Cursor="Hand"
ToolTip="Search" Command="{Binding SearchButton}"
IsEnabled="{Binding ElementName=SaveButton,Path=IsEnabled,
UpdateSourceTrigger=PropertyChanged,Mode=TwoWay}">
<i:Interaction.Triggers>
<i:EventTrigger EventName="Click" >
<cmd:EventToCommand
PassEventArgsToCommand="False"
Command="{Binding SearchButton}"
/>
</i:EventTrigger>
</i:Interaction.Triggers>
<Button.ContentTemplate>
<DataTemplate>
<Grid>
<Label Visibility="Collapsed">_Search</Label>
<Image Source="/CHKRevAcc;component/Images/search.png" />
</Grid>
</DataTemplate>
</Button.ContentTemplate>
</Button>
答案 0 :(得分:1)
您可以使用 AccessText 元素来包装应该指定访问密钥的文本。
<Button Margin="0,0,5,0" Cursor="Hand"
ToolTip="Search" Command="{Binding SearchButton}"
IsEnabled="{Binding ElementName=SaveButton,Path=IsEnabled,
UpdateSourceTrigger=PropertyChanged,Mode=TwoWay}">
<i:Interaction.Triggers>
<i:EventTrigger EventName="Click" >
<cmd:EventToCommand
PassEventArgsToCommand="False"
Command="{Binding SearchButton}"
/>
</i:EventTrigger>
</i:Interaction.Triggers>
<Button.ContentTemplate>
<DataTemplate>
<Grid>
<AccessText Visibility="Collapsed">_Search</AccessText>
<Image Source="/CHKRevAcc;component/Images/search.png" />
</Grid>
</DataTemplate>
</Button.ContentTemplate>
</Button>
如果这不起作用,那么您可能不希望将可见性设置为折叠。相反,将其变为不透明并将文本缩短为
<AccessText Opacity="0">_S</AccessText>
这样,按钮仍将处理文本,但它将不可见。不确定你是否需要采取最后一步。