ネイティブで出来ることは、ある程度xamarinでもできます。
以下のappleDevelopのUITextFieldの項目の中の「Border Style」に書いてあります。
それを基にして、組むようにすればエフェクトできますよ。
appleDevelop:UITextFieldの項目
さて、実際のEffectでのボーダレス化ですが以下のように行えば実現できます。
※記述方法はあってるはずですが、xamlでのみしか検証してません。
C#
1
2// 作成するエフェクトのグループネーム
3[assembly: ResolutionGroupName("TextFieldEff")]
4// 今回定義したエフェクトの出力定義
5[assembly: ExportEffect(typeof(TextFieldBorderEffect), "TextFieldBorderEffect")]
6
7// 自身で作成したネームスペース名
8namespace ProjectName.iOS.Effect
9{
10 /// <summary>
11 /// テキストフィールドにBorderを行うエフェクトクラス
12 /// </summary>
13 class TextFieldBorderEffect : PlatformEffect
14 {
15 /// <summary>
16 /// アタッチ後に処理する動作
17 /// </summary>
18 protected override void OnAttached()
19 {
20 // ボーダレスが必要かのチェック
21 if (this.IsBorderLess())
22 {
23 // ボーダレス処理実行
24 BorderLess();
25 }
26 }
27
28 /// <summary>
29 /// デタッチ後に処理する動作
30 /// </summary>
31 protected override void OnDetached()
32 {
33 }
34
35 /// <summary>
36 /// ボーダレス化する処理
37 /// </summary>
38 protected void BorderLess()
39 {
40 // コントロールを UITextField でキャスト
41 UITextField textF = (UITextField)Control;
42 // UITextFieldのインスタンスのBorderStyle定義に
43 // UITextBorderStyle.None
44 // を代入して、ボーダレス化
45 textF.BorderStyle = UITextBorderStyle.None;
46 }
47 /// <summary>
48 /// ボーダーレスする要素かチェック
49 /// </summary>
50 /// <returns>ボーダレスする要素ならTrue、そうでなければFalse</returns>
51 protected bool IsBorderLess()
52 {
53 return Control is UITextField;
54 }
55 }
56}
57
58
59// 利用方法
60// viewにそのまま記載する場合
61var e = new Entry();
62e.Effects.Add(Effect.Resolve("TextFieldEff.TextFieldBorderEffect"));
63// xamlで利用する場合
64<Entry>
65 <Button.Effects>
66 <Effect x:FactoryMethod="Resolve" >
67 <x:Arguments>
68 <x:String>TextFieldEff.TextFieldBorderEffect</x:String>
69 </x:Arguments>
70 </Effect>
71 </Button.Effects>
72
73</Entry>
74
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2017/07/18 05:04