locked
Can I TwoWay bind to a staticresource integer?

    Question

  •  I have this in my app.xaml:

    <system:Int32 x:Key="ChartWidth">300</system:Int32>

     And I have this on a page:

     

    <TextBlock Text="{Binding Source={StaticResource ChartWidth}, Converter={StaticResource IntToString}}" Foreground="Black" FontSize="18"/>

      It shows the 300.

     

    But if I change it to:

     

    <TextBlock Text="{Binding Source={StaticResource ChartWidth}, Converter={StaticResource IntToString}, Mode=TwoWay}" Foreground="Black" FontSize="18"/>
    

      I get a parsing error.

    Is this not allowed?  And if not, how can one do that?  I want to have a resource that a slider can change so that it will affect all other objects bound to it.

    Thursday, May 27, 2010 3:32 PM

Answers

  • Hi,

    Is this not allowed?

    Yes.

    You should declare a type with ChartWidth property and use entity of that type for binding.

     

    Thursday, May 27, 2010 3:50 PM