简体   繁体   English

使用Windows Phone Toolkit的Windows phone 8占位符问题

[英]Windows phone 8 placeholder issue with Windows Phone Toolkit

I'm developing a windows phone 8 app. 我正在开发一款Windows Phone 8应用程序。 I'm new to windows phone 8 development. 我是Windows Phone 8开发的新手。

I need to add placeholder for text box . 我需要为文本框添加占位符。 I searched in Google & Stack Overflow i got one solution by using The windows phone Toolkit. 我在Google和Stack Overflow中搜索了我使用Windows phone Toolkit获得了一个解决方案。

I try with following Code. 我尝试使用以下代码。

Step-1: Add Windows Phone Toolkit In Reference By Using Nuget gallery 步骤1:使用Nuget库在参考中添加Windows Phone工具包

Step-2: Add namespace in page header 步骤2:在页眉中添加名称空间

 xmlns:xtk="using:WinRTXamlToolkit.Controls"

Step-3: My Textbox XAML code 第3步:我的文本框XAML代码

<TextBox Name="Usernametxt" Text="User Name"></TextBox>
<TextBox Name="Passwordtxt" Text="Password"></TextBox>
<TextBox Name="Emailtxt" Text="Eamail Address"></TextBox>

Step-4: I add the following code under the Usernametxt box [I don't know it's correct or not] 第四步:我在Usernametxt框下添加以下代码[我不知道它是否正确]

<xtk:WatermarkTextBox  WatermarkText="some text" />

I got error in above line The Name WatermarkTextBox does not exist in namespace"using:WinRTXamlToolkit.controls" 我在上面的行中出现错误名称WatermarkTextBox在命名空间“using:WinRTXamlToolkit.controls”中不存在

I got this solution Here 我在这里得到了解决方案

I don't know how to use this property . 我不知道如何使用这个属性。 I need to add placeholder for 4 to 5 textbox in same page. 我需要在同一页面中添加4到5个文本框的占位符。

Help me to solve this problem. 帮我解决这个问题。

You are mixing up Windows Phone 8 and Windows 8. You need a reference to correct toolkit 您正在混合使用Windows Phone 8和Windows 8.您需要引用正确的工具包

xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"

And then you can 然后就可以了

<toolkit:PhoneTextBox Hint="some text" Name="Usernametxt" />

Make sure you can got the right Nuget package, more details here . 确保你能获得正确的NuGet包,更多的细节在这里

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM