views:

9

answers:

1

Hi,

 <DataTemplate x:Key="StatusColumnTemplate">
            <Canvas>
            <Rectangle Fill="Red" Canvas.ZIndex="1"  Opacity="30" Height="{Binding Value, ElementName=Stacky}" Width="{Binding Value, ElementName=Stacky}"></Rectangle>
            <StackPanel x:Name="Stacky" Orientation="Horizontal">
                <Image Height="16" Margin="0,8,0,0" Opacity="{Binding Comment, Converter={StaticResource OpacityConverter}}"  VerticalAlignment="Top" Width="16" Source="grade.png" Stretch="Fill"/>
                <Image Height="16" Margin="5,8,0,0" Opacity="{Binding Grade, Converter={StaticResource OpacityConverter}}"  VerticalAlignment="Top" Width="16" Source="/Module.Reports;Component/thumb-up.png" Stretch="Fill"/>
                <Image Height="16" Margin="0,8,0,0" Opacity="{Binding Effort, Converter={StaticResource OpacityConverter}}"  VerticalAlignment="Top" Width="16" Source="notepad.png" Stretch="Fill"/>                       
            </StackPanel>
            </Canvas>

Currently the rectangle does not seem to bind to the height and width of the stackpanel. Is there anyway I can achieve it where a rectangle covers a datagrid cell with an opacity.

Thanks

A: 
Height="{Binding ActualHeight, ElementName=Stacky}" Width="{Binding ActualWidth, ElementName=Stacky}"

Please check your code use used Value instead you should bind it to ActualHeight and ActualWidth of the Stacky.

Avatar