15,911,789 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 11143298 (Top 7 by date)
Member 11143298
29-Oct-14 0:32am
View
alright sorry to bother you....please you can help me.
Member 11143298
29-Oct-14 0:10am
View
Thanks for your concern but i have done the same thing setup the executable project as the startup project btu it throws an activation exception.....Please let me out of this...thanks in advance
Member 11143298
28-Oct-14 23:42pm
View
Deleted
In my file ViewModels.MainViewModel.cs the source Code as
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data.SqlClient;
using System.Configuration;
using System.ComponentModel;
using System.Collections.ObjectModel;
using MVVM_DemoAppl.Models;
using System.Data;
namespace MVVM_DemoAppl.ViewModels
{
public class MainViewModel : INotifyPropertyChanged
{
Model _myModel = new Model();
private ObservableCollection<Person> _empdata = new ObservableCollection<Person>();
private ObservableCollection<Person> Empdata
{
get { return _empdata; }
set
{
_empdata = value;
OnPropertyChanged("EmployeeTable");
}
}
public MainViewModel()
{
initializeload();
}
private void initializeload()
{
DataTable table = _myModel.getData();
for (int i = 0; i < table.Rows.Count; ++i)
Empdata.Add(new Person
{
Names = table.Rows[i][0].ToString(),
Age = Convert.ToInt32(table.Rows[i][1]),
Description = table.Rows[i][2].ToString(),
});
}
public event PropertyChangedEventHandler PropertyChanged;
public void OnPropertyChanged(string propertyname)
{
var handler = PropertyChanged;
if (handler != null)
handler(this, new PropertyChangedEventArgs(propertyname));
}
}
public class Model
{
public DataTable getData()
{
DataTable ndt = new DataTable();
SqlConnection sqlcon = new SqlConnection(@"Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=master;Data Source=WINJIT332\SQL2012
");
sqlcon.Open();
SqlDataAdapter da = new SqlDataAdapter("Select * from EmployeeTable", sqlcon);
da.Fill(ndt);
return ndt;
}
}
}
and Models as Person.cs...
in app.xaml.cs i have the code as
base.OnStartup(e);
var mainWindow = new MainWindow();
var viewModel = new MainViewModel();
mainWindow.DataContext = viewModel;
mainWindow.Show();
btu still i could not get the Table of my SQL named EmployeeTable on dataGrid Control....can anybody help me with this Problem
Member 11143298
28-Oct-14 9:21am
View
Yes you are right I went for tutorials but cold not get where to code for Views,Models and ViewModels...I shall be highly obliged if you shall do the needful. Thanks in advance.
Member 11143298
28-Oct-14 9:19am
View
Would you care to give me any kind of examples or any thing through which i could understand the concepts. I have tried with simple MVVM but not well verse with Prism.
Your help would be highly appreciable.
Member 11143298
27-Oct-14 1:08am
View
But im a beginner to it. can you suggest what could be the purpose of using that file. it has a default path C:CommonServiceLocator\main\ServiceLocatorImplBase.cs
Member 11143298
21-Oct-14 7:52am
View
'ServiceLocatorImplBase.cs not found'. can anybody tell me why there is a prompt for this file?.
{"Activation error occurred while trying to get instance of type SyncDashMainView, key \"\""}
StackTrace: at Microsoft.Practices.Prism.Modularity.ModuleInitializer.HandleModuleInitializationError(ModuleInfo moduleInfo, String assemblyName, Exception exception)
at Microsoft.Practices.Prism.Modularity.ModuleInitializer.Initialize(ModuleInfo moduleInfo)
at Microsoft.Practices.Prism.Modularity.ModuleManager.InitializeModule(ModuleInfo moduleInfo)
at Microsoft.Practices.Prism.Modularity.ModuleManager.LoadModulesThatAreReadyForLoad()
at Microsoft.Practices.Prism.Modularity.ModuleManager.LoadModuleTypes(IEnumerable`1 moduleInfos)
at Microsoft.Practices.Prism.Modularity.ModuleManager.LoadModulesWhenAvailable()
at Microsoft.Practices.Prism.Modularity.ModuleManager.Run()
at Microsoft.Practices.Prism.UnityExtensions.UnityBootstrapper.InitializeModules()
at Microsoft.Practices.Prism.UnityExtensions.UnityBootstrapper.Run(Boolean runWithDefaultConfiguration)
at Microsoft.Practices.Prism.Bootstrapper.Run()
at HelloWorld.Desktop.App.OnStartup(StartupEventArgs e) in e:\yudhi-shared\HelloWorld.Desktop\HelloWorld.Desktop\App.xaml.cs:line 24
at System.Windows.Application.<.ctor>b__1(Object unused)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
at System.Windows.Threading.DispatcherOperation.InvokeImpl()
at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Windows.Threading.DispatcherOperation.Invoke()
at System.Windows.Threading.Dispatcher.ProcessQueue()
at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
at System.Windows.Threading.Dispatcher.Run()
at System.Windows.Application.RunDispatcher(Object ignore)
at System.Windows.Application.RunInternal(Window window)
at System.Windows.Application.Run(Window window)
at System.Windows.Application.Run()
at HelloWorld.Desktop.App.Main() in e:\yudhi-shared\HelloWorld.Desktop\HelloWorld.Desktop\obj\Debug\App.g.cs:line 50
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
Show More