Click here to Skip to main content
15,917,005 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am trying to do a fortune teller in XAML, but every time that I try to initiate a Textbox as an input for age and birth month, I failed and the it displays " <pre>The type 'TextBox' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built", Do I need to  declare something before? Thanks


This is the code

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             x:Class="FortuneTeller.MainPage">

    <StackLayout>
        
        <Frame BackgroundColor="#2196F3" Padding="24" CornerRadius="0">
            <Label Text="Welcome to Fortune Teller" HorizontalTextAlignment="Center" TextColor="White" FontSize="36"/>
        </Frame>
        <Label Text="Enter your age, please" FontSize="Title" Padding="30,10,30,10"/>
        <TextBox></TextBox>
        <TextBox Width="500" Header="Notes" PlaceholderText="How old are you?"/>
        <Label Text="Enter your Birth Month, please" FontSize="Title" Padding="30,10,30,10"/>
        <TextBox Width="500" Header="Notes" PlaceholderText="What is your birth month?"/>
        <Label FontSize="16" Padding="30,24,30,0">
            <Label.FormattedText>
                <FormattedString>
                    <FormattedString.Spans>
                        <Span Text="Learn more at "/>
                        <Span Text="https://aka.ms/xamarin-quickstart" FontAttributes="Bold"/>
                    </FormattedString.Spans>
                </FormattedString>
            </Label.FormattedText>
        </Label>
        
    </StackLayout>

</ContentPage>


What I have tried:

Even when my XAML does not have initially this class, <pre><Window x:Class="WpfApp5.MainWindow" , I tried to add it, without success, either.
Posted
Updated 1-Nov-21 22:55pm
v6
Comments
CHill60 1-Nov-21 8:38am    
Do you want to share the XAML where you are attempting to add the textbox?
Diasalva5 1-Nov-21 10:36am    
Dear Chill60
What does "share the XAML" mean, please? Sorry, I am new in this world. Thanks
CHill60 1-Nov-21 12:40pm    
I meant - include your XAML code in your question in the "What I have tried" section. As you are new here, there are a few techniques you need to know about...
- You can edit your question to add detail using the "Improve question" link at the bottom of your post
- To reply to a comment use the "Reply" link next to it - the poster will be notified that you have responded
- Never post a question or a comment in the "Add your solution here" area - use the "Have a Question or Comment?" link next to a question or a solution - again, the poster will be notified that you have responded.

I hope these tips help you get the most out of the site
Diasalva5 1-Nov-21 12:57pm    
Dear Chill60
I have updated the question as per your advises. Sorry for the mistakes.
Thanks
[no name] 1-Nov-21 11:45am    
Try a "DatePicker" control.

https://wpf-tutorial.com/misc-controls/the-datepicker-control/

1 solution

It looks like you are using xamarin - in which case you probably want an Entry control - see Text in Xamarin.Forms - Xamarin | Microsoft Docs[^]

If you definitely want a TextBox then you need to include the appropriate namespaces as per the documentation - TextBox Overview - WPF .NET Framework | Microsoft Docs[^]
HTML
<Page  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
  <StackLayout>
  ...
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900