Skip to content

Commit

Permalink
Added an adapter that inverts the value of a bool passed into it.
Browse files Browse the repository at this point in the history
  • Loading branch information
RoryDungan committed Jul 7, 2017
1 parent 97c4b44 commit 7ec9530
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
14 changes: 14 additions & 0 deletions UnityWeld/Binding/Adapters/BoolInversionAdapter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
namespace UnityWeld.Binding.Adapters
{
/// <summary>
/// Adapter that inverts the value of the bound boolean property.
/// </summary>
[Adapter(typeof(bool), typeof(bool))]
public class BoolInversionAdapter : IAdapter
{
public object Convert(object valueIn, AdapterOptions options)
{
return !(bool)valueIn;
}
}
}
1 change: 1 addition & 0 deletions UnityWeld/UnityWeld.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
<Compile Include="AOTOptimisationHelper.cs" />
<Compile Include="Binding\AdapterAttribute.cs" />
<Compile Include="Binding\AdapterOptions.cs" />
<Compile Include="Binding\Adapters\BoolInversionAdapter.cs" />
<Compile Include="Binding\Adapters\BoolToColorAdapter.cs" />
<Compile Include="Binding\Adapters\BoolToColorAdapterOptions.cs" />
<Compile Include="Binding\Adapters\BoolToColorBlockAdapter.cs" />
Expand Down

0 comments on commit 7ec9530

Please sign in to comment.