CS411_100correct_Complete_Code
CS411_100correct_Complete_Code
Assignment # 02 (GRADED)
Xaml code
<Window x:Class="BC12345678.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:BC210403783"
mc:Ignorable="d"
Title="Your Name " Height="450" Width="800">
<Grid Background="Magenta">
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Top" Width="800"
Height="40">
<Label Content="VUID: BC12345678" HorizontalAlignment="Left"
VerticalAlignment="Top" Width="792" Height="49" Background="CadetBlue"
Foreground="Brown" FontSize="30" FontWeight="Bold"></Label>
</StackPanel>
<RadioButton x:Name="radioButtonLength" Content="Length" HorizontalAlignment="Left"
Margin="336,86,0,0" VerticalAlignment="Top" Height="23" Width="78"
Checked="RadioButton_Checked" FontSize="16" FontWeight="Bold"/>
</Grid>
</Window>
C# complete code
using System;
using System.Windows;
namespace BC12345678
InitializeComponent();
InitializeComboBoxItem();
radioButtonLength.IsChecked = true;
UpdateUIForLength();
inputType.Items.Add("Centimeter");
inputType.Items.Add("Inches");
inputType.Items.Add("Feet");
inputType.Items.Add("Yards");
InitializeComboBoxItem();
inputType.SelectedItem = "Centimeter";
inputType.Items.Clear();
inputType.Items.Add("Fahrenheit");
inputType.Items.Add("Kelvin");
inputType.SelectedItem = "Fahrenheit";
if (radioButtonLength.IsChecked == true)
UpdateUIForLength();
else
UpdateUIForTemperature();
inputValue.Clear();
TB1.Visibility = Visibility.Hidden;
radioButtonLength.IsChecked = true;
InitializeComboBoxItem();
UpdateUIForLength();
double input;
if (radioButtonLength.IsChecked == true)
switch (unit)
case "Centimeter":
case "Inches":
break;
case "Feet":
break;
case "Yards":
break;
default:
return;
else
switch (unit)
case "Fahrenheit":
break;
break;
default:
return;
TB1.Text = result;
TB1.Visibility = Visibility.Visible;
else