Search Results

Search found 1 results on 1 pages for 'user1629894'.

Page 1/1 | 1 

  • Binding lineargradientbrush color with property

    - by user1629894
    I have a problem with color in gradientstop. I want binding offset color with my property that return color (System.Windows.Media), but not working and return defalt color Transparent. If binding same property with Foreground Label is working. This style is in ResourceDictionary. <Style TargetType="{x:Type TabControl}"> <Setter Property="Background"> <Setter.Value> <LinearGradientBrush StartPoint="0 0" EndPoint="0 1"> <LinearGradientBrush.GradientStops> <GradientStop Offset="0.1" Color="Black" /> <GradientStop Offset="1" Color="{Binding Path=MyColor}" /> </LinearGradientBrush.GradientStops> </LinearGradientBrush> </Setter.Value> </Setter> </Style> and it's working: <Style TargetType="{x:Type Label}"> <Setter Property="Foreground" Value="{Binding Path=MyColor, Converter={StaticResource ColorToBrush}}" /> </Style> my property is: public Color MyColor { set { myColor = value; NotifyPropertyChanged("MyColor"); } get { return myColor; } } Thank you everybody for answers

    Read the article

1