问题描述
所有人,
我想触发Border for Stackpanel保证金属性.
I want to trigger apply on Border for stackpanel margin property.
请在下面的附件中找到图像.
Please find below attached image.
谢谢
AANiruddhan
AANiruddhan
A.Acharya对我们的反馈在Windows Store中开发和推广您的应用程序,如果有帮助,请记住将其标记为答案,如果没有帮助,则将其取消标记.
A.Acharya Feedback to us Develop and promote your apps in Windows Store Please remember to mark the replies as answers if they help and unmark them if they provide no help.
推荐答案
<Border BorderThickness="10" HorizontalAlignment="Left" VerticalAlignment="Top">
<StackPanel x:Name="sp" Background="Transparent" Width="100" Height="100">
</StackPanel>
<Border.Style>
<Style TargetType="Border">
<Style.Triggers>
<DataTrigger Binding="{Binding Path=IsMouseOver, ElementName=sp}" Value="True">
<Setter Property="BorderBrush" Value="AliceBlue"/>
</DataTrigger>
</Style.Triggers>
</Style>
</Border.Style>
</Border>
确保StackPanel设置了Background(可以将其设置为Transparent或某种颜色的笔刷),否则IsMouseOver属性将不会设置为true.
Make sure that the StackPanel has a Background set (you could set it to Transparent or some colour brush), othwerwise the IsMouseOver property won't be set to true.
希望有帮助.
请记住,通过将有用的帖子标记为答案来关闭话题,然后在遇到新问题时开始新话题.请不要在同一线程中问几个问题.
Please remember to close your threads by marking helpful posts as answer and then start a new thread if you have a new question. Please don't ask several questions in the same thread.
这篇关于我想触发在Border申请Stackpanel保证金的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!