EnableCacheVisualization not working - silverlight

I know I've made this work before but now I don't know what I am doing wrong.
I create a new hosted Silverlight application.
I added a button object on the MainPage.xaml setting CacheMode="BitmapCache"
I edited my default.apsx file to add the following lines to the silverlight object tag :
<param name="EnableCacheVisualization" value="true" />
<param name="EnableGPUAcceleration" value="true" />
<param name="EnableFrameRateCounter" value="true" />
But I cannot see neither the FrameRateCounter or the CacheVisualization... What am I doing wrong here.
Thanks

Make sure the Web Application is set as the startup project and that the Default.aspx is its start page. Also check that your app is compiling without error in some cases VS will just continue and run the original XAP when compiling a new one fails.

Maybe you have some startup code somewhere that sets those options back to False?
Try adding a button which shows the value of System.Windows.Interop.Settings.EnableCacheVisualization.
Otherwise, can you post your html page source?

Thank you both for your help, but I got my answer... It is really stupid, but those functions are not working with "Windows Server 2008"!!! I changed my workstation recently and wasn't aware of that.
got my answer here : http://msdn.microsoft.com/en-us/library/dd833062(v=VS.95).aspx
Hardware acceleration is only enabled on Windows Vista, Windows 7, and
Windows XP. On Windows XP NVidia, ATI, Intel cards with a driver date
post November 2004 is required for hardware acceleration.

Related

How do I trigger the WinForms DpiChanged event?

