c# - Sending an object with a command parameter -


I am using PRISM to develop my Windows Phone app using MVVM design patterns. I have to pass my chosen ITem object through my lawal order through my lawal order through my representative order.

The problem I can do is, I am passing in the wrong object. I do not know whether this is a design problem or I am improperly bound.

I need an object object object What I'm doing instead is either zero or my view model (I've changed the code several times and those are just the things I can get .)

XAML

  & lt; Phone: LongListSelector X: Name = "AlbumList" ItemsSource = "{Binding album}" margin = "10,0,0,0" LayoutMode = "grid" GridCellSize = "200, 200" ItemTemplate = "{StaticResource AlbumTemplate}" toolkit : TiltEffect.IsTiltEnabled = "This is True" & gt; & Lt; I: Interaction.Triggers & gt; & Lt; I: EventTrigger EventName = "Selective Change" & gt; & Lt; I: InvokeCommandAction command = "{Binding DataContext.SelectAlbumCommand, ElementName = ContentPanel}" CommandPamator = "{Binding}" /> & Lt; / I: EventTrigger & gt; & Lt; / I: Interaction.Triggers & gt; & Lt; / Phone: LongListSelector & gt;  

View modell

  Private Observe Collection & lt; Album & gt; _albums; Public supervision qualification & lt; Album & gt; Album {Return _ Albums; } Set {if (value! = Null) {_albums = value; NotifyPropertyChanged (); }}} Private album titled album; Public Album Selected Album {get {return_selectedAlbum; } // removed the code because it is not required; Object is empty when trying to set} Public Zero Album selected (Object P) {App.Dispatcher.BeginInvoke ((=) => {Selected Album = (album) P;}); ////Navigate("/Views/PhotosListPage.xaml "); } // command which takes an object as the parameter _selectAlbumCommand = New DelegateCommand & lt; Object & gt; (This.AlbumSelected);  

If you want to set only selected albums Why not try your SelectAlbumCommand , SelectedAlbum instead of

   <> selectItem  for you? Phone: LonglistSecator x: name = "Album list" itemsource = "{binding album}" selectedEITOM = "{Binding selected album}" /> In case you really want to pass  SelectedItem  (for some other reason) to  SelectedAlbumCommand , then you  CommandParameter   SelectedItem   LongListSelector  

  to & lt; I: InvokeCommandAction Command = "{DataContext.SelectAlbumCommand Binding, ElementName = ContentPanel}" CommandParameter = "{Bying ElementName = Album List, Path = Selected Item}" />  

Comments

Popular posts from this blog

Member with no value in F# -

java - Joda Time Interval Not returning what I expect -

c# - Showing a SelectedItem's Property -