Click here to Skip to main content
14,929,864 members

Comments by Graeme_Grant (Top 200 by date)

Graeme_Grant 22-May-21 10:09am View
Glad to hear that it helped.
Graeme_Grant 24-Sep-20 4:40am View
Mate, check your dates ... you're commenting on my 6-year-old reply...
Graeme_Grant 24-Mar-20 3:14am View
It depends on how you are using it. This is a closed question, so you will need to post a new one.
Graeme_Grant 11-Jan-20 20:42pm View
Glad to hear that it helped!
Graeme_Grant 20-Aug-19 22:53pm View
5'ed ... was going to be my answer, well done!
Graeme_Grant 3-Aug-19 5:13am View
Learning to use a debugger will both help you identify which line the error occurs on and what the error is. He is a good place to start:

Basic Debugging with Visual Studio 2010 - YouTube[^]
Graeme_Grant 19-Jul-19 2:59am View
you are welcome
Graeme_Grant 19-Jul-19 2:47am View
Index is a reserved keyword. Look at my answer more closely... use
to indicate that it is not a keyword.
Graeme_Grant 3-Jul-19 8:20am View
you telling us or asking a question?
Graeme_Grant 8-Jun-19 23:56pm View
I've seen this exact question been asked here before about the same time as last year, so it appears to be an assignment for a class that you're doing ...

We are not here to debug your code for you ...

What is your question?
Graeme_Grant 10-May-19 20:41pm View
Are you doing any async calls in InserInvoice method?

If you are, add await xxxAsync(...).ConfigureAwait(false); for calls inside InserInvoice method. This will ensure that calls are moved to another thread.

another trick, if there is also async code, is to call await Task.Yeild; immediately on entering InserInvoice method to quickly yeild to the UI thread.

Like any new frameworks that you use, it is always a good idea to do your research first and understand what you are doing.

Here are a couple of links to help you understand how async...await works:

* Asynchronous programming patterns | Microsoft Docs[^]
* C#: Why you should use ConfigureAwait(false) in your library code[^]
* Async Best Practices for C# and Visual Basic - YouTube[^]
* Task.Yield Method (System.Threading.Tasks) | Microsoft Docs[^]
* c# - When would I use Task.Yield()? - Stack Overflow[^]
Graeme_Grant 9-May-19 6:22am View
You know that Silverlight is dead for a few years right?

Microsoft Silverlight: what happened exactly? Still available?[^]
Graeme_Grant 8-May-19 12:15pm View
You don't need to use a BackgroundWorker to unblock the UI, the Task asynchronous programming model[^] used in the solution below, does that for you in a far simpler to implement and read method than what you're trying to do.
Graeme_Grant 23-Apr-19 3:07am View
These are suggested possible solutions ...
Graeme_Grant 6-Apr-19 18:18pm View
Thanks Bill :)
Graeme_Grant 6-Apr-19 0:11am View
I think that you misunderstood. Only one instance running on one machine at a time. aka: single instance.

FWIW, we have over 30,000 users in over 120 countries running our app with the very installer linked in the article above. It's very battle tested. ;)
Graeme_Grant 27-Mar-19 17:38pm View
Looking at your code and reading your question, you're asking about TPL[^] but coding against Threading[^], two totally different ways of doing multitasking. So, you need to provide more code, with a clear description and a clear question on where you are stuck so we can understand better and be able to point you better in the right direction.
Graeme_Grant 18-Mar-19 6:25am View
Sorry, but don't understand your question. Can you please click on "Improve question" link and change so that we can better understand.
Graeme_Grant 18-Mar-19 3:16am View
Graeme_Grant 15-Mar-19 17:57pm View
Object reference not set to an instance of an object. exactly what it says, you are trying to use a null object as if it was a properly referenced object.
Graeme_Grant 13-Mar-19 20:15pm View
I'm not understanding the problem that you're having. Have you checked the default template that works?

