c# - ViewModel does not exist.Simple MVVM WPF application -
hi im learing mvvm pattern wpf use in application. im not able bind anything, cause xaml code says "the name 'name' not exist in namespace 'namespace'".
my xaml code:
<window x:class="mvvm.mainwindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:mvvm.viewmodel" title="mainwindow" height="350" width="525"> <window.datacontext> <local:mainviewmodel/> </window.datacontext> <!--<window.resources> <local:mainviewmodel x:key="viewmodel"/> </window.resources>--> <grid> <button width="100" height="100" content="binding buttoncontent"/> </grid> </window> and have added mainviewmodel.cs. here code.
using system; using system.collections.generic; using system.linq; using system.text; using system.threading.tasks; namespace mvvm.viewmodel { public class mainviewmodel { public string buttoncontent { { return "click me"; } } } } im not able find proper solution. can me this?
Comments
Post a Comment