Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Passing a static readonly value as a CommandParameter via XAML binding?

Tags:

c#

wpf

I have the following class defined:

public static class A
{
      public static readonly double MyWidth = 200d;
}

If I want to send "MyWidth" as a command parameter to a button, how do I set up the xaml for that?

<Button Caption="Large" CommandParameter="What should I type here?">

Thanks!

like image 265
user1202434 Avatar asked May 07 '12 14:05

user1202434


1 Answers

CommandParameter="{x:Static ns:A.MyWidth}"

where ns has been mapped to the appropriate CLR namespace.

like image 165
Kent Boogaart Avatar answered Oct 02 '22 20:10

Kent Boogaart