How to trigger "IsRemoteSession" or "IsSoftwareRendering" in UserControl style?
We are developing usercontrols with .NET 4 - WPF. We have a lot of customers who are running our application in a remote session (e.g. Termina开发者_Go百科l-Server, Citriy, etc.).
Many of the performance issues are already solved. At the moment I'm searching for a way to disable animations in styles and controltemplates depending on the condition of IsRemoteSession
and/or IsSoftwareRendering
. I will do that without writing a line of code.
I'm pretty sure that I read a blog article some months ago in which it described a way to do that using a trigger in xaml, but I can't find it anymore.
Anyone have any hints....?
The way I would do this is by putting the animations inside the triggers. The code would look something like this:
<Window.Resources>
<Style TargetType="{x:Type WhateverYourTypeIs}">
<Style.Triggers>
<!-- Here I assume your whatever holds your IsRemoteSession property is your DataContext -->
<!-- Otherwise, change your binding -->
<DataTrigger Binding="{Binding Path=IsRemoteSession}"
Value="False">
<!-- Here you use Setters to add your animations -->
</DataTrigger>
</Style.Triggers>
</Window.Resources>
精彩评论