TreeView Styles and Templates | Microsoft Docs[^]
Graeme_Grant 11-Mar-19 0:12am View
Where have you set the DataContext for the form?
Graeme_Grant 6-Mar-19 16:10pm View
You have a Hierarchical structure in your data already. Why not create a new table that contains the parent id and item id and then write a SQL query to pull the data in the format that you want... Remember, we're not here to do your work for you, we're here to help give you guidance. ;)
Graeme_Grant 6-Mar-19 16:07pm View
That is a separate question to the one already answered. Please mark this one as answered that addresses downloading multiple pages in the background. The issue that you now want answering needs to be opened as a new question.
Graeme_Grant 5-Mar-19 22:40pm View
There should be an inner error message with more information. My guess is that you have not authenticated or missing a bearer token in the header ...
Graeme_Grant 5-Mar-19 22:21pm View
for a higher level ... use your web browser "F12" tools, there is a traffic sniffer there too
Graeme_Grant 5-Mar-19 13:15pm View
You are most welcome :)
Graeme_Grant 5-Mar-19 13:14pm View
Graeme_Grant 5-Mar-19 13:13pm View
Yes, you can and I almost did include a converter. But I felt, based on the question that it was both technically the wrong answer and too advanced for the OP. The linked article does cover custom converters in great detail.:)
Graeme_Grant 5-Mar-19 13:07pm View
I don't like using WhenAll and only included it as an example. Thanks for pointing that out for the OP and others. :)
Graeme_Grant 5-Mar-19 9:25am View
Ummm ... who are you talking to?
Graeme_Grant 5-Mar-19 8:40am View
Need more information then ... are you talking SignalR type data streaming? Are you tryping to do this from an app? from a webserver? how big are the files that you're trying to push? can they be zipped and compressed before sending? etc...
Graeme_Grant 5-Mar-19 1:31am View
You're describing two different issues here:
1. How to download multiple URI in the background - ie: multi-threaded.
2. How to determine how to get the correct data based on the call required

For part 1, still, the above solution will do what you want.

For part 2, you need to do some research... Use Fiddler[^], which is a traffic sniffer, and watch the ajax calls made by the javascript and the responses the server issues ... then you know what URI to call with headers, cookies, etc...
Graeme_Grant 4-Mar-19 17:43pm View
So you're wanting to do page scraping? the solution above will do what you want to get the page...
Graeme_Grant 3-Mar-19 16:44pm View
So you want to change a JSON object properties from single values to use arrays?
Graeme_Grant 25-Feb-19 4:41am View
Please don't ask the same question twice. Originally asked here:
Graeme_Grant 20-Feb-19 9:28am View
Thanks :)
Graeme_Grant 6-Feb-19 0:05am View
Go to the hosting control panel and change it back. If you can't, contact your hosting service and they will either do it for you or explain how.
Graeme_Grant 4-Feb-19 19:39pm View
No problems.

The Linq version above is delayed execution, so the code only runs when you iterate over the results. To force it to execute immediately, use .ToList(). Very powerful and flexible when used correctly...
Graeme_Grant 4-Feb-19 19:35pm View
I haven't looked at it in a long time ... will check and update my code ... thanks
Graeme_Grant 4-Feb-19 10:32am View
Updated my solution with a non-Linq version...
Graeme_Grant 30-Jan-19 18:34pm View
You can change the App's icon in the Project properties.

Right-click menus are called Context menus. Is your app WinForm, WPF, Xamarin Forms, etc..? Each framework has a different way on coding the functionlity.
Graeme_Grant 22-Jan-19 20:10pm View
Flash is a dead technology. Why use it?
Graeme_Grant 21-Jan-19 18:24pm View
Have you tried asking your question in the Telerik Forums[^]?
Graeme_Grant 21-Jan-19 16:18pm View
Have you tried the Telerik Forums[^]?
Graeme_Grant 20-Jan-19 22:55pm View
What have you tried so far?
Graeme_Grant 20-Jan-19 3:35am View
Stack Overflow usually results from recursion. Set a breakpoint and step through your code to see what it is doing.
Graeme_Grant 19-Jan-19 22:29pm View
And what error would that be?
Graeme_Grant 18-Jan-19 23:37pm View
Obviously, something has changed, that is why you check and never assume or jump to conclusions.
Graeme_Grant 18-Jan-19 23:32pm View
Don't just use default settings for the publish process, check the settings before publishing.
Graeme_Grant 18-Jan-19 23:28pm View
Then you need to look at why the installer that you are using is performing differently. I suggest that you have missed a setting in the process of publishing the app rather than the version of Windows that you are installing on.
Graeme_Grant 18-Jan-19 23:22pm View
Not enough information. How are you installing the app? Click-Once, Install Shield, etc?
Graeme_Grant 11-Jan-19 6:18am View
where are you stuck?
Graeme_Grant 10-Jan-19 12:12pm View
Telerik has their own support forums where you can ask for help: Discussions on ASP.NET AJAX, MVC, Core, Xamarin, Angular, HTML5 and jQuery - Telerik Forums[^]
Graeme_Grant 10-Jan-19 2:06am View
Can do that too... ;)
Graeme_Grant 9-Jan-19 20:13pm View
Fair comment... So I've updated the solution with a code-behind version using Data Binding.
Graeme_Grant 9-Jan-19 17:48pm View
No, I did not. Looking at your code you are removing items which is not meeting the criteria of "the same entry in the other isn't selectable anymore". Mind you, the question does lack clarity.

