AdaptiveTriggerLibrary icon indicating copy to clipboard operation
AdaptiveTriggerLibrary copied to clipboard

How to use ConnectivityTrigger from AdaptiveTriggerLibrary?

Open dmitrydvm opened this issue 8 years ago • 6 comments

Hi, I need using ConnectivityTriggers. In view I wrote this code: xmlns:connectivityTriggers="using:AdaptiveTriggerLibrary.Triggers.ConnectivityTriggers"

    <VisualState x:Name="disconnect">
        <VisualState.StateTriggers>
            <connectivityTriggers:NetworkConnectionStateTrigger
                Condition="ConstrainedInternetAccess"/>
        </VisualState.StateTriggers>
        <VisualState.Setters>
            <Setter
                Target="EditProfileButton.IsEnabled"
                Value="False" />
        </VisualState.Setters>
     </VisualState>
</VisualStateGroup>```
 
And this code not work. 
What I need write to ConditionModifier?

dmitrydvm avatar Dec 27 '16 07:12 dmitrydvm

Hey @boodoolak , you should use the EqualsModifier for that purpose.

For the Condition, you might need to use the fully qualified name in XAML for the ConstrainedInternetAccess. If this doesn't work, try to set everything from code-behind and migrate to XAML afterwards. Let me know if you have any issues.

Herdo avatar Dec 27 '16 11:12 Herdo

Thank you for answer @Herdo How can i set EqualsModifier in xaml? image image

dmitrydvm avatar Dec 27 '16 12:12 dmitrydvm

@boodoolak: The EqualsModfier is a generic class, therefore, you need to provide the type argument, even in XAML.

Herdo avatar Dec 27 '16 12:12 Herdo

I'm sorry, i'm not understand how to write it. Can you show code example, please?

dmitrydvm avatar Dec 27 '16 12:12 dmitrydvm

@boodoolak The official Microsoft docs might help you.

If you cannot follow that guide, or to make it easier for yourself, you might want to derive from NetworkConnectionStateTrigger in your own class, where you specify all generic constraints etc.

Herdo avatar Dec 27 '16 13:12 Herdo

Don't understand how to apply the information from msdn to this case. Can you simply show how to correctly specify the ConditionModifier?

dmitrydvm avatar Dec 27 '16 13:12 dmitrydvm