15,921,351 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View Python questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
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?