Also, your example does not wire up the events. You need to add the following to the constructor:
ComboBoxA.SelectionChanged += OnComboBoxASelectionChanged;
ComboBoxB.SelectionChanged += OnComboBoxBSelectionChanged;
Graeme_Grant 9-Jan-19 8:54am View
How are you disabling items as per the scope of requirements in the question? You're physically removing the item and resetting the ItemSource. Have you checked if that deselects the selected item when changing the ItemSource?
Graeme_Grant 9-Jan-19 5:31am View
It is actually possible ... I'll find some time and add an example of how...
Graeme_Grant 9-Jan-19 4:56am View
Do you see any Data Binding errors in the Output Window?

We can't see your project on your screen from here...

The code in your question does not show any Xaml, how you connect the ViewModel to the DataContext, what collection class that you are using, how you are filling the collection itself, nor the how you implement the model to hold the data in the collection.

Please update your question with more information please.
Graeme_Grant 8-Jan-19 17:45pm View
No, you don't need to as the Count property is internal to the ObservableCollection class. If you peek at the ObservableCollection class you can see it is already implemented:
public class ObservableCollection<T> : Collection<T>, INotifyCollectionChanged, INotifyPropertyChanged
Graeme_Grant 8-Jan-19 8:44am View
No need to implement INotifyPropertyChanged for ObservableCollection as it implements ICollectionChanged internally.
Graeme_Grant 6-Jan-19 20:34pm View
Which SQLite Library are you linking in? Are you using Entity Framework?
Graeme_Grant 4-Jan-19 20:53pm View
You have a problem with your code... without the code that the error occurs on it is impossible to help. We can't see your screen from here ... So please update your question with the code that is causing the error.
Graeme_Grant 2-Jan-19 16:58pm View
Talk to the companies that you're trying to get around their usage agreements... You should not disrespect their IP.
Graeme_Grant 25-Dec-18 23:19pm View
We can NOT run the code here, nor are we here to debug it. If you can explain the problem in detail, then we can help. What is the response code, is it "200 ok"? If not, then what? If it is, then what data is returned?
Graeme_Grant 21-Dec-18 2:55am View
Debug so you can actually see what is created. Exporting JSON is a different method call.
Graeme_Grant 17-Dec-18 6:00am View
Begin, Commit & Rollback ... all transaction keywords that you need to learn... Once you do, you will see the light!
Graeme_Grant 15-Dec-18 7:14am View
This is a community website. You will need to go to the original Author's article page and communicate with them there.
Graeme_Grant 14-Dec-18 2:11am View
you know that flash is dead right? All browsers, both desktop and mobile, have stopped supporting it!
Graeme_Grant 14-Dec-18 1:59am View
This smells of school homework or assignment ...
Graeme_Grant 8-Dec-18 19:44pm View
We are not here to debug your code for you... Have you tried using a debugger to see where your problem is?

What happens when you click the SaveNewEmployeeButton button? Is the data being saved to the database? How are you updating the DataTable linked to the Grid? Is the DataTable holding the new record?

Step through the code and identify where the issue is. Now you know what you need to resolve to fix your issue.
Graeme_Grant 8-Dec-18 6:40am View
This is homework, a chance for you to show that you understand. Work out the answer on paper like a normal math question then convert it to code.

