PhoneApplicationPage can not resolve StaticResource - visual-studio-2010

At some point Visual Studio (2010) stopped resolving any static Resources (Brushes, Styles, ViewModel locators, etc.) on all PhoneApplicationPage. However any VisualEllement from with a UserControl can see all StaticResources.
Note: All resources worked before and there wasn't any changes to the pages in terms of XAML.
Any ideas why this is happening?
Temp fix: Temporary fix I came up with is to add All resources to PhoneApplicationPage.Resources so before trying to resolve resources at the application level, elements will resolve them from RD of the PhoneApplicationPage.
Edit: All StaticResources are resolved when running in Blend, this issues seems to happen only in VS. Also when creating a new Page in the solution it also can't resolve any StaticResources.

There are a couple of things you could try.
Create a new page. Can you access StaticResources from there? If
you can, you can narrow down the cause to the xaml for the pages
where you are having trouble now. Check the xmlns declarations from
the new [age against the old to verify nothing has been accidentally
removed, for example.
If you have access to Expression Blend, try
opening the solution there and then right-clicking on an element to
apply a resource. I have a feeling that the tool might be able to
fix issues, but never having seen this behaviour before I can't
guarantee it.
Also, are your resources defined in app.xaml, or have you specified another file containing the resources? If the latter, has the plumbing to tie the extra file in gone AWOL somehow?

Related

Events are disabled in codenameone

I have problem when I want to access events. I already copied the resource files (nativej2me.res) under src directory but still the events are disabled within my project.
Can anyone help me how to arrange the resources so it enables the vents..?
Thanks
Don't move that resource file. Its not the place for it.
I'm guessing you created a handcoded application where GUI builder events aren't supported. You need to create a GUI builder project when creating a new project.
That's a GUI builder project (notice the visual not manual in the brackets)
Just for the googlers out there:
Have a look in the file codenameone_settings.properties - in there you'll find the property userClassAbs=something/StateMachine.java
Its an absolute path and it was showing the wrong directory. After fixing this I was able to add Events in the Designer again.

References for MVC extension methods differ between vbhtml and cshtml files?

I am converting the login views of an application from vbhtml to cshtml. In the vbhtml files the original developer calls an Html.LabelWithAttributesFor extension method. When I write the same line of code in the new cshtml file the extension method isn't available via Intellisense and fails to compile. Are references not shared between vbhtml and cshtml files in a project?
Wanted to circle back and close this question with the "answer". In the end, what seems to have knocked something loose was when we removed the vbhtml pages from the solution. All use of the Extensions had been removed prior to our removing the vbhtml pages and other developers had worked on the solution in the interim making other changes. Fast forward a few months to another developer needing the extensions. He added a reference to the project with the extension methods and used them on a new cshtml page, which worked fine. So, the problem is solved but I still have no idea what caused the problem in the first place and I have been unable to reproduce it.

Global.asax.cs is not visible at the server

Running under Server08 | IIS7. I have a website project and am in the habit of hand editing the Global.asax.cs at the deployed site many times in the past. Recently I've found that only the Global.asax is present and has only:
<%# Application Codebehind="Global.asax.cs" Inherits="myDomain.MvcApplication" Language="C#" %>
There are simply no Global.asax.cs files present/visible for any of my active, functioning websites anymore.
I've checked here Global.asax can't find code-behind class and here where is the codes in Global.asax in mvc3? without getting anywhere. The second link contains the comment: 'That's because it's a compiled web application. You'll have to view it in Visual Studio as a project.'
But since my project has always been a website - and I've not converted it (intentionally) I'm puzzled by the changed behavior.
But when i step into VS12 and look at the context menu for the solution's WebProject it presents 'Convert to Web Application'. The sites' folder structures do not contain App_Data or App_Start. To my mind, these 2 fact establish at VS is treating the project as a website, why then, is the Global.cs compiled down to the /bin?
I'll close by repeating - I've hand edited these things in the past - I'm not positive but it's probably accurate to say that this is the first time I've tried to do so after installing VS12. And, coming to think on it harder - it's only recently that I've implemented the 'One Click Publishing' service so that could be coming into play.
verify? I'd like I need to edit a simple update without full re-deployment.
thx
I think the 'One Click Publishing' is most likely the culprit here. I created a sample Web Site project to experiment, and when I use the publish feature in Visual Studio, the files generated are indeed missing the Global.asax.cs file. Instead, a bin folder is created with a compilation called "App_global.asax.dll" even though it is a Web Site and not a Web Application. I am guessing this might be similar to what is happening for you as well.
If not, I found a link which might be useful to you in order to once again be able to edit a class on the server. Particularly, have a look at the second answer (the one not accepted as the best answer) to recreate a class file for the global code: Where is the Global.asax.cs file?
I tried this solution, and verified that the class file is editable on the server, and that it is dynamically compiled at run time (the modifications I made to the file worked immediately).
Hope this helps!
After editing the global.asax you need to rebuild and upload the DLL to the bin folder. Otherwise, your changes will not take effect.
You might be able to upload an web version of the global.asax that includes the code in that one file, which obviously does not require a .cs code behind. I used to do it with aspx files in an application but I have never tried it in the GLobal.asax file.

shadow message in Wolfram Workbench 2.0

I am writing documentation for a package with WB 2.0.
Very often, when I create links or insert cells using the documentation tools palette, I get the following message:
GlobalStyleNames::shdw: Symbol StyleNames appears in multiple contexts {Global,System}; definitions in context Global may shadow or be shadowed by other definitions. >>
This message appears even after I start a new session of Workbench - Mathematica.
Except for this, everything else seems to work fine. The documentation pages seem ok, although I have not yet made a "Build". Links, for ex, work as expected.
Can you explain why I get this message and how to fix it?
Should I expect problems at the Build stage?
The only "hint" I can give (maybe irrelevant) is that the first time I created the symbol pages (automatically from the usage messages), WB got "confused" somehow and included the pages for the Numerical sample package which I downloaded from the Wolfram Workbench web site. I erased these symbol pages and eliminated any link/connection/extension relating to this Numerical package and since then everything seems ok, except for the above message.
I just experimented a little further with this problem and this is exactly what happens:
Start WB 2.0
In package explorer, doubleclick on a .nb file so that MMA is automatically started as default editor (I use the CardDeck.nb file in the CardDeck sample package found on Workbench site)
When in MMA, open the DocumentationTools palette
Click on the sample tutorial page button (or most other buttons for that matter)
Bang! I get the message:
GlobalStyleNames::shdw: Symbol StyleNames appears in multiple contexts {Global,System}; definitions in context Global may shadow or be shadowed by other definitions. >>
in the message window.
So it seems that this problem is not related specifically to my package files, but is somehow linked to the DocumentationTools palette.
Does anybody else have this problem?
Is it a corrupted installation?
Thank you for any help
You could try switching off the automatic source loading for specific notebooks via Properties, Notebook Properties.

what is the correct build action for windows phone 7 image files?

I've been working on a Windows Phone 7 app, and after a bit of Googling it seems that for images that I have added to the Visual Studio project, I need to set the build action to "Content" in order to be able to reference the images in my app.
However, the Windows Phone List Application project template includes an image (ArrowImg.png) that has its Build Action set to "Resource", and is still available to be referenced from the application.
I was wondering if anyone could confirm that we should definitely be using the Content build action, or whether there is some way to access images added to a project with the Resource Build Action as shown in the project sample, which we should be using instead?
If you set the action to "Content" the image is included "as-is" in the XAP.
If you set the action to "Resource" the image is embedded into a shared DLL.
In a lot of situations you can use either. There may be a performance, or other, issue with using one rather than another but I'm not aware of and have never noticed any.
For what it's worth, unless I need to specifically make it a resource, I use content.
With the current (Beta) tools, I have seen VS complain that images directly referenced in XAML should be set to "Resource" (if set to "Content") but the app works fine with either. Hopefully this is an issue which will be addressed in the RTM tools.
For more information see the discussion in What are the various "Build action" settings in Visual Studio project properties and what do they do?
Either build action is correct.
Also worth looking at when resolving issues relating to build action is the pathing you use.
I've seen a fair few people running into trouble with this because they assume they've set their build action inappropriately.
You can set the build action either way to suit your requirements of when to incur the load time cost, you just need to adjust the pathing to suit.
Some more info on the topic from this post.
Set source to image in C#
You can liken content to the lazy
loading version of resources.
The difference is you will incur the
performance hit of all resources when
the assemblies are loaded to start
your app.
Content, on the other hand, the
performance hit is deferred to when
you use it.
Which is more suitable will vary on a
case by case basis.
Note also that the pathing to
reference resources and content is
different as can see here.
//Uri uri = new Uri("/Resources/Images/MyImage.jpg", UriKind.Relative); // Content
Uri uri = new Uri("/PhoneApp;component/Resources/Images/MyImage.jpg", UriKind.Relative); // Resource
BitmapImage imgSource = new BitmapImage(uri);
image1.Source = imgSource;

Resources