diff options
13 files changed, 103 insertions, 13 deletions
diff --git a/Xamarin.Forms.Core.UnitTests/SearchBarUnitTests.cs b/Xamarin.Forms.Core.UnitTests/SearchBarUnitTests.cs index d9993829..1a86e858 100644 --- a/Xamarin.Forms.Core.UnitTests/SearchBarUnitTests.cs +++ b/Xamarin.Forms.Core.UnitTests/SearchBarUnitTests.cs @@ -40,7 +40,7 @@ namespace Xamarin.Forms.Core.UnitTests bool thrown = false; searchBar.SearchButtonPressed += (sender, e) => thrown = true; - searchBar.OnSearchButtonPressed (); + ((ISearchBarController)searchBar).OnSearchButtonPressed (); Assert.True (thrown); } @@ -55,7 +55,7 @@ namespace Xamarin.Forms.Core.UnitTests searchBar.SearchCommand = new Command (p => { result = p; }); searchBar.SearchCommandParameter = param; - searchBar.OnSearchButtonPressed (); + ((ISearchBarController)searchBar).OnSearchButtonPressed (); Assert.AreEqual (param, result); } diff --git a/Xamarin.Forms.Core/ISearchBarController.cs b/Xamarin.Forms.Core/ISearchBarController.cs new file mode 100644 index 00000000..8efe97bf --- /dev/null +++ b/Xamarin.Forms.Core/ISearchBarController.cs @@ -0,0 +1,7 @@ +namespace Xamarin.Forms +{ + public interface ISearchBarController + { + void OnSearchButtonPressed(); + } +}
\ No newline at end of file diff --git a/Xamarin.Forms.Core/SearchBar.cs b/Xamarin.Forms.Core/SearchBar.cs index f3d51611..40bf2502 100644 --- a/Xamarin.Forms.Core/SearchBar.cs +++ b/Xamarin.Forms.Core/SearchBar.cs @@ -5,7 +5,7 @@ using Xamarin.Forms.Platform; namespace Xamarin.Forms { [RenderWith(typeof(_SearchBarRenderer))] - public class SearchBar : View, IFontElement + public class SearchBar : View, IFontElement, ISearchBarController { public static readonly BindableProperty SearchCommandProperty = BindableProperty.Create("SearchCommand", typeof(ICommand), typeof(SearchBar), null, propertyChanged: OnCommandChanged); @@ -113,7 +113,7 @@ namespace Xamarin.Forms public event EventHandler<TextChangedEventArgs> TextChanged; - internal void OnSearchButtonPressed() + void ISearchBarController.OnSearchButtonPressed() { ICommand cmd = SearchCommand; diff --git a/Xamarin.Forms.Core/Xamarin.Forms.Core.csproj b/Xamarin.Forms.Core/Xamarin.Forms.Core.csproj index 77503f83..ef4da083 100644 --- a/Xamarin.Forms.Core/Xamarin.Forms.Core.csproj +++ b/Xamarin.Forms.Core/Xamarin.Forms.Core.csproj @@ -137,6 +137,7 @@ <Compile Include="IResourcesProvider.cs" /> <Compile Include="IRootObjectProvider.cs" /> <Compile Include="IScrollViewController.cs" /> + <Compile Include="ISearchBarController.cs" /> <Compile Include="ItemTappedEventArgs.cs" /> <Compile Include="ItemVisibilityEventArgs.cs" /> <Compile Include="IValueConverterProvider.cs" /> diff --git a/Xamarin.Forms.Platform.Android/Renderers/SearchBarRenderer.cs b/Xamarin.Forms.Platform.Android/Renderers/SearchBarRenderer.cs index e31b95aa..5e498952 100644 --- a/Xamarin.Forms.Platform.Android/Renderers/SearchBarRenderer.cs +++ b/Xamarin.Forms.Platform.Android/Renderers/SearchBarRenderer.cs @@ -31,7 +31,7 @@ namespace Xamarin.Forms.Platform.Android bool SearchView.IOnQueryTextListener.OnQueryTextSubmit(string query) { - Element.OnSearchButtonPressed(); + ((ISearchBarController)Element).OnSearchButtonPressed(); Control.ClearFocus(); return true; } diff --git a/Xamarin.Forms.Platform.UAP/SearchBarRenderer.cs b/Xamarin.Forms.Platform.UAP/SearchBarRenderer.cs index 6ec13e1b..04e1058a 100644 --- a/Xamarin.Forms.Platform.UAP/SearchBarRenderer.cs +++ b/Xamarin.Forms.Platform.UAP/SearchBarRenderer.cs @@ -75,7 +75,7 @@ namespace Xamarin.Forms.Platform.UWP void OnQuerySubmitted(AutoSuggestBox sender, AutoSuggestBoxQuerySubmittedEventArgs e) { - Element.OnSearchButtonPressed(); + ((ISearchBarController)Element).OnSearchButtonPressed(); } void OnTextChanged(AutoSuggestBox sender, AutoSuggestBoxTextChangedEventArgs e) diff --git a/Xamarin.Forms.Platform.WP8/SearchBarRenderer.cs b/Xamarin.Forms.Platform.WP8/SearchBarRenderer.cs index b27851a8..a71041da 100644 --- a/Xamarin.Forms.Platform.WP8/SearchBarRenderer.cs +++ b/Xamarin.Forms.Platform.WP8/SearchBarRenderer.cs @@ -68,7 +68,7 @@ namespace Xamarin.Forms.Platform.WinPhone void PhoneTextBoxOnKeyUp(object sender, KeyEventArgs keyEventArgs) { if (keyEventArgs.Key == Key.Enter) - Element.OnSearchButtonPressed(); + ((ISearchBarController)Element).OnSearchButtonPressed(); } void PhoneTextBoxOnTextChanged(object sender, System.Windows.Controls.TextChangedEventArgs textChangedEventArgs) diff --git a/Xamarin.Forms.Platform.WinRT.Phone/SearchBarRenderer.cs b/Xamarin.Forms.Platform.WinRT.Phone/SearchBarRenderer.cs index 33bd782f..c6bf7af8 100644 --- a/Xamarin.Forms.Platform.WinRT.Phone/SearchBarRenderer.cs +++ b/Xamarin.Forms.Platform.WinRT.Phone/SearchBarRenderer.cs @@ -59,7 +59,7 @@ namespace Xamarin.Forms.Platform.WinRT void OnQuerySubmitted (SearchBox sender, SearchBoxQuerySubmittedEventArgs e) { - Element.OnSearchButtonPressed (); + ((ISearchBarController)Element).OnSearchButtonPressed (); } void UpdatePlaceholder () diff --git a/Xamarin.Forms.Platform.WinRT.Tablet/SearchBarRenderer.cs b/Xamarin.Forms.Platform.WinRT.Tablet/SearchBarRenderer.cs index de713a91..a125a7e6 100644 --- a/Xamarin.Forms.Platform.WinRT.Tablet/SearchBarRenderer.cs +++ b/Xamarin.Forms.Platform.WinRT.Tablet/SearchBarRenderer.cs @@ -66,7 +66,7 @@ namespace Xamarin.Forms.Platform.WinRT void OnQuerySubmitted(SearchBox sender, SearchBoxQuerySubmittedEventArgs e) { - Element.OnSearchButtonPressed(); + ((ISearchBarController)Element).OnSearchButtonPressed(); } void UpdatePlaceholder() diff --git a/Xamarin.Forms.Platform.iOS/Renderers/SearchBarRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/SearchBarRenderer.cs index e5e156c4..a7e37c98 100644 --- a/Xamarin.Forms.Platform.iOS/Renderers/SearchBarRenderer.cs +++ b/Xamarin.Forms.Platform.iOS/Renderers/SearchBarRenderer.cs @@ -148,7 +148,7 @@ namespace Xamarin.Forms.Platform.iOS void OnSearchButtonClicked(object sender, EventArgs e) { - Element.OnSearchButtonPressed(); + ((ISearchBarController)Element).OnSearchButtonPressed(); Control.ResignFirstResponder(); } diff --git a/docs/Xamarin.Forms.Core/Xamarin.Forms/ISearchBar.xml b/docs/Xamarin.Forms.Core/Xamarin.Forms/ISearchBar.xml new file mode 100644 index 00000000..04ad550c --- /dev/null +++ b/docs/Xamarin.Forms.Core/Xamarin.Forms/ISearchBar.xml @@ -0,0 +1,31 @@ +<Type Name="ISearchBar" FullName="Xamarin.Forms.ISearchBar"> + <TypeSignature Language="C#" Value="public interface ISearchBar" /> + <TypeSignature Language="ILAsm" Value=".class public interface auto ansi abstract ISearchBar" /> + <AssemblyInfo> + <AssemblyName>Xamarin.Forms.Core</AssemblyName> + <AssemblyVersion>2.0.0.0</AssemblyVersion> + </AssemblyInfo> + <Interfaces /> + <Docs> + <summary>To be added.</summary> + <remarks>To be added.</remarks> + </Docs> + <Members> + <Member MemberName="OnSearchButtonPressed"> + <MemberSignature Language="C#" Value="public void OnSearchButtonPressed ();" /> + <MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance void OnSearchButtonPressed() cil managed" /> + <MemberType>Method</MemberType> + <AssemblyInfo> + <AssemblyVersion>2.0.0.0</AssemblyVersion> + </AssemblyInfo> + <ReturnValue> + <ReturnType>System.Void</ReturnType> + </ReturnValue> + <Parameters /> + <Docs> + <summary>To be added.</summary> + <remarks>To be added.</remarks> + </Docs> + </Member> + </Members> +</Type> diff --git a/docs/Xamarin.Forms.Core/Xamarin.Forms/ISearchBarController.xml b/docs/Xamarin.Forms.Core/Xamarin.Forms/ISearchBarController.xml new file mode 100644 index 00000000..92dd51a9 --- /dev/null +++ b/docs/Xamarin.Forms.Core/Xamarin.Forms/ISearchBarController.xml @@ -0,0 +1,31 @@ +<Type Name="ISearchBarController" FullName="Xamarin.Forms.ISearchBarController"> + <TypeSignature Language="C#" Value="public interface ISearchBarController" /> + <TypeSignature Language="ILAsm" Value=".class public interface auto ansi abstract ISearchBarController" /> + <AssemblyInfo> + <AssemblyName>Xamarin.Forms.Core</AssemblyName> + <AssemblyVersion>2.0.0.0</AssemblyVersion> + </AssemblyInfo> + <Interfaces /> + <Docs> + <summary>To be added.</summary> + <remarks>To be added.</remarks> + </Docs> + <Members> + <Member MemberName="OnSearchButtonPressed"> + <MemberSignature Language="C#" Value="public void OnSearchButtonPressed ();" /> + <MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance void OnSearchButtonPressed() cil managed" /> + <MemberType>Method</MemberType> + <AssemblyInfo> + <AssemblyVersion>2.0.0.0</AssemblyVersion> + </AssemblyInfo> + <ReturnValue> + <ReturnType>System.Void</ReturnType> + </ReturnValue> + <Parameters /> + <Docs> + <summary>To be added.</summary> + <remarks>To be added.</remarks> + </Docs> + </Member> + </Members> +</Type> diff --git a/docs/Xamarin.Forms.Core/Xamarin.Forms/SearchBar.xml b/docs/Xamarin.Forms.Core/Xamarin.Forms/SearchBar.xml index e923a674..3c9107a8 100644 --- a/docs/Xamarin.Forms.Core/Xamarin.Forms/SearchBar.xml +++ b/docs/Xamarin.Forms.Core/Xamarin.Forms/SearchBar.xml @@ -1,6 +1,6 @@ <Type Name="SearchBar" FullName="Xamarin.Forms.SearchBar"> - <TypeSignature Language="C#" Value="public class SearchBar : Xamarin.Forms.View" /> - <TypeSignature Language="ILAsm" Value=".class public auto ansi beforefieldinit SearchBar extends Xamarin.Forms.View" /> + <TypeSignature Language="C#" Value="public class SearchBar : Xamarin.Forms.View, Xamarin.Forms.ISearchBarController" /> + <TypeSignature Language="ILAsm" Value=".class public auto ansi beforefieldinit SearchBar extends Xamarin.Forms.View implements class Xamarin.Forms.ISearchBarController" /> <AssemblyInfo> <AssemblyName>Xamarin.Forms.Core</AssemblyName> <AssemblyVersion>1.0.0.0</AssemblyVersion> @@ -14,7 +14,11 @@ <Base> <BaseTypeName>Xamarin.Forms.View</BaseTypeName> </Base> - <Interfaces /> + <Interfaces> + <Interface> + <InterfaceName>Xamarin.Forms.ISearchBarController</InterfaceName> + </Interface> + </Interfaces> <Attributes> <Attribute> <AttributeName>Xamarin.Forms.RenderWith(typeof(Xamarin.Forms.Platform._SearchBarRenderer))</AttributeName> @@ -584,5 +588,21 @@ public class App : Application <remarks>To be added.</remarks> </Docs> </Member> + <Member MemberName="Xamarin.Forms.ISearchBarController.OnSearchButtonPressed"> + <MemberSignature Language="C#" Value="void ISearchBarController.OnSearchButtonPressed ();" /> + <MemberSignature Language="ILAsm" Value=".method hidebysig newslot virtual instance void Xamarin.Forms.ISearchBarController.OnSearchButtonPressed() cil managed" /> + <MemberType>Method</MemberType> + <AssemblyInfo> + <AssemblyVersion>2.0.0.0</AssemblyVersion> + </AssemblyInfo> + <ReturnValue> + <ReturnType>System.Void</ReturnType> + </ReturnValue> + <Parameters /> + <Docs> + <summary>To be added.</summary> + <remarks>To be added.</remarks> + </Docs> + </Member> </Members> </Type> |