(No, I can't upgrade this codebase to .NET Core or newer yet.)
I have an app that's primarily Windows Forms, and partially WPF. When font size changes at runtime, WPF reacts correctly. Windows Forms, instead, doesn't even seem to realize anything has changed unless I restart. For example, the Control.DeviceDpi property (which wasn't even introduced until 4.7) shows the value that was accurate at startup, not the current one.
My app.manifest has:
<asmv3:application xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
<asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
<dpiAware>True/PM</dpiAware>
</asmv3:windowsSettings>
<asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">
<dpiAwareness>PerMonitorV2, PerMonitor</dpiAwareness>
</asmv3:windowsSettings>
</asmv3:application>
My app.config has:
<appSettings>
<add key="EnableWindowsFormsHighDpiAutoResizing" value="true" />
</appSettings>
But 4.7 did introduce a Control.DpiChanged event, only it never seems to fire.
Yet, if I override WndProc and listen to WM_DPICHANGED, that does fire. This code seems to suggest that the event should fire.
Apparently, it doesn't because this code conditionally turns it off. But I'm not sure which portion I don't qualify for. (I'm on Windows 10 21H1, so more recent than RS2.)

Why won't IE display my WPF component?

I made a component using a WPF control library component. In blend and Visual studio it's working as expected, but I can't make it work on IE when I open the xaml file with IE.
You're probably asking yourself "why would he need to make it work with IE?". It's simple: we are using a HMI SCADA software: Zenon (Copa Data). This software is supposed to support WPF components. To verify if the component will work in that software they tell to test it with IE in their documentation.
Of course, I tried to import the WPF component directly in Zenon before testing it with IE but it's not working.
Here is the xaml file:
<UserControl xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:lib="clr-namespace:ListeImitationMobileWPF;assembly=ListeImitationMobileWPF"
Height="Auto" Width="Auto">
<lib:MaListeMaintenance/>
</UserControl>
ListeImitationMobileWPF is the WPF control library which contains the component "MaListeMaintenance".
The error from IE: "The tag 'MaListeMaintenance' doesn't exist in the XML namespace ''clr-namespace:ListeImitationMobileWPF;assembly=ListeImitationMobileWPF'."
(Translation from french, I don't know if it's the exact english error message, original one:System.Windows.Markup.XamlParseException: La balise 'MaListeMaintenance' n'existe pas dans l'espace de noms XML 'clr-namespace:ListeImitationMobileWPF;assembly=ListeImitationMobileWPF'.)
Edit: I tried to put the .dll in the same folder but it's still giving me this error
Edit2: More information: The lib has been compiled with the 4.5.1 dotnet framework, VS/blend 2013. If you need more information ask me about it. Thank you
Edit3: Some more information: The lib only contains a UserControl which contains a Button. Nothing else. IE seems to be unable to look in my dll, so is Zenon. In a standard project you have to add the library to project references so he can find it. I don't know how I could mimic this without a project.
Ok so the problem is that Zenon can't handle newer dotnet framework version than 3.5. Thank you all for reading my problem.

Cannot cut text from textbox

When selecting "cut" from the TexBoxes' context menu, it works as if I did a "copy".
Same goes if I do a control-x, it simply copies instead of cutting.
Here is my simple dimple xaml
<Window x:Class="Window2"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Window2">
<TextBox/>
</Window>
Anybody have any idea what might be wrong?
ENVIRONMENT:
windows 7 Pro 64 bit
.net 4.5
in my situation, the culprit in the end was vnc viewer
you may find the following interesting or helpful
https://connect.microsoft.com/VisualStudio/feedback/details/798501/textbox-cut-bug-in-wpf
hope this helps you!
I just had this issue, and found the issue was due to Notepadd++'s Clipboard History feature. Once I closed the program, cutting worked perfectly.
It is definitely caused by external programs doing clipboard interference (probably incorrectly), as it was Notepad++ for me, and VNC for #Yisman. It should be considered a WPF bug though, since any non-WPF application can cut perfectly with Notepad++'s Clipboard History running.
My best guess, after looking at the details from the Connect post, is that the copy part of the cut command throws an exception, but throws is after adding the text to the clipboard. Other programs will still do the delete portion of the cut command, where WPF will skip it. This is reasonable, as it probably assumes it wasn't added to the clipboard, since the copy failed, but doesn't work well in this case.
I had the some issue using VS2015 on Windows 10 pro 64 bit as a Virtualbox 5.1.6 guest on a OSX host. The "problem" was the Virtualbox Shared clipboard between the guest and a host OS (Guest To Host).

Silverlight 5 input language override issue in Chrome/Firefox

Working on a fairly large Silverlight project I have an issue with Chrome/Firefox not respecting the input language set by the user.
In IE, if I change the keyboard language to Arabic, the input is in Arabic. If I do this while running the Silverlight application in Chrome/Firefox, then it doesn't matter what keyboard settings I have, the input is still in English.
Is there something way to override the input language which I am not seeing? I ask because if I create a new SL project with only a TextBox on the form, then all behaviour is correct.
Do you have param name="windowless" value="true" in your Silverlight param configuration? If yes, then remove this line and try again.
The property windowless has a problem with Chrome and Firefox with characters with accents, still I could not solve the problem.

Visual studio 2012 XAML designer invalid markup

I've got a project that contains usercontrols. For some reason, the design view for the window which uses the said controls has stopped functioning and insists on "Invalid Markup" - the error given is that some members of the usercontrols are not recognized or not accessible. The project however compiles and executes just fine. Loading it up in VS2010, the editor works fine, no errors whatsoever - the same even in Expression Blend.
So far I have tried the typical clean, rebuild, manually deleting stuff from obj, updating the .xaml and rebuilding, tried starting VS2012 with /resetuserdata and /resetsettings - the problem persists. I even rolled back to a much older revision of my project, back when the designer was working just fine, no dice - same error. I also tried launching VS2012 as a new windows user to avoid any stored appdata that might be lingering, again a no go.
Is there some other sort of cache or something that I could manually delete?
There's also an issue with the ShadowCache (used for rendering designer) getting out of sync with your XAML in VS2012. I just found this out, as I was having a horrible time with the following error with derived user controls:
The local property XXXX can only be applied to types that are derived from YYYYY.
The shadow cache is located in your user profile directory:
app data\Local\Microsoft\VisualStudio\11.0\Designer\ShadowCache
You can delete everything in there and restart VS2012. After that, things worked much better (for at least a while!)
Delete everything in ShadowCache
C:\Users\username\AppData\Local\Microsoft\VisualStudio\11.0\Designer\ShadowCache\
Copy-pasteable paths
Just copy/paste one of these paths into Windows Explorer. %LOCALAPPDATA% is a Windows Environment Variable it will be replaced with the corresponding value when entered into Explorer (also works in Command Prompt)
VS2012
%LOCALAPPDATA%\Microsoft\VisualStudio\11.0\Designer\ShadowCache\
VS2013
%LOCALAPPDATA%\Microsoft\VisualStudio\12.0\Designer\ShadowCache\
VS2015
%LOCALAPPDATA%\Microsoft\VisualStudio\14.0\Designer\ShadowCache\
ASP.NET
If you develop ASP.NET also delete
%LOCALAPPDATA%\Microsoft\WebsiteCache
%LOCALAPPDATA%\Temp\VWDWebCache
I'm not sure this will fix all cases but this is what worked for me (all the time now).
I have VS2012, using the Blend designer in the IDE, building an x64 application, when I would define a new ICommand and add the Command attribute, I would get the designer isn't supported in x64 error (I forget the exact warning). If I switch to x86, I'd get invalid XAML markup errors complaining the the ICommand wasn't recognized or was not accessible, no matter how many times I rebuilt in x64. If I switch to x86, build, then switch back to x64, voila, not problems with the designer.
Now I recall similar issues with VS2008 and Blend version 3 and 4. From what I've read in other posts, using Any CPU might also resolve the issue.
May be you have added user controls which are not supported or you might have added some wrong parent-child relationship in your user controls . Try removing the suspected User Controls and rebuilding the project . It must fix the issue .
Cheers
You need to re:encode your xaml, open bugged files in ide -> save as -> save encoded (choose UTF8)
I've the same problem while using controls with a custom (no param) Constructor.
Check if the Custom/User Control constructor doesn't require any data that the WPF designer doesn't have. A quick wait to check that is surrounding the whole thing with a try catch, cleaning, rebuilding and then check to see if the problem is solver.
If it is not, try commenting everything except the default WPF Init cod, clean, rebuild and test it out.
In Visual Studio 2013 this is a workaround I using for my Windows Phone Project, http://danielhindrikes.se/visual-studio/workaround-for-invalid-markup-problems-when-developing-for-windows-phone/. I guess it is the same designer that is used when you writing XAML for WPF.
Have tried to delete Shadow Cache but itjust work first time I start Visual Studio, above workaround is the only thing that helped me.
A little late, but something else to consider: If your no-parameter constructor is doing some other work, like getting data that doesn't exist because you are in the designer, add this at the start of your constructor:
if (DesignerProperties.GetIsInDesignMode(new System.Windows.DependencyObject())) return;
// Do work.
This is necessary because the designer does execute your no-parameter constructor which may fail in design mode an give you the invalid markup.
And, regardless of what others are saying, this is not a VS or WPF XAML Parser bug. I ran into this issue today using VS 2015, .Net 4.5.2.
I just had the same problem (program compiling and running fine, XAML designer reporting invalid markup), the issue was that I had accidentally changed the assembly name of one of the projects in my solution, I changed it back and my XAML designer sprang back to life, so check the Properties page of each project in your solution, and ensure the Assembly Name is as you expect it to be.
I think there is no problem in your project, but it is problem in VS 2012. Try to install the latest update for VS 2012 (Update 2) and also check this answer.
Regards,
I have the same Problem with VS 2015 and 2017 but only if I compile for x64 only.
Here it helps if I change compile target (Project properties - Build, its called Plattformziel in german) temporarily to x86, compile to project and switch back to x64.
Maybe this is a "solution" for anybody else.

Resources