System Type Exception: Char

I am trying to create a reusable value System:Charin my resources xaml.

I have:

xmlns:s="clr-namespace:System;assembly=mscorlib"

Then:

<s:Char x:Key="MaskPromptChar">#</s:Char>

I get an exception:

The type 'Char' was not found. [Line: 8 Position: 44]

But ... I also have:

<s:Double x:Key="DefaultControlWidth">200</s:Double>

AND...

<s:String x:Key="ApplicationTitle">My Title</s:String>

Both Stringand Doubleare working properly.

Ideas ??

+3
source share
2 answers

This code works for me in both Silverlight and WPF.

<UserControl.Resources>
<sys:Double x:Key='myDouble'>4</sys:Double>
<sys:Char  x:Key='myChar'>#</sys:Char>
</UserControl.Resources>
<StackPanel x:Name="LayoutRoot">
  <PasswordBox Password='aaa'
               PasswordChar='$' />
  <PasswordBox Password='aaa'
               PasswordChar='{StaticResource myChar}' />
</StackPanel>

What property are you trying to assign to char?

+1
source

, Char , , , , - 16- , Unicode. XAML , Char struct, .

, String .

UPDATE. gmcalab mscorlib . . ( ?)

0

Source: https://habr.com/ru/post/1767899/


All Articles