Skip to content

Commit

Permalink
SelectionView SelectedIndexes improves.
Browse files Browse the repository at this point in the history
Some Checkbox improvements
  • Loading branch information
enisn committed Sep 3, 2018
1 parent 873edc6 commit e9868aa
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 18 deletions.
15 changes: 7 additions & 8 deletions InputKit.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<id>Xamarin.Forms.InputKit</id>

<!-- The package version number that is used when resolving dependencies -->
<version>2.2.2</version>
<version>2.2.3</version>

<!-- Authors contain text that appears directly on the gallery -->
<authors>Enis Necipoglu</authors>
Expand Down Expand Up @@ -35,6 +35,10 @@

<description>

v.2.2.3
Checkbox Text sizing improved.
CheckBoxCell added.

v.2.2.2
Dropdown BidnableProperties added,
Dropdown selectedIndex bug fixed.
Expand All @@ -56,15 +60,12 @@
PlaceholderColor (Can be given PlaceholderColor = "{DynamicResource YourColor}" )
Dropdown added. More properties will be added.



v.2.1.0
AdvancedEntry Password Annotation problem fixed.
Material CheckBox coloring problem fixed.
ToSurfaceColor() extension added in ColorExtensions. (It used for CheckBox coloring)
AdvancedSlider looping problem fixed.


ChangeLog:
v.2.0.6
CheckBox Color property fixed,
Expand Down Expand Up @@ -99,8 +100,6 @@
RadioButton.GlobalSetting.Size = 36;
in App.cs



v.1.1.1
AdvancedSlider PropertyChanging addded.
RadioButton ClickCommand missing bindableproperty added.
Expand All @@ -114,7 +113,6 @@
SelectionView color properties added, rest of some properties are updated.
'ItemSource' renamed to 'ItemsSource', old one marked as Obselete, It'll removed in later versions.


v.1.0.9
RadioButtonGroupView, BindableProperty, Event and Command added for SelectedItem

Expand Down Expand Up @@ -156,6 +154,8 @@
<files>
<!--Readme to display after installaction-->
<file src="readme.txt" target="" />

<file src="InputKit\Resources\arrow_down.png" target="Resources" />

<!-- Cross-platform reference assemblies -->
<file src="InputKit\bin\Release\netstandard2.0\Plugin.InputKit.dll" target="lib\netstandard2.0\Plugin.InputKit.dll" />
Expand All @@ -176,6 +176,5 @@
<file src="InputKit\bin\Release\xamarin.watchos10\Plugin.InputKit.dll" target="lib\xamarin.watchos10\Plugin.InputKit.dll" />
<file src="InputKit\bin\Release\xamarin.watchos10\Plugin.InputKit.xml" target="lib\xamarin.watchos10\Plugin.InputKit.xml" />


</files>
</package>
11 changes: 7 additions & 4 deletions InputKit/InputKit.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<AssemblyName>Plugin.InputKit</AssemblyName>
<RootNamespace>Plugin.InputKit</RootNamespace>
<PackageId>Xamarin.Forms.InputKit</PackageId>

<Product>$(AssemblyName) ($(TargetFramework))</Product>
<AssemblyVersion>1.0.0.0</AssemblyVersion>
<AssemblyFileVersion>1.0.0.0</AssemblyFileVersion>
Expand Down Expand Up @@ -73,10 +73,12 @@

<ItemGroup Condition=" '$(TargetFramework)' == 'Xamarin.iOS10' ">
<Compile Include="Platforms\iOS\**\*.cs" />

<Content Include="Resources\*.png">

<!--<Copy SourceFiles="$(NuSpecPath)" DestinationFolder="$(PackageSource)\Resources"/>-->

<!--<Content Include="Resources\*.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</Content>-->
</ItemGroup>


Expand Down Expand Up @@ -134,5 +136,6 @@