To help you a little with your program, the question is "Find the largest". So would it not be quicker to work from the largest to smallest number rather than from the smallest to the largest?
Graeme_Grant 1-Dec-18 7:16am View
Depends if he's using a data table linked directly to a DB or separated layers... Totally unclear...
Graeme_Grant 30-Nov-18 21:31pm View
Have you tried setting a breakpoint on this line?
var json = JObject.Parse(file);

Now look at the contents of the variable file in the locals window ... it is called "debugging".
Graeme_Grant 30-Nov-18 21:18pm View
Do you understand the error that you are seeing?
Graeme_Grant 27-Nov-18 19:02pm View
Please post minimal mock code to reproduce problem as we can't see your code from here... ;)
Graeme_Grant 15-Nov-18 1:42am View
public List<US_State> AllUSStates {...} ... not the problem... ItemsSource="{Binding Get_States... should be ItemsSource="{Binding AllUSStates... ... the debugger output has the answer, that is why I asked...
Graeme_Grant 14-Nov-18 20:23pm View
What does the debug output tell you?
Graeme_Grant 31-Oct-18 22:08pm View
You can use the XAML inspector in VS2017 to check ;)
Graeme_Grant 31-Oct-18 21:45pm View
"BindingExpression:Path=DataContext.(0); DataItem=null;" - can't find the DataContext that you are looking for...
Graeme_Grant 22-Oct-18 11:37am View
The answer given still applies.

The ComboBox.ItemsSource uses OrderStatus which should be a collection of valid States. The binding needs to be a relative reference to a DataContext where the collection can be found.
Graeme_Grant 3-Oct-18 14:23pm View
I have not used the CEF lib, so I can't help without learning it...

Side note: Microsoft is aware the control needs updating but the version of the framework required won't be suitable: Bringing a modern WebView to your .NET WinForms and WPF Apps - Microsoft Edge Dev BlogMicrosoft Edge Dev Blog[^]
Graeme_Grant 1-Oct-18 5:22am View
for Winforms you use a shim, for WPF you don't ... this could be why... I also read it somewhere from one of the MS devs... can't remember where ...
Graeme_Grant 1-Oct-18 2:35am View
Who are you replying to? I think that you're hitting the wrong buttons...
Graeme_Grant 1-Oct-18 2:26am View
Yes, I found similar ... The WPF web browser is actually the same one used with WinForms. Have you looked at CefSharp - Fast web browser for WinForms and WPF Apps[^]?
Graeme_Grant 30-Sep-18 19:01pm View
was your comment meant for me or the OP?
Graeme_Grant 27-Sep-18 20:58pm View
You can break data binding if you "renew" an object rather than/clear/reset properties. I can't see from the code that you have posted. So be careful.
Graeme_Grant 27-Sep-18 18:35pm View
Sounds like you have not set the DataContext.
Graeme_Grant 27-Sep-18 17:43pm View
Countered the 1 vote for a valid answer
Graeme_Grant 27-Sep-18 17:43pm View
Countered the 1 vote for a valid answer
Graeme_Grant 27-Sep-18 17:42pm View
Graeme_Grant 26-Sep-18 9:36am View
"I don't understand how he did it "... Marking down a solution to 1 out of 5 just because you don't understand a working solution won't win you help. We are not paid or obliged to help you, we do it because we want to help. Please show some respect.

To help you better understand the answer, he is using Data Binding (Microsoft Docs)[^] notifications to trigger the Animation (Microsoft Docs)[^] event. For that to work, you need to set the DataContext for the control and implement INotifyPropertyChanged (Microsoft Docs)[^] interface for data binding.
Graeme_Grant 25-Sep-18 20:22pm View
do you see any binding errors in the debug output?
Graeme_Grant 24-Sep-18 9:59am View
Graeme_Grant 24-Sep-18 2:11am View
Graeme_Grant 24-Sep-18 2:09am View
Countered the 1 vote
Graeme_Grant 22-Sep-18 17:20pm View
What have you written so far?
Graeme_Grant 21-Sep-18 18:19pm View
The problem that you have is not related to JSON deserialization, it is to do with your logic for db storage.

