I have a ListView that is databanked for the Observable Collection of a class. I'm trying to add "copy" menu items like ListView:
& lt; ListView.ContextMenu & gt; & Lt; ContextMenu & gt; & Lt; MenuItem command = "{x: static app command.copy}" & gt; & Lt; / MenuItem & gt; & Lt; MenuItem command = "{x: static app commands.copy}" commandtaxbool = "{binding path = placement targets, relative resources = {relative alien ancestor type = {x: type menu}}}" & gt; & Lt; / MenuItem & gt; & Lt; / ContextMenu & gt; & Lt; /ListView.ContextMenu>
Now when I right click on a menu item .. the menu comes but the copy is grayed out .. My educated guess is that it seems that something for the copy It does not understand .. but when I right click on a list box item..I am choosing something to technically copy .. and the list item is selected because I Doing this..I selected this Want to copy At'm ListView.
What do I have to do to get this work done? Overwrites a copy class in my class that is tied in the list view? I tried googling and not getting too far.
I have just set an example that works for me:
Then in the back code:
// a single string property private class MyData {public string name {get; Set; } Public Memento (String Name) {name = name; } Public override string toasting () {return name; }} Public key window () {InitializeComponent (); // Create some test data ObservableCollection & lt; MyData & gt; Name = New Observational Collection & lt; MyData & gt; (); Name. Add (New Myadata ("name1")); Name. Add (New Myadata ("name 2")); Name. Add (New Myadata ("name 3")); MyListView.ItemsSource = Name; } Private Zero CommandBinding_CanExecute (Object Sender, CanExecuteRoutedEventArgs e) {e.CanExecute = true; } Private Zero CommandBinding_Executed (Object Sender, ExecutedRoutedEventArgs E) {clipboard .set text (MyListView.SelectedItem.ToString ()); }
This works if you select copy
from the context menu or Ctrl + C
No comments:
Post a Comment