How to use the same ViewModel for different Pages (views) - windows-phone-8

I am searching for a way to use one ViewModel for two different Views (Pages). I know there is Multi-view support in Caliburn.Micro and I read a lot of it but I'm not sure if it is what I am looking for or how it works on Windows Phone.
Currently, I have one View ItemPage.xaml and one ViewModel ItemPageViewModel. I use this View/ViewModel to add a new Item and display an existing Item. Depending on the mode (add, show, ...) I need to show/hide or enable/disable some UI elements and display different AppBar buttons.
Instead of control these UI elements by binding to properties, I want to create two seperate Pages(Views) with the corrrect UI elements.
It would be nice to use the same ViewModel for both Pages to avoid repitive code. So is my use-case above possible with Caliburn.Micro for Windows Phone?

Related

Autodesk Viewer: Show a list of elements with specified Database IDs

The functionality I seek is very similar to the default ModelStructurePanel model browser, except that I need to list only a subset of elements, by passing a list of dbIds of the elements I want listed. By clicking on an element on that list, have the view focus on that element.
I figure there might be two ways of achieving this by using the ModelStructurePanel (although I'm open to using something else):
Creating a new instanceTree with only the specified elements, then doing something like viewer.modelstructure.setModel(newInstanceTree)
Overwriting the ModelStructurePanel.shouldInclude method to hide all elements but the specified ones.
I have googled for Viewer code boilerplate that would provide this functionality, but have not found it. Any help is very much appreciated.
There is a basic sample here very close to what you described, and I would go with customizing just one action instead create a new one, seems easier.

Changing selection resolution for component properties

Using the viewer, we can interact with the model browser to change the selection resolution in order to see different properties about a selected component. However, for most of our users, this is incredibly unintuitive. Is there a programmatic way to set the selection resolution used by the viewer's built in properties window so that we can control what properties are displayed when a user selects a component in the viewer? Or maybe there is a better way that is intended to allow developers to control which properties are shown within the viewer's built in properties window?
You can build your own property panel that will allow you to pass in the desired properties you want your users to see. I have done this in a sample listed below, where I populate in a separate table, not using the Viewer Toolbar, the different categories for the properties of the model. Try the Revit House model.
https://viewer-rocks.autodesk.io/
Also here is another demo where a Meta-properties panel got built that even allows you to modify the properties, remove, add new ones to that panel.
https://forge-rcdb.autodesk.io/configurator?id=5904729b0007f5ead5b1196d
You can see both source projects from Github.

I'd like two different styles for the List component

I have two list instances of the list component. I'd like them to have two different visual styles (skins), how can I accomplish this?
Sounds like you want to change an instance of a list component so it's skin/style (design) is different from another instance.
You can do this at runtime by using the list's setStyle() function.
Here is a list of styles you can change:
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/fl/controls/List.html#styleSummary
More or customizing UI components.
http://help.adobe.com/en_US/as3/components/WS5b3ccc516d4fbf351e63e3d118a9c65b32-7f50.html
http://help.adobe.com/en_US/ActionScript/3.0_UsingComponentsAS3/WS5b3ccc516d4fbf351e63e3d118a9c65b32-7f41.html

Dojo/HTML equivalent for list box control

We are porting our MFC based client to Dojo. Is there any widget similar to listbox control. At present I am using DataGrid, but that seems heavy and overkill for our purposes. Alternatively what is best widget to replace listbox.
Update: I have already looked at dijit.form.multiselect, and I dont think that meets my requirement. MFC Listbox typically looks like this. I dont see (or rather dont know) how to replicate this with multiselect. It is possible that DataGrid is best fit for the control.
If you use dojo 1.7, take a look at the new DGrid.
For an example looking like yours, go to the tests page and pickup the Selector.html example.
Here are some options depending on which part of the ListBox you want to create:
dijit.Dialog to create a basic dialog box.
dijit.form.FilteringSelect to create a drop-down with your options (single select only).
You could also use radio buttons or checkboxes for your options depending on whether multiple selections are allowed.

Using a single shared element across multiple partial views

I have a basic ASP.Net MVC 3 application which has a number of controllers and a number of actions (and subsequently views)
A common feature of the application is to show a pop-up dialog window for basic user input. One of the key features of this dialog process is a faded mask that gets shown behind the dialog box.
Each of these dialog window controls is in a separate Partial View page.
Now, some view pages may use multiple dialog boxes, and therefore include multiple partial views in them - which as is would mean multiple instances of the "mask" element.
What I am trying to find a solution for is to only need to create one instance of a "mask" element regardless of the number of dialog partial views I include, and then the script in each partial dialog will have access to this element (so basically it just needs to be on the page somewhere)
The only real idea I have come up with so far is to add the "mask" element to the master page (or in the original view page) and this will mean it only gets added once. The problem here is that it will be added even when it is not needed (albeit one small single element)
I can live with this, but I would like to know if there is a better way to handle these kinds of scenarios?
A quick idea that came to mind is some kind of master page inheritance hierarchy, So I may have a DialogMasterPage that inherits from the standard current master page. How does that sound for an approach?
Thanks
To do something like this, where each module can register their need for a certain thing in the master page, you can use HttpContext to store a flag of whether you need to write the mask div, and just set that property in each partial. At the end of the master page, if the flag is set, you can then write the mask div if its set to true.
Obviously to make this cleaner you could wrap it all in an HtmlHelper extension or something.
My initial thought is for you to use something like jQuery UI where it handles the masking for you or if you are using something custom you can load the content for the dialog via ajax then show it in the single dialog on the master page.