![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
| |
| | #1 (permalink) |
| Guest | x:Static with constants won't work (weird error + Class not found) I am trying to use a constant in a resource defined in my App.xaml. Everything's fine when it's hardcoded, but when I put in an {x:Static c:Constants.MyConst}, I get a couple of errors. The first one is the weirdest. As soon as I make the aforementioned change (this is all in Visual Crash 2005), I get a dialog about App.xaml not belonging to the project I'm debugging, so it can't enter break mode, "Usually, this condition occurs when the project was not rebuilt prior to starting the debugging session (not true), when the assembly file for the project is out of date (don't believe this to be true, although with 2005's f'ed up caching, who knows?), etc." Selecting OK gives me an exception: Type reference cannot find public type named 'Constants'. Error at Line 8 Position 30. I don't see what I'm doing differently from how the documentation describes, as my namespace appears to be fine, but it's as if the runtime doesn't even consider the namespace Here's my markup: <Application x:Class="MyNS.App" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:c="MyNS" StartupUri="MainWindow.xaml"> <Application.Resources> <ResourceDictionary> <XmlDataProvider x:Key="{x:Static Member=c:Constants.MyConst}" Source="pack://siteoforigin:,,,/Data/Objectives.xml"/> .... And the class is namespace MyNS { #region Referenced Namespaces using System; #endregion // Referenced Namespaces public static class Constants { public const String MyConst = "At least this error doesn't make VS.Net actually crash"; } } |
My System Specs![]() |
| | #2 (permalink) |
| Guest | Re: x:Static with constants won't work (weird error + Class not found) Turns out I *didn't* declare my namespace correctly. For non-XML namespaces, the xmlns:c decl has to be: "clr-namespace:MyNS" |
My System Specs![]() |
| | #3 (permalink) |
| Guest | Re: x:Static with constants won't work (weird error + Class not fo Hi Keith Try to ask in the Blend Forum. May be you become there faster anseer. http://www.microsoft.com/communities...&lang=en&cr=US Good luck Horst |
My System Specs![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Weird: No suitable graphic devices found | General Discussion | |||
| how to call a static method in a .net class from powershell? | PowerShell | |||
| Access a static member on a nested static class. | PowerShell | |||
| Access a static member on a nested static class. | PowerShell | |||
| Is easier WMI static class access in the works for 1.1+? | PowerShell | |||