---restore content starts---
A small note of essays, Welcome to correct me
When you do WVVM on the UWP platform, you want to define a custom command for the SelectionChanged event of the ListBox, so you use the way you customize attached properties. But finally, the custom attached property Selectionchangedcommand is written, but does not know how to use it in XAML.
My custom attributes are as follows:
namespaceselectionchangedcommand.services{ Public Static classSelectionchangedbehavior { Public Static ReadOnlyDependencyProperty Selectionchangedcommandproperty = Dependencyproperty.register ("Selectionchangedcommand",typeof(ICommand),typeof(Selectionchangedbehavior),NewPropertyMetadata (NULL, Selectionchangedpropertycallback)); Public Static voidSetselectionchangedcommand (UIElement element, ICommand value) {element. SetValue (selectionchangedcommandproperty, value); } Public StaticICommand Getselectionchangedcommand (UIElement element) {return(ICommand) element. GetValue (Selectionchangedcommandproperty); } Public Static voidSelectionchangedpropertycallback (DependencyObject D, DependencyPropertyChangedEventArgs e) {Listbo X ListBox=(ListBox) D; Listbox.selectionchanged+=listbox_selectionchanged; } Private Static voidListbox_selectionchanged (Objectsender, SelectionChangedEventArgs e) {ListBox ListBox=(ListBox) sender; Getselectionchangedcommand (ListBox). Execute (Listbox.selecteditem); } }}
So Baidu, see in WPF is the following wording:
Xmlns:aqua= "Clr-namespace:aquariumobjects;assembly=aquariumlibrary"
So I imitated the following code.
Xmlns:my= "Clr-namespace:selectionchangedcommand.services;assembly=selectionchangedcommand"
where "Selectionchangedcommand" is the name of my assembly.
And then, in a ListBox, the following references are made
<my:SelectionChangedBehavior.SelectionChangedCommand= "{Binding Selectionchangedcommand}"></ListBox>
The results suggest that I have an unknown attachable member "Selectionchangedbehavior.selectionchangedcommand", so I changed the namespace above to
Xmlns:my= "Using:SelectionChangedCommand.Services"
The result will be.
So what's the difference between Clr-namespace and using?
Currently found on the Internet: Silvelight is: Clr-namespace. The WINDOWS8 is changed into a using.
[Note for custom attached property usage in Uwp]xaml