If you're going to use reflection why not use Entity Framework? They have solved the problems that you are experiencing.
Graeme_Grant 19-Sep-18 7:54am View
Thanks! :)
Graeme_Grant 14-Sep-18 7:16am View
5'd ... thanks for linking my article... :)
Graeme_Grant 9-Sep-18 19:10pm View
Yes, same... Xml, JSON, CSV, etc... there is a lib for that! ;)
Graeme_Grant 9-Sep-18 4:53am View
I would do it the same way as you would store a recursive structure in a DB table(s)... I must admit, without knowing the specific structure of the data to be stored, it's hard to give a clear answer...
Graeme_Grant 9-Sep-18 2:32am View
My question is a binary yes or no answer... if no, please explain in more detail...
Graeme_Grant 8-Sep-18 18:56pm View
Are you wanting to share data between two ViewModels that are not linked?
Graeme_Grant 8-Sep-18 18:37pm View
That is not what your question asked... Please update the question with specific details.
Graeme_Grant 7-Sep-18 17:59pm View
That is another way ... ;)
Graeme_Grant 7-Sep-18 4:37am View
I don't think that you tried my solution... it will work with any column. I'll update the solution to show you...
Graeme_Grant 5-Sep-18 4:04am View
lol... true
Graeme_Grant 4-Sep-18 6:46am View
DataSet is not used for the other frameworks
Graeme_Grant 4-Sep-18 4:53am View
Are you assuming a WinForm project?
Graeme_Grant 3-Sep-18 23:21pm View
We cannot see your screen from here... WPF, WinForm, Xamrin Forms, etc... which framework are you using? Post code so that we can see what you are doing and offer advice on how to help.
Graeme_Grant 3-Sep-18 21:32pm View
If there is someone that has used the control, then you may get a response here ... Have you searched StackOverflow?

results found containing xceed grid - Stack Overflow[^]
Graeme_Grant 3-Sep-18 21:11pm View
This is a 3rd-party control... Have you looked &/or asked your question in Xceed's dedicated support forums? If not, here is the link: Forums – Xceed[^]
Graeme_Grant 2-Sep-18 19:30pm View
This sounds like a combination homework question ... I remember these from over 30 years ago back in school... we don't do your homework for you...
Graeme_Grant 2-Sep-18 4:16am View
See the answer above. I've just shown you how to deserialize and serialize. The same principle is used if you create the class data yourself before serializing.
Graeme_Grant 1-Sep-18 16:39pm View
You are most welcome Brian. :)
Graeme_Grant 1-Sep-18 8:10am View
Okay. To answer your comment I'll explain how I handle this scenario.

1. Models for me are a data container, pretty much a POCO with INotiftPropertyChanged implemented.
2. ViewModels are the interface between the Model and the View. Pretty standard.
3. Any specialized functions are broken between Repositories for handling storing/retrieving data and Services which support specific tasks. Repositories and Services are accessed via the ViewModel.

With the above approach, there is no need for the ViewModel to notify the Model, the ViewModel will interact with/notify the Repository/Service.

Hope this makes sense.
Graeme_Grant 1-Sep-18 6:50am View
You are best off asking your question at the 3rd party tool's support area: LEADTOOLS Technical Support[^]
Graeme_Grant 30-Aug-18 20:51pm View
Graeme_Grant 29-Aug-18 7:07am View
Without any code, it is impossible to know what you are doing to cause this behavior. We cannot see your screen from here.

Something to consider though, are you running your code on the main thread or a sperate thread? I ask not using a separate thread will block the message queue used by the UI causing the behavior that you are experiencing.
Graeme_Grant 27-Aug-18 3:44am View
Click on the [^] links provided in my responses...

FWIW, here is a new WPF article just posted: Paging WPF DataGrid[^]
Graeme_Grant 26-Aug-18 18:27pm View
Again, where have you been looking? I did a quick check and there are 11 articles this month alone on WPF on CP. You can check yourself: Latest Updates - WPF[^]

The choices that you have today for desktop development that are still supported by Microsoft are:
1. Universal Windows Platform (UWP)
2. Xamarin (UWP; soon WPF & WinForm, both in BETA)
3. WPF
4. WinForms
5 Progressive Web App (PDA) for web developers **new**

The developer has a rich set of Microsoft supported choices. There are others out there that are not Microsoft too. It is up to you which you choose...

You can read about PWA here: Welcoming Progressive Web Apps to Microsoft Edge and Windows 10 - Microsoft Edge Dev BlogMicrosoft Edge Dev Blog[^]

