herdo / adaptivetriggerlibrary Goto Github PK
View Code? Open in Web Editor NEWA library for adaptive triggers for Windows universal apps (Universal Windows Platform).
License: MIT License
A library for adaptive triggers for Windows universal apps (Universal Windows Platform).
License: MIT License
Hello,
I have noticed that visual states cannot be resolved in the following situation:
Namely, If two states have exactly the same trigger, as a part of a multitrigger, the state cannot be correctly resolved. I've noticed this because a specific part of my XAML is being loaded only if a specific condition, set using multiple triggers, is met. This part of XAML contains an element that is customized from code behind, but the element remains null even though the conditions are met (scale = 200, orientation = portrait, Portrait_Scale200 state). If I remove the "scale" condition from the Landscape_Scale200 visual state, the app is able to resolve the state and present an appropriate XAML.
Why is this happening and what would be the proper way to setup multtriggers in this particular situation?
Hi,
I think I'm missing something fundamental here but how could I use multiple ControlWidthTrigger on the same TargetElement? Let's say I have a control X that should have the color green when width >= 200, red when width >= 300 and blue when width >= 400.
If I just use 3 Triggers, all of them fire when the width is >= 400 as they function independently of each other. The UWP AdaptiveTrigger (relating to Window Size) works exclusively though (having 3 triggers for three window states, they seem to exclude one another).
How can we implement this behavior without adding a "Start" AND an "End" property ("from width 200 to width 300")?
I've been having an issue with memory leaks in my UWP app and noticed that quite a few of the AdaptiveTriggers I was using in my applications were being help onto in memory. After some investigation I found that nulling the TargetElement when the view is Unloaded the memory was freed.
Below is an example fix to your MainPage.xaml.cs
private void OnUnloaded(object sender, RoutedEventArgs routedEventArgs) {
HorizontalRectangleFillTrigger.TargetElement = null;
VerticalRectangleFillTrigger.TargetElement = null;
Unloaded -= OnUnloaded;
}
*Edit
Not necessarily an issue, just something I wanted to flag to you and anyone else using your AdaptiveTriggerLibrary. Maybe it's something you could apply to your Wiki.
Unfortunately, adding the AdaptiveTriggerLibrary v1.1 to my project via NuGet fails:
Using source https://api.nuget.org/v3/index.json.
Using source https://www.nuget.org/api/v2/curated-feeds/microsoftdotnet/.
Restoring packages for UAP,Version=v10.0...
CACHE https://www.nuget.org/api/v2/curated-feeds/microsoftdotnet/FindPackagesById()?id='AdaptiveTriggerLibrary'
CACHE https://az320820.vo.msecnd.net/v3-flatcontainer/adaptivetriggerlibrary/index.json
Resolving conflicts for UAP,Version=v10.0...
Unable to resolve AdaptiveTriggerLibrary (โฅ 1.1.1) for UAP,Version=v10.0.
Adding any 1.0 version of AdaptiveTriggerLibrary still works though.
In any case: AdaptiveTriggerLibrary is a splendid thing!
Hello,
is there any trigger which works the same way like StateTrigger with IsActive property?
I mean if I can use any from your triggers like logical trigger with bound bool property.
Thank you,
Jakub
Hi, I'm using your nice library on my project.
I had trouble in using ConnectivityTrigger on project, when a changes made on network state I was getting the following error:
the application called an interface that was marshalled for a different thread. (exception from hresult: 0x8001010e (rpc_e_wrong_thread))
I've searched & said that the code should run on UI thread. After a lot of problem and tests, I found that the SetActive(IsActive);
on line 68 of AdaptiveTriggerBase.cs is the cause of that error, I surrounded the block with a Dispatcher.RunAsync and errors gone.
When implementing the nuget package and attempting to use the user interface control width trigger I receive the following error:
Child node "2" exited prematurely. Shutting down. Diagnostic information may be found in files in "filepath" and will be named MSBuild_*.failure.txt. This location can be changed by setting the MSBUILDDEBUGPATH environment variable to a different directory.
I have not been able to find a solution to this error. When I remove the reference to the nuget package the problem is resolved.
Is there a solution for this issue? I am working in UWP (min version 1809, target version 1903)
Not sure if this is an issue or not with the library, but I was seeing lots of memory leaks in my apps Views. Turned out it was the Modifiers being held onto by each Page and never releasing them for GC. A workaround to this issue I found was to set your Modifiers in the Applications resources like below:
<Application.Resources>
<ResourceDictionary>
<logicalModifiers:OrModifier x:Key="OrModifier" />
<logicalModifiers:AndModifier x:Key="AndModifier" />
<comparableModifiers:LessThanModifier x:Key="LessThanModifier" />
<comparableModifiers:LessThanEqualToModifier x:Key="LessThanEqualToModifier" />
<comparableModifiers:GreaterThanEqualToModifier x:Key="GreaterThanEqualToModifier" />
<!-- Similar to how you would add a Converter globally like below -->
<converters:BooleanToCollapsedConverter x:Key="BooleanToCollapsedConverter" />
</ResourceDictionary>
</Application.Resources>
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?
I think this code would be very useful to the UnoPlatform community but would need to be based on .NETStandard to support Mono in all of the non-UWP platforms.
I tried this library with Target 1903 SDK.
but Something wrong.. I could not run.
Do you know reason ?
there is some error like.
NU1201 AdaptiveTriggerLibraryuap10.0.10240 (UAP,Version=v10.0.10240) not compatible with .net uap10.0.18362 (UAP,Version=v10.0.18362)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.