c# - ViewModelLocator in Prism 6 not working -
i trying implement viewmodellocator pattern in application, viewmodel not hooked view. new prism, please let me know if missing here.
view:
<window x:class="wpfapp1.mainwindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:wpfapp1" xmlns:prism="clr-namespace:prism.mvvm;assembly=prism.wpf" prism:viewmodellocator.autowireviewmodel="true" mc:ignorable="d" title="mainwindow" height="350" width="525"> <grid> <textblock text="{binding message}" fontsize="36" /> </grid> </window>
viewmodel:
class mainwindowviewmodel : bindablebase { string _message = "hello world"; public string message { { return _message; } set { setproperty<string>(ref _message, value); } } }
folder structure:
make sure views reside in views
namespace, , viewmodels in viewmodels
, respectively.
Comments
Post a Comment