LinearGradientBrush Color Binding (simple position of chart diagram)

EDIT: I had a hexadecimal value (string) that I converted to a brush, so it did not take my color, as if my colors were successfully executed:

(Color)ColorConverter.ConvertFromString(colorArray[0])

There remains only the problem of scaling (with colors).

My color bars seem transparent (once again), but now with the corresponding color attached to each bar. Also, when starting my program, all 6 bars are displayed (but they should not be displayed, because they do not matter yet). The code:

<Border Height="30" Margin="15" Grid.RowSpan="6" >
                <Border.Background>
                    <LinearGradientBrush StartPoint="0.0,0" EndPoint="1.0,0">
                        <GradientStopCollection>
                            <GradientStop Offset="0.0" Color="{Binding FillBar, UpdateSourceTrigger=PropertyChanged}" />

                            <GradientStop Offset="{Binding Value, UpdateSourceTrigger=PropertyChanged}" />

                        </GradientStopCollection>
                    </LinearGradientBrush>
                </Border.Background>
            </Border>

enter image description here

How can I get rid of transparent color fading in the middle / end of a panel?

When I try to add the same color to the second offset, I get the full length bars (100%) and the scaling is reset again.


ItemsControl DateTemplate, :

<ItemsControl x:Name="icGrafiek"  
            Margin="0,0,0,0" 
            ItemsSource="{Binding Source={StaticResource Grafiek}}"
            ItemTemplate="{DynamicResource GrafiekItemTemplate}" 
            RenderTransformOrigin="1,0.5" Grid.RowSpan="6" Grid.Column="1"/>

<DataTemplate x:Key="GrafiekItemTemplate">
            <Grid>
            <Border Height="30" Margin="15" Grid.RowSpan="6" >
                <Border.Background>

                    <LinearGradientBrush StartPoint="0.0,0" EndPoint="1.0,0">
                        <GradientStopCollection>
                            <GradientStop Offset="0.0" Color="#fff" />

                            <GradientStop Offset="{Binding Value, UpdateSourceTrigger=PropertyChanged}" 
                                          Color="{Binding Fill, UpdateSourceTrigger=PropertyChanged}" />

                            <GradientStop Offset="{Binding Value, UpdateSourceTrigger=PropertyChanged}" 
                                          Color="{Binding Fill, UpdateSourceTrigger=PropertyChanged}" />                                                          
                        </GradientStopCollection>
                    </LinearGradientBrush>                
                </Border.Background>
            </Border>
        </Grid>
    </DataTemplate>

.

: GradientBrush

GradientBrush Rectangle . GradientBrush, (Binding 1.0 0, ). 1.0-0.

Rectangle:

 <DataTemplate x:Key="GrafiekItemTemplate">
            <Grid>
                <Rectangle StrokeThickness="0" Height="30"  
                           Margin="15" 
                           HorizontalAlignment="Left" 
                           VerticalAlignment="Stretch"
                           Width="{Binding Value, UpdateSourceTrigger=PropertyChanged}" 
                           Fill="{Binding Fill, UpdateSourceTrigger=PropertyChanged}">
                    <Rectangle.LayoutTransform>
                        <ScaleTransform ScaleX="20" />
                    </Rectangle.LayoutTransform>
                </Rectangle>
            </Grid>
    </DataTemplate>

Rectangle Fill, ( ): Binding .

Rectangle


LinearGradientBrush , (, )? .

, , ? , .

, PeterP.

+3
1

Fill, Fill . Brush ( )

Color, , Color .

+1

All Articles