How can I restrict the area that a WPF shader effect gets applied to, in a similar manner to the way the obsolete BitmapEffectInput.AreaToApplyEffect
used to work for BitmapEffects
? Is there an equivalent property for shader effects, or do I have to add it myself within each and every shader effect that I'm writing?
views:
37answers:
2Nope, man... have you?
luvieere
2010-08-12 09:16:57
Unfortunately not but trying hard to find a one. Lets see.
Saghar
2010-08-12 09:26:16
Can u please check the answer and tick it as answer if it helps?
Saghar
2010-08-17 07:26:53
+1
A:
Draw a layout (Grid, Canvas etc.), so that one or more cells contain the restricted area. Then draw a Rectangle or Border control on that particular area to get the desired effect you are looking for. Remember to add the Rectangle first, or play with ZIndex as I show below so that your code does not hide any controls.
<Grid>
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Rectangle Grid.Column="0" Grid.Row="1" Panel.ZIndex="0" >
<Rectangle.Style>
<Style TargetType="{x:Type Rectangle}">
<Setter Property="Fill" Value="Blue"/>
</Style>
</Rectangle.Style>
</Rectangle >
<TextBox Grid.Column="0" Grid.Row="1" Height="25" Margin="10" Text="Test 123" Panel.ZIndex="1" />
</Grid>
Saghar
2010-08-16 12:36:08
Not obvious from the description, but I see that the pattern is to apply the effect onto another element, over-imposed on the one I intend to transform trough the effect.
luvieere
2010-09-26 09:19:50