VB.NET, C#, PowerShellを使用しているエンジニアのためのサイト。
基本的な使用方法から開発で役立つTipsまで幅広く取り扱っています。
Update 2019/03/03
<Prev Tips
 
Next Tips>
SearchHolderのプレースホルダの色を設定するには PlaceholderColor プロパティを使用します。
以下はXamlにおける PlaceholderColor プロパティの使用例です(12行目)。
<?xml version="1.0" encoding="utf-8"?>
<ContentPage
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:searchBarSample03"
x:Class="searchBarSample03.MainPage"
xmlns:ios="clr-namespace:Xamarin.Forms.PlatformConfiguration.iOSSpecific;assembly=Xamarin.Forms.Core"
ios:Page.UseSafeArea="true">
<StackLayout>
<SearchBar x:Name="searchBar" Placeholder="検索文字列" PlaceholderColor="Red" />
</StackLayout>
</ContentPage>
コードで プレースホルダの色を設定するには、以下のようにします。
namespace searchBarSample03 { public partial class MainPage : ContentPage { public MainPage() { InitializeComponent(); searchBar.Placeholder = "検索文字列"; searchBar.PlaceholderColor = Color.Red; } } }
実行例を以下に示します。