I think I have not explained correctly. So i have just edited the previous post.
Please go through my exact requirement
I have user control with a button. I have written code to enlarge the button if it gets focus through rendering in style.
In my window, in the main grid i have placed 10 instances of this user control ( 1 control per cell, tot开发者_如何学Cally 2 rows and 5 columns).
Now, if i keep the focus on the first user control button, it expands correctly as it gets focus and also user control expands along with button but the expanded user control goes inside 2nd row user control. Because when i set the focus on the button user control IsFocused is still False
I have writtend the following code in the window resources, but it doesn't help me. (user control name is ucButtonControl)
Hope the requirements is very clear now. If any clarification on this then please let me know.
Here ya go (Note: I used a Canvas instead of Grid for easier demonstration):
<Canvas>
<Canvas.Resources>
<Style TargetType="{x:Type Button}">
<Style.Triggers>
<Trigger Property="IsFocused" Value="True">
<Setter Property="Panel.ZIndex" Value="999"/>
</Trigger>
</Style.Triggers>
</Style>
</Canvas.Resources>
<Button Background="Red" Width="100">Red</Button>
<Button Background="White" Width="100" Margin="5">White</Button>
<Button Background="Blue" Width="100" Margin="10">Blue</Button>
<Button Background="Green" Width="100" Margin="15">Green</Button>
</Canvas>
精彩评论