Click here to Skip to main content
15,921,351 members

Comments by Member 13668663 (Top 4 by date)

Member 13668663 10-Feb-18 3:11am View    
Thank you very much, now everything works. I had also problem with ICommand. I hope that in the future I will be able to help someone - same as you helped me now.
There is a lot of to learn for me with mvvm, but now I see how this components cooperate.
Member 13668663 9-Feb-18 14:20pm View    
Thank you, I see it now. I removed also code behind.
I have the last ask could you provide some sample that you mentioned above. I have still data binding problem. I am trying to invoke GetSelectedTests() under Button, but I see in debugger that bolean is false even is checkbox is selected.
Then I should spend more time to dig into, I see what I missed.
Member 13668663 9-Feb-18 13:18pm View    
The problem is that I can't see the list in the view now

Here is how I setup the DataContext

public TestListView()
{
InitializeComponent();
viewModel = new TestViewModel();
this.DataContext = viewModel;
}
Member 13668663 9-Feb-18 12:31pm View    
Thank you for your answer :)
I am changing my code now. I would like to ask about this part:

privateObservableCollection<sharedmodel> _List;
public ObservableCollection<sharedmodel> List
{
get { return _List; }
set { _List = value; OnPropertyChanged("List");}
}

What I need is exactly notify that checkbox is slected, so I have tried follow with your suggestions and I have now something like that:


class TestViewModel : ObservableObject
{
public ObservableCollection<sharedmodel> List { get; set; }
public void CreateCheckBoxList()
{
List = new ObservableCollection<sharedmodel>
{
new SharedModel
{
Name = "A1",
Method = Test(),
},
new SharedModel
{
Name = "A2",
Method = TestOne()
}
};
}
public string GetSelectedCheckboxes()
{
var command =
from item in List
where item.IsSelected
select item.Method;
return string.Join("\r&", new NewList<string>(command));
}
....

I did also changes in xaml as you suggested. I am not sure how I can call this list in UI now. This collection should be invoke in constructor e.g. from TestList.xaml.cs?