Access Modifiers in XAML?

D

DanThMan

When declaring controls declaratively in XAML, how can you set the
access modifier? Also, what is the default access modifier? Public,
private, internal, protected....?

The only thing I could found in the documentation was X:FieldModifier
and X:ClassModifier, but I get errors if I try to use either of these.
For example, if I try...

<Label x:Name="myField" x:FieldModifier="private">Example</Label>

....I get a blue squiggle under X:FieldModifier, and in the warning
list, I get the following:

"Warning: The 'http://schemas.microsoft.com/winfx/2006/
xaml:FieldModifier' attribute is not declared."

Thanks for any insight you may have on this!

-Dan
 
D

DanThMan

Dan,

Is x the namespace alias in the XAML for thehttp://schemas.microsoft.com/winfx/2006/xamlnamespace? It would seem like
you have it as something else, perhaps.

--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)


When declaring controls declaratively in XAML, how can you set the
access modifier? Also, what is the default access modifier? Public,
private, internal, protected....?
The only thing I could found in the documentation was X:FieldModifier
and X:ClassModifier, but I get errors if I try to use either of these.
For example, if I try...
<Label x:Name="myField" x:FieldModifier="private">Example</Label>
...I get a blue squiggle under X:FieldModifier, and in the warning
list, I get the following:
"Warning: The 'http://schemas.microsoft.com/winfx/2006/
xaml:FieldModifier' attribute is not declared."
Thanks for any insight you may have on this!

The namespace alias is automatically generated my VS 2005. I didn't
touch it. Here's a paste of my Window statement:

<Window
x:Class="MyProject.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="My Project"
Height="768" Width="1024"
Thx,

-Dan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top