【发布时间】:2021-07-13 18:02:40
【问题描述】:
我正在使用 xamarin 表单 SearchBar 控件。我想在不使用自定义渲染器的情况下删除清除 button x 图标。
<controls:ExSearchBar
x:Name="entrySearch"
BackgroundColor="White"
CornerRadius="6"
BorderWidth="1"
HeightRequest="45"
Text="{Binding SearchText}"
HorizontalOptions="FillAndExpand"
Placeholder="search">
</controls:ExSearchBar>
这是共享项目中的ExSearchBar 控件
public class ExSearchBar : SearchBar
{
public static readonly BindableProperty ElevationProperty = BindableProperty.Create(nameof(Elevation), typeof(float), typeof(ExFrame), default(float));
public float Elevation
{
get { return (float)GetValue(ElevationProperty); }
set { SetValue(ElevationProperty, value); }
}
}
我该怎么做?
【问题讨论】:
-
如果不使用自定义渲染器,似乎没有办法让它隐藏起来。您可以查看SearchBar documnet 和有关SearchBarRenderer 的源代码。你会发现它默认显示清晰的图标。
-
stackoverflow.com/questions/40725932/… 请通过此链接,它可能对您有所帮助
标签: xamarin xamarin.forms