Problem with binding from style

Posted by Maurizio Reginelli on Stack Overflow See other posts from Stack Overflow or by Maurizio Reginelli
Published on 2010-04-02T21:36:44Z Indexed on 2010/04/02 21:43 UTC
Read the original article Hit count: 336

Filed under:
|
|
|

I have this block of xaml and I made a ViewModel which contains a property called MyBrush. I would like to set the grid background to that property but this block doesn't work. Could you tell me how can I do that?

<Style x:Key="myKey" TargetType="myType">
  <Setter Property="Template">
    <Setter.Value>
      <ControlTemplate TargetType="myType">
        <Grid Background="{Binding RelativeSource={RelativeSource Self},
                                   Path=MyBrush}">
...

© Stack Overflow or respective owner

Related posts about wpf

Related posts about c#