WinRT C++ assign a named style to an element programmatically - visual-c++

I have created several styles in the Application.Resources (App.xaml)
Was going to set these styles dynamically as the app was running.
I can not find a way to read the the App.xaml file in C++.
This is an example of what I have tried:
ResourceDictionary^ rd = ref new ResourceDictionary();
rd->Source = ref new Uri("ms-appx:///App.xaml");
Then I can not find any documentation of using the rd object!
I have found a lot of examples of read the resources from C#, but I have found no examples in C++
Even some of the MS documentation says "No code example is currently available or this language may not be supported." WTF!!!!!!
I have no choice in the language the app is being developed in. I am finding it extremely hard to do simple thing with C++/xaml. I have tried the same tests using C#/xaml and this just works (usercontrol binding/template binding with custom controls).
Can anyone give some guidance or direction where to look for this information.
thanks

Related

Sirius - Create graphical interface to xtext template language

in my project we use a Xtext template language to create some documents.
Similar to whats written here:
https://www.eclipse.org/Xtext/documentation/207_template.html
So basically a template starts with a « and ends with a »
In between we call xtend functions which define what will be visible in the output html document.
We would like to add a graphical editor to the already existing textual one.
I saw that Sirius can interact with Xtext and found the examples quite interesting.
What I could not figure out was how to tell Sirius to use my already existing xtend functions.
My question is: Is there a way to create a graphical interface for a xtedt template language with sirius or am i running in a dead end?
Thanks in advance
This seems doable, however it is not clear what you mean by "how to tell Sirius to use my already existing xtend functions". Maybe you could start by providing an example of what your templates look like, and the kind of representation you expect to have.
If I refer to the Xtext example you link, an Xtend function call in your template is an XBlockExpression. You would thus need to specify in Sirius an adequate representation for this metaclass.
Links that may help can be found here: https://www.eclipse.org/forums/index.php/t/1090448/

ExtLibUtil documentation - where do you find what the available functions are?

As I have asked questions in this form - thanks for your many helpful answers - i have found many really neat things that one can do using ExtLibUtil.???? however, other than a bit here and a bit there I have not found anything that gives a listing on the various functions. I one post I read that it is all in the source of the extension Library, and it might be if you really understand where in the source to look. Sure would appreciate a pointer and starting point.
I've been unable to find a JavaDoc for it. The library slipped passed us when we wrote the book - certainly I was not as au fait with Java to be aware of it and all the strength within it. So the best option currently is to look at the source code in Eclipse. Many of the methods are helper methods to easily access things like viewScope etc, which is easy from SSJS but less easy from Java. Most are pretty self-explanatory.
Content assist doesn't seem to work from SSJS, but will from any Java class or, alternatively, open up one of the Java classes created for XPages / Custom Controls under the "local" package in Package Explorer, type "ExtLibUtil." in any method and you'll see the list.

Xamarin - tutorials reference missing identifier field

I downloaded Xamarin a few days ago and started going through the tutorials but i cannot even complete a relatively simple tutorial
Xamarin Tutorial
I get to step "Create the UI" where on the StoryBoards it starts referring to an field called "Identifier" - i can not find this. Some posts i found on Stackoverflow suggest that this is now called Storyboard ID? However storyboard ID is not available on all objects. StoryboardID is only available for Controllers, in this specific tutorial it is trying to set a Table View Cell identifier (!??????).
The tutorial becomes completely useless then even from a basic understanding point of view because these IDs are used later on in the C# code.
I am almost certain that this problem is because of Xcode version changes between 4 and 5 or something however its incredibly frustrating for someone new to Xamarin when going through the basic tutorials that they don't make any sense when it relates to Xcode ):
If anyone could shed some light on this it would be great.
Thanks.
You should set Identifier for Table View Cell. In the tutorial on the image you may notice that cell is selected. And also in the tutorial written that you should set Identifier to retrieve instances of UITableViewCell, not for StoryBoard.

