Trigger element (XAML) is not supported in a UWP project

前端 未结 2 713
隐瞒了意图╮
隐瞒了意图╮ 2020-11-29 04:51

I\'m developing a Universal Windows application for Windows 10 and one of the first things I found is that the Trigger element (XAML) is not supported when styling images. H

2条回答
  •  南笙
    南笙 (楼主)
    2020-11-29 05:23

    No, you don't have Trigger support in UWP.

    A workaround is to use DataTriggerBehavior with a ChangePropertyAction to accomplish the exact same thing.

      xmlns:Interactivity="using:Microsoft.Xaml.Interactivity"
      xmlns:Core="using:Microsoft.Xaml.Interactions.Core" 
    
    
    

    Note that you will need to include BehaviorsXamlSDKManaged from C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1\ExtensionSDKs\BehaviorsXamlSDKManaged\12.0\. You will get a warning when you add the reference but just ignore it.

    Update: You should be getting an updated Behavior SDK from nuget now.


    Option 2

    You can always do the same thing in VisualStateManager. Open Blend and right click on your Button and select Edit Template, Edit a Copy and then specify the resource name you want and hit OK.

    Then look for the Disabled VisualState and replace it with

    
        
            
        
    
    

提交回复
热议问题