I personally choose WPF and Xamarin as I have customers who are not on Windows 10 and other devices. That still accounts for a large chunk of my customers.
Graeme_Grant 26-Aug-18 7:21am View
I forgot to mention that the Visual Studio app itself that they use to write apps with is actually a WPF app...
Graeme_Grant 23-Aug-18 17:54pm View
If you bind to an ObservableCollection, then the DataGrid will reflect changes to the collection through the data binding mechanism. Here is a similar example: How to check WPF datagrid checkbox is selected or not in all rows in button click event[^]
Graeme_Grant 21-Aug-18 1:21am View
too messy ... below is a simple & clean solution ;)
Graeme_Grant 20-Aug-18 6:21am View
You know that we don't work for you right? Have you read the FAQ? If you are looking for someone to work for you, go to: Hire Freelancers & Find Freelance Jobs Online - Freelancer[^]
Graeme_Grant 17-Aug-18 1:57am View
The code does not relate to the question. Please update the question, the code, or both...
Graeme_Grant 14-Aug-18 8:48am View
Already answered. Please start a new question. But please read posting FAQ first: Code Project Quick Answers FAQ[^]
Graeme_Grant 10-Aug-18 13:30pm View
You don't. You wrap the ItemsControl instead.
Graeme_Grant 10-Aug-18 2:36am View
It is definitely a time-saving refactoring! :)
Graeme_Grant 9-Aug-18 23:38pm View
.ToList() is only required if early evaluation is required. Also, you can simplify your answer to:
var selectedList = allTypes
  .Where(type => type?.BaseType?.Name == "MyBASETYPE");
Graeme_Grant 9-Aug-18 18:59pm View
Remove .Select(...).
Graeme_Grant 30-Jul-18 18:07pm View
Any reason you're replying to a 6-year-old question with a vague at best response?
Graeme_Grant 25-Jul-18 10:05am View
What is the Output window telling you? I am guessing that you have a binding error.
Graeme_Grant 22-Jul-18 22:29pm View
Have you looked at Newtonsoft?
Graeme_Grant 22-Jul-18 10:40am View
This is a 7-year-old question on a discontinued framework. Please answer questions that are current...
Graeme_Grant 19-Jul-18 7:15am View
Not if you cant get authenticated.
Graeme_Grant 19-Jul-18 2:21am View
That is a matter that you need to discuss with them.
Graeme_Grant 12-Jul-18 19:41pm View
You tagged the question as WPF yet you mention that you are using a WinForm control. The two UI Frameworks are very different to work with. Please update your question above with the correct information, then you may get the contextually correct answer.
Graeme_Grant 11-Jul-18 17:59pm View
Separation of concerns - ie: removing the data layer from your business layer logic.

What it does also allow for is swapping out the Repository and implement Mock testing or changing your data layer as well which his your Integration testing.
Graeme_Grant 11-Jul-18 6:59am View
What I have proposed shares the user data. So, if you want to execute a method against the user data, you don't have to know which view model as the UserRepository holds the master reference, so you call the method on the shared UserRepository instead.
Graeme_Grant 11-Jul-18 6:50am View
Cheers! Hang in there, when it does, you'll enjoy it. :)
Graeme_Grant 11-Jul-18 1:56am View
Is there a question?
Graeme_Grant 11-Jul-18 1:55am View
The other good thing about WPF, though not directly for all UI frameworks, XAML once learned is transferable. :)
Graeme_Grant 11-Jul-18 1:53am View
Then you won't transfer the bad habits that Winforms creates ;)
Graeme_Grant 11-Jul-18 1:41am View
Enjoy the journey. Once it clicks, you won't go back to Winforms. :)
Graeme_Grant 10-Jul-18 4:25am View
I was thinking the same but the question asked was about generic arrays...
Graeme_Grant 10-Jul-18 4:22am View
Click on the link to the Microsoft Docs and it will answer your questions...
Graeme_Grant 8-Jul-18 15:43pm View
Glad that it helped.... the first one should have worked however was untested off the top of my head.
Graeme_Grant 7-Jul-18 7:59am View
The whole point of debugging is to check that you are getting the expected values at each line of code. If not, then look at why not. All debugging information is useful if used correctly.
Graeme_Grant 6-Jul-18 20:18pm View
Have you tried debugging your app? Check this link on how to: Debug your app  |  Android Developers[^]
Graeme_Grant 6-Jul-18 12:33pm View
I replied to the question against my answer ... you can find my reply here: Load usercontrol by reflection[^]
Graeme_Grant 6-Jul-18 12:33pm View
I replied to the question against my answer ... you can find my reply here: Load usercontrol by reflection[^]
Graeme_Grant 6-Jul-18 12:25pm View
This is a different issue to the original problem and requires a new question to be asked.

