Xamarin dynamic forms - xamarin

The idea is to create an app in Xamarin with dynamic forms. The form definition is taken from any source like local DB or Web API.
The definition contains the set of fields and theirs's default values.
Currently my question is about view model.
Let's say the situation is clear with a view. I mean that user controls can be added to a view programmatically based on the form definition.
But how view model should look like in this case?
As a set of dynamic properties ? How to support user controls binding to respective view model properties ?
Any ideas or links to respective articles are welcomed.
Thank you in advance.

Related

Adding multiple views of same entity in sitemap in Dynamics 365

Is it possible to add multiple views of same entity in the Site Map(left navigation) in Dynamics 365. I need to add the default view as well as filtered view of Project entity on Left navigation. I have seen an option to add it as url instead of entity. Is there any other way to add multiple view of same entity?
Yes you can add the direct url addressable view link in sitemap. One for default view (maybe entity itself) and another for filtered view. This is the closest solution we tried in one of the implementation. Read more
Url="/main.aspx?appid=e2bc1066-488f-eb11-b1ac-000d3a56ead9&pagetype=entitylist&etn=account&viewid=%7b<GUID value of view id>%7d"
Alternate approach from the community using web resource can be found here.

Xamarin Forms - Access Prism INavigationService in View Model for Content View

As part of a Xamarin.Forms application I have implemented a custom navigation header. The Navigation Header is simply a Content View that has its own View Model. Pages which need to participate in the navigation experience of the application include this content view within them.
This application is using Prism 7 and to perform navigation within View Models I would like to use the Prism INavigationService. The issue I have with this is getting a reference to the INavigationService inside the View Model for the navigation Content View.
Accessing the INavigationService in a ContentPage is trivial, simply have this injected using constructor injection, the problem is that injecting INavigationService into the View Model for a Content View is not possible using prism 7 - this is confirmed by Brian Lagunas in his reply to this topic on the Xamarin Forums.
In his response Brian quotes as follows:
You can't inject the INavigationService into a ContentView's VM. You should either expose a property that you can bind to from your VM, or set it in code when the ContentView is loaded.
With the above in mind, what would be the approach to getting a reference to the INavigationService in the View Model of a Content View? I already have the wiring of the Content View to its View Model working correctly.
You already mentioned that there is no way to use INavigationService in your View Model for Content View (your custom control).
One of the easiest and simplest ways to resolve this is by adding bindable command in your Content View (custom control), having this bindable command you will be able to use that command and bind to it from ViewModels of your pages.
With this approach you can use INavigationService in your page ViewModel in a standard way and navigate from page based on command execution in your ContentView.
In other words you can handle your navigation from ViewModel when that command from reusable view is executed.
There is a lot of examples how to achieve this, you can use this one from another SO thread.
Wishing you lots of luck with coding!

Image button inside a Data table

I'm facing a scenario that i need to add image button inside a datatable. Is it possible to add an image button control inside a datatable.
I'm using Framework 3.5 and C# language.
Thanks In Advance!
Regards,
Ranga
I think you are trying to work with a user interface control like a DataGrid or DataGridView. DataTable is an ADO.NET class for holding data from a database. It doesn't present data in a user interface, so adding an image button maes no sense.
I presume you're working with a grid of some sort, but in order to get a sensible answer you need to tell us which one. Is your user interface WPF, Windows Forms, or ASP.NET? Specifically, which grid class are you trying to use?

Validating Dynamically added controls in ASP.NET MVC

I am trying to get validation to work for my very first ASP.NET MVC application. My problem is that all my controls were dynamically created. I have a Telerik tabstrip that has tabs that were dynamically (or programmatically) added. Each tab has a partial view with controls. The model that those controls map to is an Entity Framework model. I have decorated the model properties with annotations like “[Required]” (from System.ComponentModel.DataAnnotations;) and have added controls like Html.ValidationSummary and Html.ValidationMessageFor (for each field in your model) and I've been told it's supposed to work like magic! But it doesn't :(
Any ideas why my validation is not working? Do I have to do something special because the controls were created dynamically?
Steve
P.S. BTW, the server side validation works, but not the client side.
You need to store the datatypes and override the Validate() method on the Model. And verify casting works with the stored datatypes and the values of the dynamically created controls.. if the cast doesnt work return a validationresult.

Binding a Telerik Menu to a stored procedure in MVC3 with Razor

I am using the Telerik menu control in MVC3 with Razor. I noticed that the documentation on the Telerik website says it is possible but does not show how to bind the menu control to a stored procedure.
Has anyone had success doing this?
Data binding to a model seems the best way. So just design a view model that will represent your menu data and simply have your controller action call the stored procedure and populate this view model from the results of it.
It depends which ORM you are using. What telerik controls required is a model you populate you model using stored procedure as described by the ORM you are using and rest is the same. This link may give you some starting idea

Resources