How to style using TemplatedControl within ItemsControl ItemTemplate - windows-runtime

I'm trying to make a TemplatedControl with multiple ControlTemplate and DataTemplates. Mainly this TemplatedControl will have a few ItemsControls. Now I'm trying to bind back to my TemplatedControl to get the DP's that style it.
In WPF I would basically do like {Binding RelativeSource={RelativeSource AncestorType={x:Type controls:CONTROL_NAME}}, Path=WHATEVER_STYLE} but in WinRT I can't get back to the parent control.
Is there a way to do this?

The one way I found was sticking the control with the styles in the Tag and pushing it down the tree. I hate this approach though

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.

CKEditor: Allow content in nested widget, which isn't allowed in parent

I'd like to know if it is possible to allow content in a nested widget which isn't allowed by the parent widget.
I tried to allow images in the nested widget (using "img[alt,!src];"). The parent doesn't allow images. I can place images in the inner widget but it's filtered afterwards (e.g. by switching to source code and back).
Unfortunately, as far as I remember this will not be possible. The whole content is first passed through the main filter, and then each of editables passes its content through its filter. Unfortunately, implementing widgets in CKEditor 4.3 (meaning - dozens of major relases since 3.0) we had many architecture limitations and this was one of them.
You can, however:
mark elements which should not be filtered with data-cke-filter="off" attributes, but this solution is pretty inconvenient, because all data-cke-* attributes are automatically removed when getting data from editor, so you would need to add it dynamically when loading data,
use editor.filter.addElementCallback() - with this you can disable filtering of a chosen subtrees. You will need to check context of the element that you're skipping, to allow these images only inside future widgets, but not outside them.

How to use the same ViewModel for different Pages (views)

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?

Polymer CoreInput set custom validation message and reverse direction

First
It looks like it's possible to set custom validation rules, but I'm wondering if there is any way to customize the validation messages (I need them to be in Arabic).
Second
Is it possible to reverse the direction of paper-input floating label (place it at top right instead of top left).
First
paper-input exposes a error attribute you can use to declaratively set a custom message. If you want to use core-input directly, that element exposes a setCustomValidity(message) for setting it.
http://www.polymer-project.org/docs/elements/core-elements.html#core-input
Second
That would be a good feature request to file against paper-input. I was able to get something working using CSS overriding, but the internals of the API could change in the future.
http://jsbin.com/megafucuvapo/1/edit

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.