I have these files.
"Control.cs" [this has method activateabc()] and "abc.xaml" in an assembly (created as a Class Library) and I have referred it in my working project(Windows Phone 8.1 Runtime App). I have added
Frame.Navigate(typeof(abc)) within the activateabc() and when I call activateabc() from the working project it throws XAMLPARSEEXCEPTION.
Any idea how do I navigate to XAML page in another assembly? Also I have no dots or hypens or underscores in any of my assembly names.
Edit: NavigationService.Naivage()is available in Windows Phone 8 to do the job. However, Frame.Navigate() allows navigation to a type rather than to a URI as in WP8. So please tell me a way how to navigate to a XAML page in different assembly in Windows Phone 8.1 Runtime Apps
Can you provide more information please? I don't have an answer but I do have some additional information that might help.
Do you know if it's failing to parse the xaml markup or is it in truth failing to find the abc.xaml file? I bet this is the real problem. If it's failing to find the file you might need to modify the xaml file Uri to include the assembly name. I don't know how to override the default file load location for pages since that code gets generated but the Uri would look like this.
If your assembly is MyCustomControls.dll then the Uri would be new Uri("ms-appx:///MyCustomControls/abc.xaml").
If your xaml file is found but some markup is failing you might try to comment out all the markup until there is no load failure then comment it back in by bits until you isolate which bit of markup seems to be the problem. It might be some namespace resolution issue in the app's xamltypeinfo.g.cs. I doubt this is the issue though since you say you added the assembly as a reference.
I hope some of the above information is useful.
Related
I am coding a UserInterface for our ETO Autodesk CAD Software. This is done as a simple add on in C#. Effectively its a class Library DLL placed under a certain path.
Now at the point I need to show images in the user Interface I get this message: The argument docData must implement the interface IVsTextStream.
The code is not saving anymore and eventually the complete windows form is suddenly empty.
I try to use pictureBox or add the image directly on the tab of a tabcontrol. I used different file formats like png or bmp. Always the same Error.
Hope someone can help. Internet does not show anything.
Same Problem occurs to me for a windows application. I have searched for the same issue and find somewhere that "deleting resx file from the form may help you." Well, my issue was resolve after doing so.
Hope it will be helpful for you.
VS2019 (16.9.2) Got the The argument docData must implement the interface IVsTextStream
My case happens when importing new thing to resx. (Inserting an image to the form or control also counted as importing thing to resx) I compared my project the working one and noticed wrong file dependency, I made the following fixes:
Note that this is WinForm for .NET framework, not .NET core. When creating new project in VS there are 2 separated project templates:
"Windows Forms App (.NET Framework)" <- I'm using this one
"Windows Forms App" <- This one will be using newer gen of cross platform .NET family
My fix
I found that my resx was parented in wrong fashion. MainForm.resx should be parented (dependent upon) MainForm.cs
I found that my resx was associated with wrong tool. Correct one for my form's resx is 'blank'. Note that Custom Tool for application global Resources.resx should be PublicResXFileCodeGenerator
For OP's case of blank form after error dialog
I also suffered from this, and I has confirmed that the designer somehow confused and actually REMOVED all of your form contents. This cannot be undone, unless you have version control, sadly.
Note before reading: This is a general question, that I chose to ask about a specific extension, but the answer should be the same... I guess.
I've started to implement localization in my project, and I'm using the WPF Localization Extension lib, but I have a few questions:
In order for the lib to work, it's is required to add this definition to every xaml page:
xmlns:lex="http://wpflocalizeextension.codeplex.com"
And I have 2 questions regarding that:
1. What if the URL goes off, for some unknown reason? Will my application just lose all of the extension's functionality? Is there an option to someone avoid using the url, and instead using some local file or something...?
2. I'm using calibrun.micro, and obviously my application has a few pages, and they're all embedded within the ShellView.xaml page through a ContentControl. Is there an option to write the namespace declarations (xmlns:lex, etc... - see code below) in just the shellview and have it affect all of the other pages automatically? It sounds really inefficient to have to specify the declarations in each single xaml page.
Extra Info:
Extension page: http://wpflocalizeextension.codeplex.com/
Namespace declarations/definitions:
xmlns:lex="http://wpflocalizeextension.codeplex.com"
lex:LocalizeDictionary.DesignCulture="en"
lex:ResxLocalizationProvider.DefaultAssembly="WpfApplication3"
lex:ResxLocalizationProvider.DefaultDictionary="Strings"
1 - That url is only symbolic. It doesn't point to an actual internet address. it could be "http://whatever.com" and it would still work as long as it is exactly the same as the xml namespace defined in the XmlnsDefinition in the assembly you're referring to.
To be clear, it's just a name (which just happens to have an internet-like format), not a website address.
2 - No, there's no way to declare a project-wide xmlns. That's one of the loudest complains we have to microsoft, but they abandoned WPF in favor or WinRT so I'm not hoping for a fix.
I've recently begun work on an audio application using C#.NET. I've begun some basic implementation of the NAudio library which I intend to use throughout the project. While looking at NAudio's documentation on CodePlex I found a link to the WPF Sound Visualization Library, I was attracted by one of its features in particular which I knew I would require in my app.
So I downloaded and added it to my project References.
I've copied how it is referenced within a window's XAML document, like so:
xmlns:svl="clr-namespace:WPFSoundVisualizationLib;assembly=WPFSoundVisualizationLib"
and then tried to add a control within the library using:
<svl:WaveformTimeline x:Name="testWaveformTimeline"/>
The problem is that the designer/XMAL editor claims: "svl:WaveformTimeline" does not exist in namespace "clr-namespace:WPFSoundVisualizationLib;assembly=WPFSoundVisualizationLib".
Now I know that it does exist. I can make reference to the WaveformTimeline object in the class file, and the object shows up in Visual Studio's Object Browser.
I'm not at all sure why this is the case. If anyone knows any possible solutions to this, or things I should check any help would be appreciated.
I had the same issue and I just found the solution:
By right-clicking on the WPFSoundVisualizationLib .dll I had to 'unblock' the file which had been marked as 'unsafe' by windows because the file were coming from a WebSite. Weird but it was obviously the reason I couldn't use the WaveformTimeLine in my project. A bit late but maybe still worths to post it.
More info here: https://msdn.microsoft.com/en-us/library/dd409252(VS.100).aspx
I have an existing application that I'm supposed to take and create a "mini" version of. Both are localized apps and we would like to reuse the resources in the main application as is. So, here's the basic structure of my apps:
MainApplication.csproj
/Properties/Resources.resx
/MainUserControl.xaml (uses strings in Properties/Resources.resx)
/MainUserControl.xaml.cs
MiniApplication.csproj
link to MainApplication/Properties/Resources.resx
link to MainApplication/MainUserControl.xaml
link to MainApplication/MainUserControl.xaml.cs
MiniApplication.xaml (tries to use MainUserControl from MainApplication link)
So, in summary, I've added the needed resources and user control from the main application as links in the mini application. However, when I run the mini application, I get the following exception. I'm guessing it's having trouble with the different namespaces, but how do I fix?
Could not find any resources
appropriate for the specified culture
or the neutral culture. Make sure
\"MainApplication.Properties.Resources.resources\"
was correctly embedded or linked into
assembly \"MiniApplication\" at
compile time, or that all the
satellite assemblies required are
loadable and fully signed.
FYI, I know I could put the user control in a user control library but the problem is that the mini application needs to have a small footprint. So, we only want to include what we need.
You are correct that the different namespaces are the problem. A resource file cannot be given a namespace, it will take the namespace of the folder that contains it. If the namespaces across your two apps are different, the namespace will be different.
I can see three options available to you
Use the same default namespace for both applications
Have an assembly purely for your resource file and reference that in both apps
In the code loading the resource, generate the namespace based on the namespace of the class that's loading it
The Resources generated by visual studio are not public, they are only visible to classes within a library. in order to generate resources as public properties you will need to use a custom generator like this: http://www.codeproject.com/kb/dotnet/ResXFileCodeGeneratorEx.aspx
Greetings all,
I'm trying to localize a .NET/C# project. I'm using string resource files and setting the "Localizable" property on all my forms to 'True'. The assembly culture is empty. The resx/resource files are successfully passed through Lingobit, resgen, and al.
When running the localized executables, some of my forms are not localized (ones in which I know the Localizable flag is set) while others are. There are even a few forms which are localized but a button or two isn't. I cannot tell any difference between the non-localized forms/controls with the localized ones.
Anyone have an idea what I might be missing? Thanks!
When you open the form in Visual Studio, if you change the Language property of the Form to the language you are localizing to, does the same problem exist there? Could it be possible that the non-localized forms/buttons still have the English text set even in the localized resources?
Yeah, I'd go with Andy on this and be suspicious of the contents of the resource files. We dabbled with localisation for a time, and encountered a number of issues, but this certainly wasn't one of them.
If that isn't it, then how are you testing your app? If you haven't tried this already I'd suggest firing up a set of VMs with foreign language versions of Windows installed (rather than just changing the language settings on your machine) and seeing if that makes any difference.
Okay, I figured it out. You guys were correct. We were not generating the translated resx files correctly from Lingobit. Some of the files would get translated while others had the English text still in the resx.
Thanks for your help!
EDIT: Just to expand upon this, we specifically were messing up the al.exe command which takes the binary .resources file and creates a satellite assembly adding it to the executable's manifest. In the /embed command, you have to bind the resources file to a namespace. Our top-level name spaces were mapped correctly, but we weren't binding to sub-level namespaces on all of the resource files.