.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

WPF startup problem using Josh Smith's MVVM example project

Posted By:      Posted Date: September 01, 2010    Points: 0   Category :WPF
  Hi folks I am teaching myself the MVVM pattern in WPF, with the help of Josh Smith's legendary article found here: http://msdn.microsoft.com/en-us/magazine/dd419663.aspx I decided to try the sample code, and then build my own WPF application from scratch, incrementally adding features based on the sample so I understand how it all fits together. I am having a few problems just getting a simple window to show and I was hoping somebody could indicate what I am doing wrong. I created a basic WPF project and used the code from the sample's Application.xaml and Application.xaml.vb, so I could use the special method for project startup that the sample illustrates. The code for Application.xaml is as follows:   <Application x:Class="JoshTest.App" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> <Application.Resources> </Application.Resources> </Application>   The Application.xaml.vb class is as follows:   Imports Microsoft.VisualBasic Imports System.Globalization Imports System.Windows Imports System.Windows.Markup Imports JoshTest.ViewModel Imports System Namespace JoshTest Partial Public Class App Inherits Application Private viewModel As MainWindowViewModel Private window As MainWindow Shared Sub

View Complete Post

More Related Resource Links

MVVM Demo App. Josh Smith

I've been studying this code for a while now, taking notes and digging in.  I am an experienced programmer and have been around a while.  Was wondering if anyone else feels that same way I do about this demo..  It's a pretty difficult thing to get your "head around".  Does it seem that the simple thing we're trying to accomplish with the MVVM pattern is really difficult?  Or am I just a newbie to the pattern and eventually it will sink into the thich skull? I don't criticize the work done because as far as I can tell it's a nice piece of work.  All of the Abstract classes are well defined, the concrete classes are well defined, the commanding patterns are very interesting.  It just seems to me that we are jumping through hoops to do this stuff. Comments?Javaman

VS 2010 Version of Josh Smith's MVVM Demo Application

I tried downloading Josh Smith's MVVM demo yesterday and when I opened it up in VS 2010 I got several errors.  Has any one else encountered this problem?  And is there an updated version available for VS 2010?

Problem adding it to my project.


I tried to add Modal Popup to my project. I tried the Sample Site, it worked there, when I added it to my toolbar, and followed the tutorial, I couldn't use it. Then, I tried something simplier just to test, I added a Confirm Button, when I try to execute the page it goes back to Visual Studio and show me this:

Locating source for 'd:\hg\act\Server\AjaxControlToolkit\ExtenderBase\ExtenderControlBase.cs'. Checksum: MD5 {56 64 14 a8 4c 29 25 94 27 e0 35 10 f1 b4 60 f2}
The file 'd:\hg\act\Server\AjaxControlToolkit\ExtenderBase\ExtenderControlBase.cs' does not exist.
Looking in script documents for 'd:\hg\act\Server\AjaxControlToolkit\ExtenderBase\ExtenderControlBase.cs'...
Looking in the projects for 'd:\hg\act\Server\AjaxControlToolkit\ExtenderBase\ExtenderControlBase.cs'.
The file was not found in a project.
Looking in directory 'C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\crt\src\'...
Looking in directory 'C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\atlmfc\src\mfc\'...
Looking in directory 'C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\atlmfc\src\atl\'...
Looking in directory 'C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\atlmfc\include\'...
The debug source files settings for the active solution indicate that the deb

Publishing location problem for the reporting project?

I installed sql server 2008 with sharepoint integration mode,  after installation , can I use the default configuration? In the default config, the web service url is  http://myPc:80/ReportServer_JACK, when I did a report server project in the Business Intelligence IDE and try to publish to a location, at this moment, which location should I put in publishing folder location? When I use http://myPc:80/ReportServer_JACK as publishing location, it give me the following errors: Failed to connect to 'http://myPc:80/ReportServer_JACK/' with the following error: Unable to create the Web site 'http://myPc/ReportServer_JACK/'. Visual Web Developer does not support creating Web sites on a SharePoint Web server. I hope that one expert can help me to solve this problem? Thanks.