What you are trying to do breaks all rules where plugins are involved. The host should not know the inner workings of the plugin as they are supposed to be loosely coupled.

But quickly, you have two choices for sharing data:
1. Use a messaging service like the one found in MVVMLight;
2. Continue to use MEF to share data like we have above.
Graeme_Grant 5-Jul-18 6:58am View
No Worries ... The other thing to keep in mind is that when using binding, you bind to a Property, not a class or instance variable. If you want to Bind to your ViewModel, then set the DataContext to an instance of the VM and not the MainWindow itself.
Graeme_Grant 5-Jul-18 1:22am View
So, all 3 files have JSON in the same format? And the user input is conflict resolution when there are multiple entries with the same key? ie: the user chooses which records to keep?
Graeme_Grant 5-Jul-18 1:17am View
Beat me to it ... an example would have helped him ... I added one below.
Graeme_Grant 4-Jul-18 8:07am View
Please update your question with your code so that we can see what you are doing...

I also have a detailed tutorial here: Working with JSON in C# & VB[^]
Graeme_Grant 4-Jul-18 7:43am View
Supply a sample of all 3 and the desired result.

One method is to load each JSON file and deserialize into separate lists, then merging all 3 into one. Now it's ready for your user to edit.
Graeme_Grant 21-Jun-18 6:02am View
If you have a question for a solution, please don't post it as a solution but instead press "Have a question or Comment" instead.
Graeme_Grant 19-Jun-18 6:27am View
post your code please
Graeme_Grant 11-Jun-18 21:06pm View
You are most welcome :)
Graeme_Grant 8-Jun-18 1:23am View
Post XAML & code so that we can see what you are doing as we can't see your screen from here!
Graeme_Grant 4-Jun-18 17:07pm View
Check the SelectionMode property, don't set to multiple or extended, then you will have the default single selection.
Graeme_Grant 3-Jun-18 17:26pm View
Hi Mike,

It actually answers your question and the next one that you will be asking when you change property data.

With WPF you work with the data and the UI will reflect the changes. Your code is working directly with the controls and not the data. When you work with the data, it is far simpler and unbound from specific controls. The above solution demonstrates this.

But to answer your specific question, to add a new record, you simply create a new record class and add it to the ObservableCollection and the UI will reflect the change - a new row added in this case:
Persons.Add(New PersonModel With {
    .Name = String.Format("Person {0}", i),
    .Age = rand.[Next](20, 50)
Graeme_Grant 1-Jun-18 18:29pm View
small problem, invalid XML. Change
Graeme_Grant 1-Jun-18 18:22pm View
Please update your question with examples of incorrect serialization and correct serialization so that we can better understand.
Graeme_Grant 15-Apr-18 21:38pm View
5'd :)
Graeme_Grant 6-Apr-18 6:10am View
Check out the link provided in the answer. It shows you exactly how.
Graeme_Grant 6-Apr-18 5:55am View
Just like the Image URL, the music/video will have a file URL...
Graeme_Grant 6-Apr-18 4:52am View
yes... don't pass the control, just the URL (path) to the file to be played.
Graeme_Grant 6-Apr-18 4:51am View
Thanks! :) Catches both clean and dirty exits...
Graeme_Grant 6-Apr-18 3:06am View
Thanks! :)
Graeme_Grant 4-Apr-18 11:41am View
It was basically the answer & links that I was going to give ;)
Graeme_Grant 4-Apr-18 11:38am View
My previous answers provided what you need. All that you need to do is change the ListBox to a ListView (along with the layout & data template) in your Xaml.

