Skip to content

Commit

Permalink
Final code clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
dotMorten committed Jun 29, 2018
1 parent 97dfb80 commit a969050
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#elif __IOS__
using CoreGraphics;
using Xamarin.Forms.Platform.iOS;
//using NativeAutoSuggestBox = UIKit.UIView;
#elif NETFX_CORE
using Xamarin.Forms.Platform.UWP;
using NativeAutoSuggestBox = Windows.UI.Xaml.Controls.AutoSuggestBox;
Expand All @@ -24,7 +23,7 @@ namespace dotMorten.Xamarin.Forms
/// <summary>
/// Represents a text control that makes suggestions to users as they type. The app is notified when text
/// has been changed by the user and is responsible for providing relevant suggestions for this control to display.
/// Use the UWP Reference doc for more information: <see cref="https://msdn.microsoft.com/en-us/library/windows/apps/mt280217.aspx?f=255&MSPPError=-2147217396">Link</see>
/// Use the UWP Reference doc for more information: <a href="https://msdn.microsoft.com/en-us/library/windows/apps/mt280217.aspx">Link</a>
/// </summary>
public partial class AutoSuggestBox : View
{
Expand All @@ -33,6 +32,9 @@ public partial class AutoSuggestBox : View
#endif
private bool suppressTextChangedEvent;

/// <summary>
/// Initializes a new instance of the <see cref="AutoSuggestBox"/> class
/// </summary>
public AutoSuggestBox()
{
#if !NETSTANDARD2_0
Expand All @@ -48,11 +50,13 @@ public AutoSuggestBox()
suppressTextChangedEvent = false;
TextChanged?.Invoke(this, new AutoSuggestBoxTextChangedEventArgs((AutoSuggestionBoxTextChangeReason) e.Reason));
};
NativeAutoSuggestBox.QuerySubmitted += (s, e) => QuerySubmitted?.Invoke(this, new AutoSuggestBoxQuerySubmittedEventArgs(e.QueryText, e.ChosenSuggestion));
#else
throw new PlatformNotSupportedException();
#endif
}

/// <inheritdoc />
protected override void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
if(propertyName == nameof(IsEnabled))
Expand Down Expand Up @@ -210,7 +214,7 @@ public System.Collections.IList ItemsSource
}

/// <summary>
/// Identifies the <see cref="Header"/> bindable property.
/// Identifies the <see cref="ItemsSource"/> bindable property.
/// </summary>
public static readonly BindableProperty ItemsSourceProperty =
BindableProperty.Create(nameof(ItemsSource), typeof(System.Collections.IList), typeof(AutoSuggestBox), null, BindingMode.OneWay, null, OnItemsSourcePropertyChanged);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@ public override long GetItemId(int position)
private class SuggestFilter : Filter
{
private IEnumerable<string> resultList;
private FilterResults results;

public SuggestFilter()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ public NativeAutoSuggestBox()
};
inputText.ShouldReturn = InputText_OnShouldReturn;
inputText.EditingChanged += InputText_EditingChanged;
inputText.Started += InputText_Started;
inputText.EndedWithReason += InputText_EndedWithReason;
inputText.ReturnKeyType = UIKit.UIReturnKeyType.Search;

Expand Down Expand Up @@ -154,12 +153,6 @@ private void SuggestionTableSource_TableRowSelected(object sender, TableRowSelec
IsSuggestionListOpen = false;
}

private void InputText_Started(object sender, EventArgs e)
{
//if (selectionList.Source != null && selectionList.Source.RowsInSection(selectionList, 0) > 0)
// IsSuggestionListOpen = true;
}

private void InputText_EditingChanged(object sender, EventArgs e)
{
TextChanged?.Invoke(this, new AutoSuggestBoxTextChangedEventArgs(AutoSuggestionBoxTextChangeReason.UserInput));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@
<RepositoryUrl>https://github.com/dotMorten/XamarinFormsControls</RepositoryUrl>
<PackageProjectUrl>https://github.com/dotMorten/XamarinFormsControls</PackageProjectUrl>
<PackageLicenseUrl>https://github.com/dotMorten/XamarinFormsControls/LICENSE.MD</PackageLicenseUrl>
<Version>0.5.0</Version>
<Version>0.1.0</Version>
<DocumentationFile>$(MSBuildThisFileDirectory)bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml</DocumentationFile>
</PropertyGroup>

<PropertyGroup Condition="'$(TargetFramework)' == 'uap10.0.16299'">
<TargetPlatformVersion>10.0.16299.0</TargetPlatformVersion>
<TargetPlatformMinVersion>10.0.16299.0</TargetPlatformMinVersion>
</PropertyGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'uap10.0.16299'">
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform" Version="6.1.5" />
</ItemGroup>
Expand Down

0 comments on commit a969050

Please sign in to comment.