Problem create a web application on SharePoint 2007 (Project Server 2007)

I installed a Project Server 2007 in a 3 server structure (all Win 2003 sp2; one for App server hosting Central Admin, Project Server service & Search service; one for web server; one for database server).  They are only in the same domain and I use the same network account for the installation as well as the WSS service account.  The same network are local admin for those 3 servers. All installation & patches seem ok (at least I don't get error messages) until I attempt to create my first Web Application.  After I filled out the web appliction and try to click OK, the page does not change and i saw the java error at the right bottom corner from my IE browser (version 6). The message is .... Line: 1686 Char: 1 Error: 'WebForm_PostBackOptions' is undefined Code: 0 URL: http://myservername:28804/_admin/extendvs.aspx On my SP log, below are the portion of the log when the error happen. 09/09/2010 12:28:29  1  INF        Entering function UserInterface.ShowCentralAdmin 09/09/2010 12:28:29  1  INF          The show central admin command has been chosen 09/09/2010 12:28:29  1  INF          Searching for registry key Software\Microsoft\Shared Tools\Web Server Extensions\12.0\WSS\CentralAdministrati

Problem in tab control with MVVM Pattern

Hi,  Am new to wpfpatter and mvvm also. I have problem, i need to assign the same shortcut key(say alt+N) to two button in different tab. i have used the following code to assign the shortcut. problem in when i click the shortcut key in tab one it will get trigger the tab two button event. --xmal code is     <UserControl.InputBindings>         <KeyBinding Command="{Binding Path=Delete1Command}" Modifiers="Alt" Key="N"></KeyBinding>         <KeyBinding Command="{Binding Path=Delete2Command}"   Modifiers="Alt" Key="N"></KeyBinding>     </UserControl.InputBindings>        <TabControl  Height="100" HorizontalAlignment="Left"  Name="tabControl1" VerticalAlignment="Top" Width="200">             <TabItem Header="tabItem1" Name="tabItem1">                 <Grid>                     <Button Content="Button1" Height="23&q

Report Server Project DataSet creation problem


I am getting an error while trying to create a dataset in SSRS.


"An error occurred while loading the query designer 'OLEDB-MD'. Only text based query designer will be loaded."


The "Query Designer" command is getting disabled.


FYI: I was able to create successful connection while created the shared DataSource to the AS db, which I used to create my dataset.


Please guide me in getting through this error..


Thanks in advance


WPF and MVVM problem - begginer problem


Hi, if try implemnt my first MVVM in WPF app. I have old app based on winforms and I want use my logic (class) from this project.

I have Model, it consist with these classes:


public class FriendData

public class PingData

public class PokecAccount : INotifyPropertyChanged, IDataErrorInfo

public class Rp :INotifyPropertyChanged, IDataErrorInfo

public class JsonUser:INotifyPropertyChanged


And service class which send HTTP GET and POST request on server, this class implement this interface:


interface IPokecService
  bool LogOn(string nick, 

SSRS AdHoc model project: Entity Name - lable problem



I have created AdHoc model project. I have few entities, designed as parent-child (to handle one to many and many to many relation)

Parent1 has Child_Entity11, Child_Entity12, Child_Entity13 and

Parent2 has Child_Entity21, Child_Entity22, Child_Entity23 and

Parent3 has Child_Entity31, Child_Entity32, Child_Entity33.

Parent1, Parent2 and Parent3 are connected to each other but not the other parent's child directly.


Now, when I deploy this model to report server and access in Report Builder 2.0, it looks good when nothing is on report design. but when I drag one field and when it will filter entity list and show only related entity only. then it's Child name label are not populating correctly. It is showing Child2, Child3 instead of ChildEntity11 or ChildEntity12.

Any help would be appreciated!

Incompatible problem for ASP.NET web service project and C++ CLR project on x64 platform



       I try to use a DLL generated from a C++ CLR project in a ASP.NET web service project. The CLR projeact doesn't refer to any other project. Compilation is all successful for these project no matter what platform I use. When I try to compile the CLR project into x64 with web service x64 / Any CPU, there is a runtime error when I try to debug the web service. 

      Here are error details:


Could not load file or assembly 'VideoRetrieveCLR, Version=, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.BadImageFormatException: Could not load file or assembly 'VideoRetrieveCLR, Version=, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incor

WPF: If Heineken did MVVM Frameworks Part 4

MVVM is to have an instance of a particular Model (say currentPerson) inside my ViewModel (say PeopleViewModel) which is exposed to the View (say PeopleView). The View binds and edits the Model directly.

This definitely flies in the face of what most people consider to be the holy grail of MVVM pattern, but it's a fairly new pattern, so people are still finding their way with it every day, and this works for me very well. The reason I do what I do, is for the following reasons:

1.I have always had the luxury of being able to write my own UI specific Model classes. I would even do this if I was using some other Model classes first, such as LINQ to SQL or LINQ to Entity Framework. As these classes don't have everything a proper WPF Model class needs in my humble opinion. Though, they are pretty good, as they are Partial classes and use INotifyPropertyChanged/DataContract etc etc
2.I am a pragmatist and I do not like writing code for the sake of writing code. I have seen some MVVM apps where the author has had a Model with 50 properties on it, that are simply repeated in the ViewModel abstraction, where the ViewModel added nothing. On that day I decided I would never do that unless I have to.
3.I honestly see no harm in writing directly to the Model from the View, JUST SO LONG AS if the Model is InValid its data NEVER makes its way to the database. I honestly see no pro

Project Example: ASP.NET MVC + SubSonic Architecture

use of SubSonic to provide the DAL in association with some ASP.NET MVC sites and was waylaid in my original intent to throw up a post summarizing the architecture we're using for the effort. Well I've finally gotten around to it. Recall that in his fake it till you need it post, Dave provided a window on our architecture that I'll build upon here

Problem to group radio button across gridview rows

In general no one can easily group or make a single selection from radio button list inside gridview rows. There are a lot of way to make a single or unique selection from list. Here i want to share how i can address this problem in the most easiest way. Googling the problem most of the cases i saw the grouping in horizontal way. Thats why i tried to group the radio buttons in vertical manner. Let i have a requirement like below:

Regrading Sharpoint 2010 problem and solutions

We can write your question and problem on this blogger.you get ans.use.

This sharpoint 2010 problem solving threads

Hi friend,

you can use this thread to solving problem and solutions.

.NET 4 Web Application Startup Time

I was chatting with Jonathan Hawkins and some of the folks on the ASP.NET team about performance and Jonathan mentioned the startup time for large ASP.NET applications is improved on .NET 4. There are some improvements in the CLR and in ASP.NET itself that helped. If you have a giant app, you should do some tests.

Virtual Path Problem


 I get the following error on last line below (working on remote host): 'E:\web\sfcascom\ls_admin/uploads/images/001.JPG' is not a valid virtual path,

Note that the slashes go in different directions

I've tried a number of things but nothing seems to work. Thanks-


Imports System.Drawing
Imports System.Drawing.Drawing2D
Imports System.Drawing.Imaging
Imports System.Web.UI.WebControls

Imports System.Drawing.Imaging.ImageCodecInfo
Partial Class Protected_imageupload
    Inherits System.Web.UI.Page
    Private Sub btnUpload_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnUpload.Click
        ' Initialize variables
        Dim sSavePath As String
        Dim sThumbExtension As String
        Dim intThumbWidth As Integer
        Dim intThumbHeight As Integer
        Dim sFilename As String = ""
        ' Set constant values
        'sSavePath = "images/"
        sSavePath = Server.MapPath("~/") + "ls_admin/uploads/images/"

        sThumbExtension = "_thumb"
        intThumbWidth = 160
        intThumbHeight = 120

        ' If file field isn?t empty
        If FilUpload.PostedFile IsNot Nothing Then
            ' Check file size (mustn?t be 0)
            Dim myFile As Http
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend