user3316391
user3316391

Reputation: 29

How can I make the textbox border invisible in WPF

I am pretty new to programming but I am trying to learn as much as I can. My question is how can I make the textbox border invisible in WPF. I have to design my XAML code to make it look like the attached picture (https://i.sstatic.net/suWtz.jpg). But so far I can only make it look similar. I have attached my version as well (https://i.sstatic.net/MlgGB.png). Any help would be greatly appreciated.

Here is my attached XAML Code:

<Window x:Class="MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="800" Width="1000">
<Grid>
    <TextBox Margin="0,0,0,700" TextAlignment="Center" FontFamily="Comic Sans MS" FontSize="36">Maintain Class Records</TextBox>
    <TextBox Margin="58,75,771,661" Text="Enter Course ID" FontFamily="Comic Sans MS" FontSize="18"/>
    <Button Margin="609,75,132,661" FontFamily="Comic Sans MS" FontSize="18">Get Classes</Button>
    <TextBox Margin="75,152,771,581" Text="Online Classes" FontFamily="Comic Sans MS" FontSize="18"/>
    <Button Margin="75,326,600,408" Height="36" FontFamily="Comic Sans MS" FontSize="16" Content="Add a New Online Class"/>
    <TextBox Margin="284,75,518,661"/>
    <TextBox Margin="75,194,600,471" Text="&#xD;&#xA;Begin Date | End Date | URL | Browser&#xD;&#xA;Begin Date | End Date | URL | Browser&#xD;&#xA;Begin Date | End Date | URL | Browser" FontSize="14" FontFamily="Comic Sans MS" TextAlignment="Center"/>
    <TextBox Margin="75,404,811,326" TextChanged="TextBox_TextChanged" Text="Begin Date" FontFamily="Comic Sans MS" FontSize="14"/>
    <TextBox Margin="75,460,811,270" TextChanged="TextBox_TextChanged_1" Text="End Date" FontFamily="Comic Sans MS" FontSize="14"/>
    <TextBox Margin="75,519,811,216" Text="URL" FontFamily="Comic Sans MS" FontSize="14"/>
    <TextBox Margin="75,573,811,160" Text="Browser" FontFamily="Comic Sans MS" FontSize="14"/>
    <TextBox Margin="186,404,600,340"/>
    <TextBox Margin="186,460,600,284"/>
    <TextBox Margin="186,519,600,225"/>
    <TextBox Margin="186,573,600,171"/>
    <TextBox Margin="516,152,267,581" Text="Face-To-Face Classes" FontFamily="Comic Sans MS" FontSize="18"/>
    <TextBox Margin="516,194,159,471" Text="&#xD;&#xA;Begin Date | End Date | Bldg | Room&#xD;&#xA;Begin Date | End Date | Bldg | Room&#xD;&#xA;Begin Date | End Date | Bldg | Room" FontFamily="Comic Sans MS" FontSize="14" TextAlignment="Center"/>
    <Button Margin="75,610,806,125" FontFamily="Comic Sans MS" FontSize="16">Add</Button>
    <Button Margin="281,610,600,125" FontFamily="Comic Sans MS" FontSize="16">Cancel</Button>
    <Button Margin="514,610,367,125" FontFamily="Comic Sans MS" FontSize="16" Content="Add"/>
    <Button Margin="722,610,159,125" FontFamily="Comic Sans MS" FontSize="16" Content="Cancel"/>
    <Button Content="Add a New Face-To-Face Class" FontFamily="Comic Sans MS" FontSize="16" Margin="516,326,159,408"/>
    <TextBox Margin="516,404,367,326" TextChanged="TextBox_TextChanged" Text="Begin Date" FontFamily="Comic Sans MS" FontSize="14"/>
    <TextBox Margin="630,404,159,340"/>
    <TextBox Margin="630,460,159,284"/>
    <TextBox Margin="630,519,159,225"/>
    <TextBox Margin="630,573,159,171"/>
    <TextBox Margin="516,460,367,270" TextChanged="TextBox_TextChanged_1" Text="End Date" FontFamily="Comic Sans MS" FontSize="14"/>
    <TextBox Margin="516,519,367,216" Text="Bldg" FontFamily="Comic Sans MS" FontSize="14"/>
    <TextBox Margin="516,573,367,160" Text="Room" FontFamily="Comic Sans MS" FontSize="14"/>
</Grid>

Upvotes: 2

Views: 4511

Answers (4)

Ming Slogar
Ming Slogar

Reputation: 2357

I realize this question has already been answered, but since you said

I am trying to learn as much as I can

you may want to check out custom templates: Styling and Templating - MSDN. Creating custom templates will enable you to completely manipulate the appearance of a control 90% of the time.

Upvotes: 2

TDaddy Hobz
TDaddy Hobz

Reputation: 464

I think the issue here is not really making the border invisible but rather learning how to use the right controls. Try looking into the controls used to display text and those used to input data. You would also want to learn a bit about UI and dividing the grid into rows and columns. For your list of courses, check out listviews, listbox etc.

You can find some pretty straightforward tutorials here http://wpftutorial.net/Controls.html

Have fun programming

Upvotes: 1

Flat Eric
Flat Eric

Reputation: 8111

Use a TextBlock. I think the descriptor fields should not be editable by the user

Upvotes: 6

JoJo
JoJo

Reputation: 806

add ' BorderThickness="0" '

for example

<TextBox Margin="186,404,600,340" BorderThickness="0"/>

Upvotes: 6

Related Questions