In my last post, I introduced XamlAsyncController, a POC implementation that shows how to render Xaml controls from ASP.NET MVC. I’ve modified the code a bit more, so that now you pass some ViewModel objects during the rendering process.
To recap, these are the two steps you need to do to render Xaml or a WPF control as an image from your ASP.NET MVC Controller
Inherit your Controller from XamlAsyncController, and add an Async action for serving the image
Add your Xaml file to the path /Visualizations/{Controller}/{Action}.xaml
Also, now there is one more way of rendering a WPF control from your MVC controller. You can create a WPF control from your controller and pass it as a parameter of StartRendering method, in your Async method.
The Gauge control XAML I’ve used in this example is the Xaml guage control developed by Evelyn from Codeproject – Credits to Evelyn.
Have a look at the Controller that renders the Button image and the Gauge image, in the shown html page. Read more: amazedsaint's .net journal
To recap, these are the two steps you need to do to render Xaml or a WPF control as an image from your ASP.NET MVC Controller
Inherit your Controller from XamlAsyncController, and add an Async action for serving the image
Add your Xaml file to the path /Visualizations/{Controller}/{Action}.xaml
Also, now there is one more way of rendering a WPF control from your MVC controller. You can create a WPF control from your controller and pass it as a parameter of StartRendering method, in your Async method.
The Gauge control XAML I’ve used in this example is the Xaml guage control developed by Evelyn from Codeproject – Credits to Evelyn.
Have a look at the Controller that renders the Button image and the Gauge image, in the shown html page. Read more: amazedsaint's .net journal
0 comments:
Post a Comment