Prism helps us to implement collection of design patterns with well-structured and maintainable XAML applications, including MVVM, dependency injection, commands, Event Aggregator.
Prism MVVM helps to clean separation of concerns between the user interface and the model behind it. A major advantage of MVVM is data-binding to display information and respond to user input.
Installing and using the Prism Template Pack
Go to Tools > Extensions and Updates select Online and search for Prism Template Pack. Locate the extensions, click Download, and complete the installation. Click the Restart Now button.
Now that we have the Template Pack installed, lets create a new solution. Go to File > New > Project... select Installed > Templates > Visual C# > Prism. Here you will find all the templates available for a new Prism project/solution.
Select Prism Unity App (Forms) Visual C# fill in the name of your project/solution and click OK
Create SfDataGrid using Prism
Within the Portable project there is a Views folder. This folder will contain all your view related code.
Right click on the Views folder, click Add > New Item... under Installed > Visual C# > Prism > Forms select Prism Content Page (Forms)->your view page name and click Add. This creates a blank content page and equivalent ViewModel class in ViewModels folder.
You can define the SfDataGrid using the below code example:
xmlns:prism="clr-namespace:Prism.Mvvm;assembly=Prism.Forms" is prism namespace
We need to set prism:ViewModelLocator.AutowireViewModel as True to the view model (MainPageViewModel.cs) automatically via naming conventions allowing for databinding to the view model.
Using the below code example, you can navigate the page to View page and register the classes using RegisterTypes override method.
|Article ID:||Published Date:||Last Revised Date:||Platform:||Control:|
or the page will be automatically redirected to sign-in page in 10 seconds.