Ref: C# how to load images into listbox next to each other, WPF (openfiledialog)[^]
Graeme_Grant 4-Apr-18 11:16am View
Strange that you can't open the links. the download link also has the actual URL displayed. Copy and paste into a new web browser window and it will work.

You are seeing the filename as your Image property is a string and not a URI type. Please look at my answers to your previous questions and you will see that I use the URI type.
Graeme_Grant 4-Apr-18 11:06am View
Just checked it and the link works fine. Here is the link to the sample download project on the page linked:[^]
Graeme_Grant 4-Apr-18 10:59am View
Both links have code for you, Dr WPF has downloadable projects that you can compile and run. :)

From the first link, here is ListView with an Image[^]
Graeme_Grant 4-Apr-18 10:41am View
Graeme_Grant 4-Apr-18 10:34am View
I posted a reply for you, however, there is no code in my answer. Instead, I have given you two links that will better answer (than I can in the context of this site) your question. They will also answer a number of future questions that you will have with the ListView control, the same ones that I had when I was, and still am, using it.
Graeme_Grant 3-Apr-18 8:43am View
It's in-place editing, just like Windows Explorer... Pete's version will also do what you want.
Graeme_Grant 3-Apr-18 8:10am View
Pete, this is an extra question on top of the original question asked here: C# how to load images into listbox next to each other, WPF (openfiledialog)[^]
Graeme_Grant 3-Apr-18 6:20am View
That is a different question. Can you please post a new question and I'll answer it there.
Graeme_Grant 3-Apr-18 6:20am View
You are most welcome.
Graeme_Grant 2-Apr-18 23:39pm View
Sorry, things got very busy here ... did you find a solution or do you still need help?
Graeme_Grant 30-Mar-18 12:40pm View
Graeme_Grant 29-Mar-18 17:47pm View

I just read his comment to you about underlining the found words ... yes, the link to the challenge code is overkill but will show him how to underline words...
Graeme_Grant 27-Mar-18 5:08am View
SQLite DB is a single file. read more at Offcial SQLite[^]
Graeme_Grant 23-Mar-18 5:51am View
Are you still having issues?
Graeme_Grant 22-Mar-18 5:44am View
What makes you think that I voted... I only commented.
Graeme_Grant 21-Mar-18 20:33pm View
Okay, I have highlighted the question above for clarity...

Have you tried setting a breakpoint in the model property Set [method] for the Checked property? Is the breakpoint hit and the code execution paused?
Graeme_Grant 21-Mar-18 18:13pm View
Good to hear you repeat what I originally suggested...
Graeme_Grant 21-Mar-18 6:42am View
"every time I select a value with the checkbox and then I want to store it,I see that the Checked property in false"

You have pasted db handling code, not your ViewModel nor the Model class that holds the data referred to in you ListBox DataTemplate Bindings. Have you tried setting a breakpoint in the model property Set for the Checked property?

" form with a combobox and a listbox.In the listbox I have checkboxes for selecting the specific courses"

Your DB code same is looking a the Checked property of the ViewModel and not the Checked property of each model. Which Checked property are you testing for and what is the relationship of each Model Checked property and the main form Checked property?
Graeme_Grant 19-Mar-18 20:21pm View
virtual 5'd! Love Fiddler - Free Web Debugging Proxy - Telerik[^] ... great debugging tool!
Graeme_Grant 19-Mar-18 18:16pm View
That's because he is not using XAML DataBinding, he's hard coding in the code-behind. See:
 dgEmp.ItemsSource = empList
Graeme_Grant 19-Mar-18 12:40pm View
If you add to the project in the solution, the ones that you manually add in the bin folder will automatically be replaced by the build. Secondly, the installer publishing process won't see the files that you manually put in the bin folder. The installer publish process looks at the project only. So pointless to do what you are doing...
Graeme_Grant 19-Mar-18 12:31pm View
" manually add the SQLite.Interop.dll to x64 and x86 folders in bin folder" ... this is your problem, you don't.

Please carefully read my solution above again and the additional information above. Add them to the project, not the bin folder.
Graeme_Grant 19-Mar-18 12:13pm View
Also have a read of this answer to a very similar question to yours: How to deploy SqLite Database with windows application[^]
Graeme_Grant 19-Mar-18 12:12pm View
Already asked and answered here: Deploy WPF application with sqlite database[^]. Please don't repost the same question.