What can I do to make my sub-derived custom control appear in the Blend Assets library?

I am creating a series of window mockup templates based on the excellent Mockups library available on CodePlex.
I'm using their BaseMockup as the base for my control as well, and I followed the same outline of the steps listed here for sub-deriving from existing controls (Create a new empty class, add your default style to /Themes/generic.xaml, etc.)
The control is working great - the only thing is that it doesn't show up in the Assets library. I think this is because it's sub-derived, or because I need some attribute (the equivalent of the ToolboxItemAttribute for WinForms controls? ... which didn't work) to get it hooked up.
When I modify the code to derive directly from Control, it shows up - no custom attribute necessary. Of course that defeats the purpose of what I'm trying to do though...
The only thing I can find are several articles telling me to muck with registry keys, and none of them are clear or suggest a definitive way to do this with Blend 4. That last one advertises as a Blend 4 tips article, but admits at the end that it plagiarizes the content from the other two (for Blend 3).
Is that my only option - register my DLL? Is there a better way to do this?
A while ago I wrote a blogpost about this. I've included a .reg file and a .bat file for setting up the register and some directories. I think that's what you are looking for.
I believe you do need to muck with registry keys. Specifically,
32 bit: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NET Framework\v4.0.30319\AssemblyFoldersEx
64 bit: HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\.NET Framework\v4.0.30319\AssemblyFoldersEx
Create a new key with the name of your control assembly. Then edit the Default string value under this key and set the value to the directory where the control assemblies are installed. See here for a full example (using the Silverlight paths).
Found it - there is an analogue attribute after all, it's ToolboxBrowsableAttribute.
You have to go through a little more rigmarole to get it set up, but it works great - no registry mucking necessary. It requires creating a designer metadata provider class, attributing your assembly so it's designer-discoverable, and then adding the attributes to your sub-derived controls inside your metadata provider.
Make sure you choose the appropriate version of the page for your version of Visual Studio, because the interface changes a good bit between 2008 and 2010.
This article on CodeProject has some good, real-world examples of setting this up. They're all in the 2008 style though, so bear that in mind if you're using 2010.

Using the MSDN docs, is it possible to hide or filter inherited members?

One of the coolest features I've seen in help viewers is the ability to hide inherited members so you can focus on only what that particular subclass offers. A good example of this is here...
http://james.newtonking.com/projects/json/help/html/T_Newtonsoft_Json_JsonConvert.htm
Actually, that page has various options for how to show the help, not just hiding inherited members.
Now online MSDN has a habit of just throwing everything under the sun at you meaning trying to figure out what a subclass has added, let alone getting to it requires tons of scanning and even more scrolling.
That said, is there any way, local or online, to enable those or similar features? Has anyone made an external or third-party help viewer that does this or something similar?
(Note: I'm not really sure if this is for SO since it's not a programming thing, but it is sort of an IDE-related thing so I figured I'd gamble and put it here.)
Mark
Hiding inherited items is one thing I used to miss in the Lightweight style online MSDN docs.
Fortunately, it can be easily solved by using a litte bit of in browser javascript. See How to hide inherited members on MSDN pages for details.
You should be able to expand the used principle to hide any information you need (eg. you could use the icons to tell apart the static members, methods, properties and so on...).
Updated answer for 2016:
Create a bookmark in a modern browser with the following javascript snippet as the URL:
javascript:var trs=document.getElementsByTagName('tr');var l=trs.length;for (var i=0; i<l; i++) { var tr=trs[i]; if (tr.innerHTML.indexOf('(Inherited from ')>-1) tr.style.display=tr.style.display=='none'?'':'none'; }; void(0);
Clicking this bookmark while on an MSDN class documentation page will toggle all the inherited members on and off.
The javascript is just looking through all of the table rows ('tr') on the page, finding any which contain the string '(Inherited from ', and setting their display style (visibility) to 'none'. That search string seems to cover every instance of a member being inherited.

Resources