![]() The title is coming with fully functional name of the popup’s viewmodel. I don’t think I need to explain it again.Īfter the release, when I recheck iTraveller, I could see that the popup window is showing without the Title I had given in the xaml page. I just used the same approach he mentioned. In one of Rob’s post he explained in detail how we can achieve tabbed view. In iTraveller views like Preview, Search Result, Upload basket, etc are in tabbed view. Showing Views in Tabcontrols just like in Visual Studio ‘ca’ is my xmlns name reference in the page, it can be any name. If we set ca:View.Model=”” then Caliburn Micro is intelligent enough to set the View to the content control. After some search in Caliburn Micro code and googling I came across View.Model dependency property. I tried lot of ways to show my view in the content control but failed. The viewmodel should be binded to a ContentControl inside the border. The Listbox in xaml page has some custom template to add a border around the comments. In the viewmodel I will have a list of IndividualCommentViewModel. Public ObservableCollection IndividualComments View model code private ObservableCollection _individualComments Then we should add one dependency property to the content control. But if the Listbox has some custom templates and the view should show in a contentcontrol placed in the template. If there is no custom templates then no issues. In some scenarios you may need to bind a list of Viewmodels to a Listbox. How to Bind a ViewModels to a ListBox/ItemsControls that has Custom Template _webBrowserControl = myView.WebBrowserControl protected override void OnViewLoaded( object view) You can override OnViewLoaded function of Caliburn micro in Viewmodel and get your view as follows. But if in any case you need the reference of your View in your Viewmodel, no issues. Most of the case you don’t need a reference to the View. That’s it now you will get the DragEventArgs in your Viewmodel and do what ever you wanted to do with it. Have a look at my Viewmodel’s NewPhotosDropped function public void NewPhotosDropped( DragEventArgs e) If a PreviewDrop event happened in Listbox then call NewPhotosDropped function in my Viewmodel with parameter DragEventArgs. We can instruct Caliburn Micro to send these eventargs to the viewmodel function by adding a parameter with value ‘$eventArgs’. Obviously in you Viewmodel you need to get the DragEventArgs or KeyEventArgs to perform the desired action. Xmlns : i ="clr-namespace: assembly="Īs you can see in the ListBox I added an event trigger for PreviewDrop and KeyUp. You should add a xmlns reference to and Caliburn Micro in your xaml page as shown below xmlns : cal ="clr-namespace:Caliburn.Micro assembly=Caliburn.Micro" What we should do to capture the event is as follows. My first concern was how to capture drop event or Mouse Down Even or KeyUp Event using Caliburn Micro. If you had a chance to look at iTraveller then you can see most of the functionality is based on drag and drop features. In this post I am going to give a brief description about some of my blockers and how I overcome those.Ĭapturing PreviewDrop/KeyUp or any kind of event in Viewmodel In the development phase of iTraveller I come across lot of blockers related to MVVM model development using Caliburn Micro. I am sure once you start using Caliburn Micro you will never go back to normal codebehind approach in Silverlight or WPF or WP7 neither a different MVVM framework. Don’t underestimate Caliburn Micro by its name, it’s very powerful and easy to learn. My answer is yes, I used Caliburn Micro in very complex applications that have more than thirty pages and very complicated functionalities. Some of us are not using Caliburn Micro, the reason is they are doubtful whether it can used in big production level projects as it’s a micro. ![]() Last couple of months I did so many tracers and some large projects in Silverlight and WPF using Caliburn Micro, some tracers are just one page projects still I used Caliburn Micro because it’s very easy to develop compare to the normal code behind approach. Caliburn Micro uses Convention over Configurations, so zero configuration. In my opinion using Caliburn Micro as a MVVM framework wont overkill or complicate your development rather It will ease our development. Might be true if they use some complicated MVVM frameworks. Reason they say is, implementing MVVM in a small project is an overkill. Most of the us know what is MVVM model but most of us hesitant to use it in their development. If you haven’t used Caliburn Micro please go through Caliburn Micro Introduction 1
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |