【问题标题】:Change Copy and Paste Icons in WP7 and Add Custom Menus like Copy and paste in Windows phone在 WP7 中更改复制和粘贴图标并在 Windows 手机中添加自定义菜单,如复制和粘贴
【发布时间】:2012-12-07 19:23:23
【问题描述】:
我想更改 Windows Phone 7 中的复制和粘贴图标,并且还想在 Windows Phone 中添加自定义菜单,例如复制和粘贴,例如在 Webbrowser 控件中的突出显示和书签等。
Q1:我可以在选择文本时生成类似控件的副本吗?
Q2:我可以在选择文本时添加圆形图标吗?
我已经尝试过 List 和 windows phone 7 工具栏的上下文菜单,但我想对 windows phone 使用相同的方案。
如果有人有相关信息,请帮忙。
感谢
【问题讨论】:
标签:
windows-phone-7
windows-phone-7.1
【解决方案1】:
使用列表框添加弹出窗口
<Popup Name="textSelectionMenuPopup">
<ListBox Name="textSelectionMenu" Margin="0,0,0,100" ItemContainerStyle="{StaticResource myLBStyle}" SelectionChanged="OnTextSelectionMenuSelectionChanged">
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<toolkit:WrapPanel/>
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBoxItem Content="Copy">
<ListBoxItem.Background>
<ImageBrush ImageSource="/Images/Copy.png"/>
</ListBoxItem.Background>
</ListBoxItem>
<ListBoxItem Content="Highlights">
<ListBoxItem.Background>
<ImageBrush ImageSource="/Images/Highlights.png"/>
</ListBoxItem.Background>
</ListBoxItem>
<ListBoxItem Content="Tag">
<ListBoxItem.Background>
<ImageBrush ImageSource="/Images/Tag.png"/>
</ListBoxItem.Background>
</ListBoxItem>
<ListBoxItem Content="Note">
<ListBoxItem.Background>
<ImageBrush ImageSource="/Images/Note.png"/>
</ListBoxItem.Background>
</ListBoxItem>
</ListBox>
</Popup>
并处理 OnTextSelectionMenuSelectionChanged
void OnTextSelectionMenuSelectionChanged(object sender, SelectionChangedEventArgs args)
{
ListBox lstbox = sender as ListBox;
if (lstbox.SelectedItem != null)
{
textSelectionMenuPopup.IsOpen = false;
string command = (lstbox.SelectedItem as ListBoxItem).Content as string;
switch (command)
{
case "Copy":
break;
case "Highlights":
break;
case "Tag":
break;
case "Note":
break;
case "cancel":
break;
}
}