<Import Project="inputkit.targets" Condition="Exists('inputkit.targets')" />
<Import Project="$(MSBuildSDKExtrasTargets)" Condition="Exists('$(MSBuildSDKExtrasTargets)')" />
</Project>
6 changes: 3 additions & 3 deletions InputKit/Shared/Controls/CheckBox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public class CheckBox : StackLayout, IValidatable
Frame boxBackground = new Frame { Padding = 0, CornerRadius = GlobalSetting.CornerRadius, InputTransparent = true, HeightRequest = GlobalSetting.Size, WidthRequest = GlobalSetting.Size, BackgroundColor = GlobalSetting.BackgroundColor, MinimumWidthRequest = 35, BorderColor = GlobalSetting.BorderColor, VerticalOptions = LayoutOptions.CenterAndExpand, HasShadow = false };
BoxView boxSelected = new BoxView { IsVisible = false, HeightRequest = GlobalSetting.Size * .60, WidthRequest = GlobalSetting.Size * .60, Color = GlobalSetting.Color, VerticalOptions = LayoutOptions.CenterAndExpand, HorizontalOptions = LayoutOptions.Center };
Label lblSelected = new Label { Text = "✓", Margin = new Thickness(0, -1, 0, 0), FontSize = GlobalSetting.Size * .72, FontAttributes = FontAttributes.Bold, IsVisible = false, TextColor = GlobalSetting.Color, HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.CenterAndExpand };
Label lblOption = new Label { VerticalOptions = LayoutOptions.CenterAndExpand, FontSize = GlobalSetting.FontSize, TextColor = GlobalSetting.TextColor, FontFamily = GlobalSetting.FontFamily };
Label lblOption = new Label { VerticalOptions = LayoutOptions.CenterAndExpand, FontSize = GlobalSetting.FontSize, TextColor = GlobalSetting.TextColor, FontFamily = GlobalSetting.FontFamily , IsVisible = false};
private CheckType _type = CheckType.Box;
private bool _isEnabled;
/// <summary>
Expand Down Expand Up @@ -88,7 +88,7 @@ async void Animate()
public CheckBox(string optionName, int key) : this()
{
Key = key;
lblOption.Text = optionName;
Text = optionName;
}
/// <summary>
/// You can set a Unique key for each control
Expand All @@ -97,7 +97,7 @@ public CheckBox(string optionName, int key) : this()
/// <summary>
/// Text to display right of CheckBox
/// </summary>
public string Text { get => lblOption.Text; set => lblOption.Text = value; }
public string Text { get => lblOption.Text; set { lblOption.Text = value; lblOption.IsVisible = !String.IsNullOrEmpty(value); } }
/// <summary>
/// IsChecked Property
/// </summary>
Expand Down
22 changes: 22 additions & 0 deletions InputKit/Shared/Controls/SelectionView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,26 @@ public int SelectedIndex
}
}

public IEnumerable<int> SelectedIndexes
{
get
{
for (int i = 0; i < this.Children.Count; i++)
{
if (this.Children[i] is ISelection && (this.Children[i] as ISelection).IsSelected)
yield return i;
}
}
set
{
for (int i = 0; i < Children.Count; i++)
{
if (this.Children[i] is ISelection)
(this.Children[i] as ISelection).IsSelected = value.Contains(i);
}
}
}

///-----------------------------------------------------------------------------
/// <summary>
///Selected Items for the multiple selections,
Expand Down Expand Up @@ -229,6 +249,7 @@ private void Element_Clicked(object sender, EventArgs e)
if ((int)this.SelectionType % 2 == 0)
{
SetValue(SelectedItemsProperty, SelectedItems);
SetValue(SelectedIndexesProperty, SelectedIndexes);
}
else
{
Expand Down Expand Up @@ -317,6 +338,7 @@ private void SetInstanceColor(View view, Color color)
public static readonly BindableProperty SelectedItemProperty = BindableProperty.Create(nameof(SelectedItem), typeof(object), typeof(SelectionView), null, BindingMode.TwoWay, propertyChanged: (bo, ov, nv) => (bo as SelectionView).SelectedItem = nv);
public static readonly BindableProperty SelectedItemsProperty = BindableProperty.Create(nameof(SelectedItems), typeof(IList), typeof(SelectionView), null, BindingMode.TwoWay, propertyChanged: (bo, ov, nv) => (bo as SelectionView).SelectedItems = (IList)nv);
public static readonly BindableProperty SelectedIndexProperty = BindableProperty.Create(nameof(SelectedIndex), typeof(int), typeof(SelectionView), -1, BindingMode.TwoWay, propertyChanged: (bo, ov, nv) => (bo as SelectionView).SelectedIndex = (int)nv);
public static readonly BindableProperty SelectedIndexesProperty = BindableProperty.Create(nameof(SelectedIndexes), typeof(IEnumerable<int>), typeof(SelectionView), new int[0], BindingMode.TwoWay, propertyChanged: (bo, ov, nv) => (bo as SelectionView).SelectedIndexes = (IEnumerable<int>)nv);
#pragma warning restore CS1591 // Missing XML comment for publicly visible type or member
#endregion
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
<PackageReference Include="Xamarin.Android.Support.v7.CardView" Version="27.0.2.1" />
<PackageReference Include="Xamarin.Android.Support.v7.MediaRouter" Version="27.0.2.1" />
<PackageReference Include="Xamarin.Forms.InputKit">
<Version>2.2.2</Version>
<Version>2.3.0-pre6</Version>
</PackageReference>
</ItemGroup>
<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@
<ItemGroup>
<PackageReference Include="Xamarin.Forms" Version="3.1.0.637273" />
<PackageReference Include="Xamarin.Forms.InputKit">
<Version>2.2.2</Version>
<Version>2.3.0-pre6</Version>
</PackageReference>
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" />
Expand Down
2 changes: 1 addition & 1 deletion Sample.InputKit/Sample.InputKit/Sample.InputKit.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<ItemGroup>
<PackageReference Include="Xamarin.Forms" Version="3.1.0.637273" />
<PackageReference Include="Xamarin.Forms.InputKit" Version="2.2.2" />
<PackageReference Include="Xamarin.Forms.InputKit" Version="2.3.0-pre6" />
</ItemGroup>

<ItemGroup>
Expand Down

0 comments on commit e9868aa

Please sign in to comment.