The Problem I am having is with a gridview using RowDetailsTemplate. On the detail i have a tab control that contains the collections as well as the individual details. I am trying to set the value of a ComboBox to the LocationID in the Employee table. I have succeded in loading the Location ComboBox from the Location Table but I cannot seem to access the "Navigation Property" via my existing collections. Below is the XAML and C# codeset I am currently working with. As I am fairly new to Silverlight please give me as much detail as possible or use small words.
Thanks,
<UserControl x:Class="EntityBackOffice2010_R1.EmployeeGridMain"
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:controls="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls"
xmlns:grid="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.GridView"
xmlns:navigation="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Navigation"
xmlns:telerikInput="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Input"
xmlns:telerikData="clr-namespace:Telerik.Windows.Data;assembly=Telerik.Windows.Data"
mc:Ignorable="d"
d:DesignWidth="1000" d:DesignHeight="600">
<Grid Background="Black">
<Border Background="Black" BorderBrush="#7FFFFFFF" BorderThickness="1" CornerRadius="3" Margin="3">
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
</Grid.RowDefinitions>
<grid:RadGridView Grid.Row="0"
x:Name="EmployeesGrid"
ItemsSource="{Binding}"
Margin="5"
RowDetailsVisibilityMode="VisibleWhenSelected"
IsReadOnly="True"
AutoGenerateColumns="False"
CanUserFreezeColumns="False"
CanUserResizeColumns="False"
ColumnWidth="*"
DataLoadMode="Asynchronous" RowIndicatorVisibility="Collapsed">
<grid:RadGridView.Columns>
<grid:GridViewToggleRowDetailsColumn />
<grid:GridViewImageColumn Header="Location" DataMemberBinding="{Binding Employee.Location}"/>
<grid:GridViewImageColumn Header="Photo" DataMemberBinding="{Binding PhotoURL}" Width="48" />
<grid:GridViewDataColumn Header="ID" DataMemberBinding="{Binding EmployeeID}" />
<grid:GridViewDataColumn Header="First Name" DataMemberBinding="{Binding FirstName}" />
<grid:GridViewDataColumn Header="Last Name" DataMemberBinding="{Binding LastName}" />
<grid:GridViewDataColumn Header="Title" DataMemberBinding="{Binding JobTitle}" />
<grid:GridViewDataColumn Header="City" DataMemberBinding="{Binding City}" />
<grid:GridViewDataColumn Header="Country" DataMemberBinding="{Binding State}" />
<grid:GridViewDataColumn Header="Phone" DataMemberBinding="{Binding HomePhone}" />
</grid:RadGridView.Columns>
<grid:RadGridView.RowDetailsTemplate>
<DataTemplate x:Name="EmployeeDetailsTemplate">
<StackPanel Orientation="Vertical" Margin="0" Grid.Row="0">
<navigation:RadTabControl x:Name="EmployeeDetailsTemplateTabCTRL" BackgroundVisibility="Visible" Margin="0,0,0,0" VerticalAlignment="Top" Background="Transparent" controls:StyleManager.Theme="Office_Black">
<navigation:RadTabItem Header="General">
<Border BorderBrush="#FF848484" BorderThickness="0,1,0,0">
<Grid Width="Auto" HorizontalAlignment="Stretch">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition Height="15" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Border Grid.Column="0" Grid.RowSpan="4" Grid.Row="0"
VerticalAlignment="Top" HorizontalAlignment="Stretch"
Height="115" Width="115" Margin="15,15,15,0"
BorderThickness="1" CornerRadius="1" BorderBrush="#FF848484">
<Border Margin="0" BorderThickness="1,1,1,1" CornerRadius="0,0,0,0" BorderBrush="Gainsboro">
<Border.Background>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#FF5B5B5B" Offset="1"/>
<GradientStop Color="#FF868686"/>
<GradientStop Color="#FF4F4F4F" Offset="0.17"/>
<GradientStop Color="#FF0E0E0E" Offset="0.18"/>
</LinearGradientBrush>
</Border.Background>
<Image Source="{Binding PhotoURL}" Stretch="Fill"
HorizontalAlignment="Center" VerticalAlignment="Center"
Height="96" Width="96">
<Image.OpacityMask>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="Black" Offset="0.935"/>
<GradientStop Offset="1"/>
<GradientStop Color="#00000000"/>
<GradientStop Color="Black" Offset="0.113"/>
</LinearGradientBrush>
</Image.OpacityMask>
</Image>
</Border>
</Border>
<TextBlock Text="Last Name: " Margin="5" FontWeight="Bold" Grid.Row="0" Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Left" />
<telerikInput:RadMaskedTextBox
Margin="5" Foreground="#FF627481" Height="24" TextAlignment="Right"
Value="{Binding LastName}"
EmptyContent="Enter Last Name" IsSpinEnabled="False"
MaskType="None"
x:Name="textBox_LastName" Grid.Row="0" Grid.Column="2"/>
<TextBlock Text="First Name: " Margin="5" FontWeight="Bold" Grid.Row="1" Grid.Column="1" HorizontalAlignment="Left" VerticalAlignment="Center" />
<telerikInput:RadMaskedTextBox
Margin="5" Foreground="#FF627481" Height="24" TextAlignment="Right"
Value="{Binding FirstName}"
MaskType="None"
EmptyContent="Enter First Name" IsSpinEnabled="False"
x:Name="textBox_FirstName" Grid.Row="1" Grid.Column="2"/>
<TextBlock Text="Title: " Margin="5" FontWeight="Bold" Grid.Row="2" Grid.Column="1" HorizontalAlignment="Left" VerticalAlignment="Center" />
<telerikInput:RadMaskedTextBox
Margin="5" Foreground="#FF627481" Height="24" TextAlignment="Right"
Value="{Binding Title}"
MaskType="None"
EmptyContent="Enter Title" IsSpinEnabled="False"
x:Name="textBox_Title" Grid.Row="2" Grid.Column="2"/>
<TextBlock Text="Address: " Margin="5" FontWeight="Bold" Grid.Row="3" Grid.Column="1" HorizontalAlignment="Left" VerticalAlignment="Center" />
<telerikInput:RadMaskedTextBox
MinWidth="400"
Margin="5" Foreground="#FF627481" Height="24" TextAlignment="Right"
Value="{Binding Address}"
MaskType="None"
EmptyContent="Enter Street Address" IsSpinEnabled="False"
x:Name="textBox_Address" Grid.Row="3" Grid.Column="2" VerticalAlignment="Center"/>
<TextBlock Text="City, State ZIP: " Margin="5" FontWeight="Bold" Grid.Row="4" Grid.Column="1" HorizontalAlignment="Left" VerticalAlignment="Center" />
<StackPanel Orientation="Horizontal" HorizontalAlignment="right" Grid.Row="4" Grid.Column="2">
<telerikInput:RadMaskedTextBox
Margin="5" Foreground="#FF627481" Height="24" MinWidth="150"
Value="{Binding City}"
EmptyContent="Enter City Name" IsSpinEnabled="False"
MaskType="None"
x:Name="textBox_City"/>
<TextBlock Text=", " VerticalAlignment="Center" />
<ComboBox Margin="5" Foreground="#FF464646" Height="24" DataContext="{Binding State}">
<ComboBoxItem Content="AL"/>
<ComboBoxItem Content="AK"/>
<ComboBoxItem Content="AS"/>
<ComboBoxItem Content="AZ"/>
<ComboBoxItem Content="AR"/>
<ComboBoxItem Content="CA"/>
<ComboBoxItem Content="CO"/>
<ComboBoxItem Content="CT"/>
<ComboBoxItem Content="DE"/>
<ComboBoxItem Content="DC"/>
<ComboBoxItem Content="FM"/>
<ComboBoxItem Content="FL"/>
<ComboBoxItem Content="GA"/>
<ComboBoxItem Content="GU"/>
<ComboBoxItem Content="HI"/>
<ComboBoxItem Content="ID"/>
<ComboBoxItem Content="IL"/>
<ComboBoxItem Content="IN"/>
<ComboBoxItem Content="IA"/>
<ComboBoxItem Content="KS"/>
<ComboBoxItem Content="KY"/>
<ComboBoxItem Content="LA"/>
<ComboBoxItem Content="ME"/>
<ComboBoxItem Content="MH"/>
<ComboBoxItem Content="MD"/>
<ComboBoxItem Content="MA"/>
<ComboBoxItem Content="MI"/>
<ComboBoxItem Content="MN"/>
<ComboBoxItem Content="MS"/>
<ComboBoxItem Content="MO"/>
<ComboBoxItem Content="MT"/>
<ComboBoxItem Content="NE"/>
<ComboBoxItem Content="NV"/>
<ComboBoxItem Content="NH"/>
<ComboBoxItem Content="NJ"/>
<ComboBoxItem Content="NM"/>
<ComboBoxItem Content="NY"/>
<ComboBoxItem Content="NC"/>
<ComboBoxItem Content="ND"/>
<ComboBoxItem Content="MP"/>
<ComboBoxItem Content="OH"/>
<ComboBoxItem Content="OK"/>
<ComboBoxItem Content="OR"/>
<ComboBoxItem Content="PW"/>
<ComboBoxItem Content="PA"/>
<ComboBoxItem Content="PR"/>
<ComboBoxItem Content="RI"/>
<ComboBoxItem Content="SC"/>
<ComboBoxItem Content="SD"/>
<ComboBoxItem Content="TN"/>
<ComboBoxItem Content="TX"/>
<ComboBoxItem Content="UT"/>
<ComboBoxItem Content="VT"/>
<ComboBoxItem Content="VI"/>
<ComboBoxItem Content="VA"/>
<ComboBoxItem Content="WA"/>
<ComboBoxItem Content="WV"/>
<ComboBoxItem Content="WI"/>
<ComboBoxItem Content="WY"/>
<ComboBoxItem Content="AE"/>
<ComboBoxItem Content="AA"/>
<ComboBoxItem Content="AE"/>
<ComboBoxItem Content="AE"/>
<ComboBoxItem Content="AE"/>
<ComboBoxItem Content="AP"/>
</ComboBox>
<TextBlock Text=" " />
<telerikInput:RadMaskedTextBox
Margin="5" Foreground="#FF627481" Height="24" TextAlignment="Right"
Value="{Binding Zip}"
EmptyContent="Enter digits only" IsSpinEnabled="False"
Mask="#####-####"
x:Name="textBox_PostalCode" VerticalAlignment="Center" HorizontalAlignment="Center"/>
</StackPanel>
<TextBlock Text="Phone: " Margin="5" FontWeight="Bold" Grid.Row="5" Grid.Column="1" HorizontalAlignment="Left" VerticalAlignment="Center" />
<telerikInput:RadMaskedTextBox
Margin="5" Foreground="#FF627481" Height="24" TextAlignment="Right"
Value="{Binding Phone}"
EmptyContent="Enter digits only" IsSpinEnabled="False"
Mask="(###) ###-####"
x:Name="textBox_HomePhone" Grid.Row="5
" Grid.Column="2"/>
<TextBlock Text="Phone (Mobile): " Margin="5" FontWeight="Bold" Grid.Row="6" Grid.Column="1" HorizontalAlignment="Left" VerticalAlignment="Center" />
<telerikInput:RadMaskedTextBox
Margin="5" Foreground="#FF627481" Height="24" TextAlignment="Right"
Value="{Binding Mobile}"
EmptyContent="Enter digits only" IsSpinEnabled="False"
Mask="(###) ###-####"
x:Name="textBox_MobilePhone" Grid.Row="6" Grid.Column="2"/>
<TextBlock Text="Email: " Margin="5" FontWeight="Bold" Grid.Row="7" Grid.Column="1" HorizontalAlignment="Left" VerticalAlignment="Center" />
<telerikInput:RadMaskedTextBox
Margin="5" Foreground="#FF627481" Height="24" TextAlignment="Right"
Value="{Binding Email}"
MaskType="None"
EmptyContent="Valid Email Address" IsSpinEnabled="False"
x:Name="textBox_Email" Grid.Row="7" Grid.Column="2"/>
</Grid>
</Border>
</navigation:RadTabItem>
<navigation:RadTabItem Header="Details">
<Border BorderBrush="#FF848484" BorderThickness="0,1,0,0">
<Grid Width="Auto" HorizontalAlignment="Stretch">
<Grid.RowDefinitions>
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="2"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="2"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="2"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<StackPanel Orientation="Vertical" Margin="5,5,5,5" Grid.Column="0">
<Grid Width="Auto" HorizontalAlignment="Stretch">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="5"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBlock Text="Personal: " Margin="5" FontWeight="Bold" Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="3" HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="16" />
<TextBlock Text="Location: " Margin="5" FontWeight="Bold" Grid.Row="1" Grid.Column="1" HorizontalAlignment="Left" VerticalAlignment="Center" />
<telerikInput:RadMaskedTextBox
Margin="5" Foreground="#FF627481" Height="24" TextAlignment="Right"
Value="{Binding Location}"
MaskType="None"
x:Name="textBox_Location" Grid.Row="2" Grid.Column="3"/>
<telerikInput:RadComboBox x:Name="ComboBox_Location"
DisplayMemberPath="LocationName"
ItemsSource="{Binding}"
SelectedValuePath="4"
HorizontalAlignment="Left" VerticalAlignment="Top"
Margin="5" Foreground="#FF627481" Height="24"
Grid.Row="1" Grid.Column="2" MinWidth="80"
Loaded="ComboBox_Location_Loaded">
</telerikInput:RadComboBox>
<TextBlock Text="Birthday: " Margin="5" FontWeight="Bold" Grid.Row="2" Grid.Column="1" HorizontalAlignment="Left" VerticalAlignment="Center" />
<telerikInput:RadMaskedTextBox
Margin="5" Foreground="#FF627481" Height="24" TextAlignment="Right"
Value="{Binding Birthday}"
MaskType="DateTime"
Mask="MM/dd/yyyy"
EmptyContent="Enter Date of Birth" IsSpinEnabled="False"
x:Name="textBox_Birthday" Grid.Row="2" Grid.Column="2"/>
<TextBlock Text="Gender: " Margin="5" FontWeight="Bold" Grid.Row="3" Grid.Column="1" HorizontalAlignment="Left" VerticalAlignment="Center" />
<ComboBox x:Name="ComboBox_Gender" Margin="5" Foreground="#FF627481" Height="24" DataContext="{Binding Gender}" Grid.Row="3" Grid.Column="2">
<ComboBoxItem Content="(UNKNOWN)"/>
<ComboBoxItem Content="Male"/>
<ComboBoxItem Content="Female"/>
</ComboBox>
<TextBlock Text="Marital Status: " Margin="5" FontWeight="Bold" Grid.Row="4" Grid.Column="1" HorizontalAlignment="Left" VerticalAlignment="Center" />
<ComboBox x:Name="ComboBox_MaritalStatus" Margin="5" Foreground="#FF627481" Height="24" DataContext="{Binding MaritalStatusID}" Grid.Row="4" Grid.Column="2">
<ComboBoxItem Content="(UNKNOWN)"/>
<ComboBoxItem Content="Single"/>
<ComboBoxItem Content="Married"/>
<ComboBoxItem Content="Seperated"/>
<ComboBoxItem Content="Divorced"/>
<ComboBoxItem Content="Partnership / Common Law"/>
</ComboBox>
<TextBlock Text="Maiden: " Margin="5" FontWeight="Bold" Grid.Row="5" Grid.Column="1" HorizontalAlignment="Left" VerticalAlignment="Center" />
<telerikInput:RadMaskedTextBox
Margin="5" Foreground="#FF627481" Height="24" TextAlignment="Right"
Value="{Binding MaidenName}"
MaskType="None"
EmptyContent="Enter Maiden Name" IsSpinEnabled="False"
x:Name="textBox_MaidenName" Grid.Row="5" Grid.Column="2"/>
</Grid>
</StackPanel>
</Grid>
</Border>
</navigation:RadTabItem>
<navigation:RadTabItem Header="Job Codes">
<Border BorderBrush="#FF848484" BorderThickness="0,1,0,0">
<grid:RadGridView
x:Name="JobCodesGrid"
DataContext="{x:Null}"
ShowGroupPanel="False"
Margin="15"
Loaded="JobCodesGrid_Loaded"
AutoGenerateColumns="False">
<grid:RadGridView.Columns>
<grid:GridViewDataColumn Header="Job Code" DataMemberBinding="{Binding JobCode}" DataFormatString="{}{0:d}" />
<grid:GridViewDataColumn Header="Description" DataMemberBinding="{Binding JobCodeDescription}" Width="*" MaxWidth="400"/>
<grid:GridViewDataColumn Header="Pay Rate" DataMemberBinding="{Binding PayRate}"/>
</grid:RadGridView.Columns>
</grid:RadGridView>
</Border>
</navigation:RadTabItem>
<navigation:RadTabItem Header="Available">
<Border BorderBrush="#FF848484" BorderThickness="0,1,0,0">
<grid:RadGridView
x:Name="EmployeeScheduleAvailablity"
DataContext="{x:Null}"
ShowGroupPanel="False"
Margin="15"
Loaded="EmployeeScheduleAvailablity_Loaded"
AutoGenerateColumns="False">
<grid:RadGridView.Columns>
<grid:GridViewDataColumn Header="Day of Week" DataMemberBinding="{Binding DayofWeekName}" />
<grid:GridViewDataColumn Header="Start Time" DataMemberBinding="{Binding StartTime}"/>
<grid:GridViewDataColumn Header="End Time" DataMemberBinding="{Binding EndTime}"/>
<grid:GridViewDataColumn Header="Available" DataMemberBinding="{Binding AvailableFlag}"/>
<grid:GridViewDataColumn Header="Deleted" DataMemberBinding="{Binding Deleted}"/>
</grid:RadGridView.Columns>
</grid:RadGridView>
</Border>
</navigation:RadTabItem>
<navigation:RadTabItem Header="Human Resources">
<Border BorderBrush="#FF848484" BorderThickness="0,1,0,0">
<Grid Width="Auto" HorizontalAlignment="Stretch">
<Grid.RowDefinitions>
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="2"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="2"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="2"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Border BorderThickness="2" BorderBrush="#FFBFBFBF" Grid.Column="1"></Border>
<StackPanel Orientation="Vertical" Margin="5,5,5,5" Grid.Column="2">
<Grid Width="Auto" HorizontalAlignment="Stretch">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBlock Text="Tax: " Margin="5" FontWeight="Bold" Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="3" HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="21.333" />
<TextBlock Text="Social Security: " Margin="5" FontWeight="Bold" Grid.Row="1" Grid.Column="1" HorizontalAlignment="Left" VerticalAlignment="Center" />
<telerikInput:RadMaskedTextBox
Value="{Binding SSID}"
EmptyContent="SSID"
Mask="###-##-####"
TextAlignment="Right"
x:Name="textBox_SocialSecurity" Margin="5" Foreground="#FF627481" Height="24" Grid.Row="1" Grid.Column="2"/>
<TextBlock Text="Withholding: " Margin="5" FontWeight="Bold" Grid.Row="2" Grid.Column="1" HorizontalAlignment="Left" VerticalAlignment="Center" />
<telerikInput:RadMaskedTextBox
Value=""
EmptyContent="Withholding"
MaskType="None"
TextAlignment="Right"
x:Name="textBox_Withholding" Margin="5" Foreground="#FF627481" Height="24" Grid.Row="2" Grid.Column="2"/>
<TextBlock Text="Alien ID#: " Margin="5" FontWeight="Bold" Grid.Row="3" Grid.Column="1" HorizontalAlignment="Left" VerticalAlignment="Center" />
<telerikInput:RadMaskedTextBox
Value="{Binding AlienID}"
EmptyContent="Enter Alien ID"
MaskType="None"
TextAlignment="Right"
x:Name="textBox_AlienID" Margin="5" Foreground="#FF627481" Height="24" Grid.Row="3" Grid.Column="2"/>
<TextBlock Text="Exp. Date: " Margin="5" FontWeight="Bold" Grid.Row="4" Grid.Column="1" HorizontalAlignment="Left" VerticalAlignment="Center" />
<telerikInput:RadMaskedTextBox
Margin="5" Foreground="#FF627481" Height="24" TextAlignment="Right"
Value="{Binding AlienIDExpDate}"
MaskType="DateTime"
Mask="MM/dd/yyyy"
EmptyContent="Immigration Expiration" IsSpinEnabled="False"
x:Name="textBox_AlienIDExpDate" Grid.Row="4" Grid.Column="2"/>
</Grid>
</StackPanel>
<Border BorderThickness="2" BorderBrush="#FFBFBFBF" Grid.Column="3"></Border>
<StackPanel Orientation="Vertical" Margin="5,5,5,5" Grid.Column="4">
<Grid Width="Auto" HorizontalAlignment="Stretch">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="5"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBlock Text="Certifications: " Margin="5" FontWeight="Bold" Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="3" HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="21.333" />
<TextBlock Text="Alcohol Service: " Margin="5" FontWeight="Bold" Grid.Row="1" Grid.Column="0" HorizontalAlignment="Left" VerticalAlignment="Center" />
<CheckBox IsChecked="{Binding ABS}" HorizontalAlignment="Right" Margin="5" VerticalAlignment="Center" Grid.Row="1" Grid.Column="2"/>
<telerikInput:RadMaskedTextBox
Margin="5" Foreground="#FF627481" Height="24" TextAlignment="Right"
Value="{Binding ABSExpDate}"
MaskType="DateTime"
Mask="MM/dd/yyyy"
EmptyContent="ABS Expiration" IsSpinEnabled="False"
x:Name="textBox_ABSExpDate" Grid.Row="1" Grid.Column="3"/>
<TextBlock Text="Food Service: " Margin="5" FontWeight="Bold" Grid.Row="2" Grid.Column="0" HorizontalAlignment="Left" VerticalAlignment="Center" />
<CheckBox IsChecked="{Binding FoodHandler}" HorizontalAlignment="Right" Margin="5" VerticalAlignment="Center" Grid.Row="2" Grid.Column="2"/>
<telerikInput:RadMaskedTextBox
Margin="5" Foreground="#FF627481" Height="24" TextAlignment="Right"
Value="{Binding FoodHandlerExpDate}"
MaskType="DateTime"
Mask="MM/dd/yyyy"
EmptyContent="Food Service Expiration" IsSpinEnabled="False"
x:Name="textBox_FoodHandler" Grid.Row="2" Grid.Column="3"/>
</Grid>
</StackPanel>
<Border BorderThickness="2" BorderBrush="#FFBFBFBF" Grid.Column="5"></Border>
<StackPanel Orientation="Vertical" Margin="5,5,5,5" Grid.Column="6">
<Grid Width="Auto" HorizontalAlignment="Stretch">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="5"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBlock Text="Documentation: " Margin="5" FontWeight="Bold" Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="3" HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="21.333" />
<TextBlock Text="W-4: " Margin="5" FontWeight="Bold" Grid.Row="1" Grid.Column="0" HorizontalAlignment="Left" VerticalAlignment="Center" />
<CheckBox IsChecked="{Binding w4}" HorizontalAlignment="Right" Margin="5" VerticalAlignment="Bottom" Grid.Row="1" Grid.Column="2"/>
<TextBlock Text="I-9: " Margin="5" FontWeight="Bold" Grid.Row="2" Grid.Column="0" HorizontalAlignment="Left" VerticalAlignment="Center" />
<CheckBox IsChecked="{Binding i9}" HorizontalAlignment="Right" Margin="5" VerticalAlignment="Bottom" Grid.Row="2" Grid.Column="2"/>
<TextBlock Text="Employee Handbook: " Margin="5" FontWeight="Bold" Grid.Row="3" Grid.Column="0" HorizontalAlignment="Left" VerticalAlignment="Center" />
<CheckBox IsChecked="{Binding EmployeeHandbook}" HorizontalAlignment="Right" Margin="5" VerticalAlignment="Bottom" Grid.Row="3" Grid.Column="2"/>
<TextBlock Text="Sexual Harrassment Policy: " Margin="5" FontWeight="Bold" Grid.Row="4" Grid.Column="0" HorizontalAlignment="Left" VerticalAlignment="Center" />
<CheckBox IsChecked="{Binding SexualHarrassmentPolicy}" HorizontalAlignment="Right" Margin="5" VerticalAlignment="Bottom" Grid.Row="4" Grid.Column="2"/>
<TextBlock Text="Insurance Handbook: " Margin="5" FontWeight="Bold" Grid.Row="5" Grid.Column="0" HorizontalAlignment="Left" VerticalAlignment="Center" />
<CheckBox IsChecked="{Binding InsuranceHandbook}" HorizontalAlignment="Right" Margin="5" VerticalAlignment="Bottom" Grid.Row="5" Grid.Column="2"/>
</Grid>
</StackPanel>
</Grid>
</Border>
</navigation:RadTabItem>
<navigation:RadTabItem Header="Attachments">
<Border BorderBrush="#FF848484" BorderThickness="0,1,0,0">
<grid:RadGridView
x:Name="EmployeeAttachmentGrid"
DataContext="{x:Null}"
ShowGroupPanel="False"
Margin="15"
Loaded="EmployeeAttachmentGrid_Loaded"
AutoGenerateColumns="False">
<grid:RadGridView.Columns>
<grid:GridViewDataColumn Header="Attachment Type" DataMemberBinding="{Binding AttachTypeID}" />
<grid:GridViewDataColumn Header="Description" DataMemberBinding="{Binding Description}" Width="*" MaxWidth="400"/>
<grid:GridViewDataColumn Header="Link" DataMemberBinding="{Binding HLink}" />
<grid:GridViewDataColumn Header="Created On" DataMemberBinding="{Binding CreateDate}" />
<grid:GridViewDataColumn Header="Last Updated" DataMemberBinding="{Binding UpdateDate}" />
<grid:GridViewDataColumn Header="Last Updated" DataMemberBinding="{Binding IconURL}" Width="48"/>
</grid:RadGridView.Columns>
</grid:RadGridView>
</Border>
</navigation:RadTabItem>
<navigation:RadTabItem Header="Emergency Contact">
<Border BorderBrush="#FF848484" BorderThickness="0,1,0,0">
<grid:RadGridView
x:Name="EmergencyContactGrid"
DataContext="{x:Null}"
ShowGroupPanel="False"
Margin="15"
Loaded="EmergencyContactGrid_Loaded"
AutoGenerateColumns="False">
<grid:RadGridView.Columns>
<grid:GridViewDataColumn Header="Relationship" DataMemberBinding="{Binding Relationship}" />
<grid:GridViewDataColumn Header="First Name" DataMemberBinding="{Binding FirstName}" />
<grid:GridViewDataColumn Header="Last Name" DataMemberBinding="{Binding LastName}" />
<grid:GridViewDataColumn Header="City" DataMemberBinding="{Binding City}" />
<grid:GridViewDataColumn Header="State" DataMemberBinding="{Binding State}" />
<grid:GridViewDataColumn Header="Phone" DataMemberBinding="{Binding Phone}" />
<grid:GridViewDataColumn Header="Mobile" DataMemberBinding="{Binding Mobile}" />
<grid:GridViewDataColumn Header="Email" DataMemberBinding="{Binding Email}" />
</grid:RadGridView.Columns>
</grid:RadGridView>
</Border>
</navigation:RadTabItem>
<navigation:RadTabItem Header="Notes">
<Border BorderBrush="#FF848484" BorderThickness="0,1,0,0">
<grid:RadGridView
x:Name="NotesGrid"
DataContext="{x:Null}"
ShowGroupPanel="False"
Margin="15"
Loaded="NotesGrid_Loaded"
AutoGenerateColumns="False">
<grid:RadGridView.Columns>
<grid:GridViewDataColumn Header="NoteID" DataMemberBinding="{Binding NoteID}" />
<grid:GridViewDataColumn Header="NoteDate" DataMemberBinding="{Binding NoteDate}"/>
<grid:GridViewDataColumn Header="Note Type" DataMemberBinding="{Binding NoteType}"/>
<grid:GridViewDataColumn Header="Notes" DataMemberBinding="{Binding Notes}" Width="*" MaxWidth="400"/>
<grid:GridViewDataColumn Header="Deleted" DataMemberBinding="{Binding Deleted}"/>
</grid:RadGridView.Columns>
</grid:RadGridView>
</Border>
</navigation:RadTabItem>
</navigation:RadTabControl>
<StackPanel Orientation="Horizontal" Grid.Row="1" Grid.Column="2" Margin="5,5,5,5" HorizontalAlignment="Right">
<Button Height="30" Margin="5" VerticalAlignment="Bottom" Content="NEW" Grid.Row="1" FontSize="12" HorizontalAlignment="Left" Width="110"/>
<Button Height="30" Margin="5" VerticalAlignment="Bottom" Content="SAVE" Grid.Row="1" FontSize="12" HorizontalAlignment="Right" Width="110"/>
<Button Height="30" Margin="5" VerticalAlignment="Bottom" Content="CANCEL" Grid.Row="1" FontSize="12" HorizontalAlignment="Left" Width="110"/>
</StackPanel>
</StackPanel>
</DataTemplate>
</grid:RadGridView.RowDetailsTemplate>
</grid:RadGridView>
</Grid>
</Border>
</Grid>
</UserControl>
using
System;
using
System.Windows;
using
System.Windows.Controls;
using
System.Windows.Documents;
using
System.Windows.Ink;
using
System.Windows.Input;
using
System.Windows.Media;
using
System.Windows.Media.Animation;
using
System.Windows.Shapes;
using
System.Collections.Generic;
using
System.Linq;
using
System.Net;
using
System.Data.Services.Client;
using
System.Collections.ObjectModel;
using
System.Collections.Specialized;
using
System.Text;
using
System.Windows.Data;
using
System.Windows.Media.Imaging;
using
Telerik.Windows.Data;
using
Telerik.Windows.QuickStart;
using
System.ComponentModel;
using
System.Data;
using
System.Collections;
using
Telerik.Windows.Controls;
using
Telerik.Windows.Controls.GridView;
using
System.Globalization;
using
Telerik.Windows.Controls.Charting;
using
EntityBackOffice2010_R1.EntityServiceReference;
namespace
EntityBackOffice2010_R1
{
public partial class EmployeeGridMain : UserControl
{
#region
Public Variables
//Public Variables
RadGridView NotesGrid = null;
RadGridView JobCodesGrid = null;
RadGridView EmergencyContactGrid = null;
RadGridView EmployeeAttachmentGrid = null;
RadGridView EmployeeScheduleAvailablity = null;
RadComboBox ComboBox_Location = null;
//Define Service Contracts and collections
EntityBackOfficeEntities svcContext;
ObservableCollection<Employee> EmployeeBindingCollection;
#endregion
#region
Initalize
public EmployeeGridMain()
{
// Required to initialize variables
InitializeComponent();
// Create the binding collections.
EmployeeBindingCollection =
new ObservableCollection<Employee>();
// Load initial Customer Grid
LoadEmployeesGrid();
}
#endregion
#region
Load Employee Data
private void ResetBindingData()
{
// Create a new data service context.
svcContext =
new EntityBackOfficeEntities(new Uri("EntityBackOffice2010.svc", UriKind.Relative));
EmployeeBindingCollection.Clear();
}
private void LoadEmployeesGrid()
{
//Set Grid Busy Status
this.EmployeesGrid.IsBusy = true;
// Instantiate the data service context and clear any existing bindings.
ResetBindingData();
// Define a query to return the specifed customer and related orders.
DataServiceQuery<Employee> query = svcContext.Employee;
try
{
// Begin the query execution.
query.BeginExecute(OnEmployeeQueryComplete, query);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
private void OnEmployeeQueryComplete(IAsyncResult result)
{
try
{
foreach (Employee Emp in svcContext.Employee.EndExecute(result))
{
// Load the item into the binding collection.
EmployeeBindingCollection.Add(Emp);
}
// Reset and rebind the grid to the items binding collection
this.EmployeesGrid.DataContext = EmployeeBindingCollection;
//MessageBox.Show(this.EmployeesGrid.Columns[0].Header.ToString());
//MessageBox.Show(this.EmployeesGrid.Columns[1].Header.ToString());
this.EmployeesGrid.Columns[0].IsVisible = false;
this.EmployeesGrid.Columns[3].IsVisible = false;
this.EmployeesGrid.UpdateLayout();
this.EmployeesGrid.IsBusy = false;
}
catch (DataServiceQueryException ex)
{
MessageBox.Show(string.Format("Error: {0} - {1}",ex.Response.StatusCode.ToString(), ex.Response.Error.Message));
}
}
//Load Employee List & Combo Boxes
//Location Combo Box
private void BeginComboBox_LocationRequest()
{
DataServiceQuery<Location> query = svcContext.CreateQuery<Location>("Location");
query.BeginExecute(ComboBox_LocationRequestCompleted, query);
}
private void ComboBox_LocationRequestCompleted(IAsyncResult asyncResult)
{
DataServiceQuery<Location> query = asyncResult.AsyncState as DataServiceQuery<Location>;
var location = query.EndExecute(asyncResult).ToList();
ComboBox_Location.ItemsSource = location;
}
private void ComboBox_Location_Loaded(object sender, RoutedEventArgs e)
{
ComboBox_Location = (
RadComboBox)sender;
BeginComboBox_LocationRequest();
}
#endregion
#region
Load Employee Notes
private void BeginNotesRequest(Employee Employee)
{
DataServiceQuery<Note> query = svcContext.CreateQuery<Note>(String.Format("Employee({0})/Note", Employee.EmployeeID));
query.BeginExecute(EmployeeNotesCompleted, query);
}
private void EmployeeNotesCompleted(IAsyncResult asyncResult)
{
DataServiceQuery<Note> query = asyncResult.AsyncState as DataServiceQuery<Note>;
NotesGrid.ItemsSource = query.EndExecute(asyncResult).ToList();
}
private void NotesGrid_Loaded(object sender, RoutedEventArgs e)
{
NotesGrid = (
RadGridView)sender;
Employee Employee = (Employee)NotesGrid.ParentRow.DataContext;
BeginNotesRequest(Employee);
}
#endregion
#region
Load Employee Job Codes
private void BeginJobCodeRequest(Employee Employee)
{
DataServiceQuery<EmployeeJobCode> query = svcContext.CreateQuery<EmployeeJobCode>(String.Format("Employee({0})/EmployeeJobCode", Employee.EmployeeID));
//MessageBox.Show(query.ToString());
query.BeginExecute(JobCodeCompleted, query);
}
private void JobCodeCompleted(IAsyncResult asyncResult)
{
DataServiceQuery<EmployeeJobCode> query = asyncResult.AsyncState as DataServiceQuery<EmployeeJobCode>;
JobCodesGrid.ItemsSource = query.EndExecute(asyncResult).ToList();
}
private void JobCodesGrid_Loaded(object sender, RoutedEventArgs e)
{
JobCodesGrid = (
RadGridView)sender;
Employee Employee = (Employee)JobCodesGrid.ParentRow.DataContext;
BeginJobCodeRequest(Employee);
}
#endregion
#region
Load Employee Emergency Contacts
private void BeginEmergencyContactRequest(Employee Employee)
{
DataServiceQuery<EmergencyContact> query = svcContext.CreateQuery<EmergencyContact>(String.Format("Employee({0})/EmergencyContact", Employee.EmployeeID));
query.BeginExecute(EmergencyContactCompleted, query);
}
private void EmergencyContactCompleted(IAsyncResult asyncResult)
{
DataServiceQuery<EmergencyContact> query = asyncResult.AsyncState as DataServiceQuery<EmergencyContact>;
EmergencyContactGrid.ItemsSource = query.EndExecute(asyncResult).ToList();
}
private void EmergencyContactGrid_Loaded(object sender, RoutedEventArgs e)
{
EmergencyContactGrid = (
RadGridView)sender;
Employee Employee = (Employee)EmergencyContactGrid.ParentRow.DataContext;
BeginEmergencyContactRequest(Employee);
}
#endregion
#region
Load Employee Attachments
private void BeginAttachmentRequest(Employee Employee)
{
DataServiceQuery<Attachment> query = svcContext.CreateQuery<Attachment>(String.Format("Employee({0})/Attachment", Employee.EmployeeID));
query.BeginExecute(AttachmentQueryCompleted, query);
}
private void AttachmentQueryCompleted(IAsyncResult asyncResult)
{
DataServiceQuery<Attachment> query = asyncResult.AsyncState as DataServiceQuery<Attachment>;
EmployeeAttachmentGrid.ItemsSource = query.EndExecute(asyncResult).ToList();
}
private void EmployeeAttachmentGrid_Loaded(object sender, RoutedEventArgs e)
{
EmployeeAttachmentGrid = (
RadGridView)sender;
Employee Employee = (Employee)EmployeeAttachmentGrid.ParentRow.DataContext;
BeginAttachmentRequest(Employee);
}
#endregion
#region
Load Employee Schedule Availablity
private void BeginAvailablityRequest(Employee Employee)
{
DataServiceQuery<EmployeeScheduleAvailablity> query = svcContext.CreateQuery<EmployeeScheduleAvailablity>(String.Format("Employee({0})/EmployeeScheduleAvailablity", Employee.EmployeeID));
query.BeginExecute(AvailablityQueryCompleted, query);
}
private void AvailablityQueryCompleted(IAsyncResult asyncResult)
{
DataServiceQuery<EmployeeScheduleAvailablity> query = asyncResult.AsyncState as DataServiceQuery<EmployeeScheduleAvailablity>;
EmployeeScheduleAvailablity.ItemsSource = query.EndExecute(asyncResult).ToList();
}
private void EmployeeScheduleAvailablity_Loaded(object sender, RoutedEventArgs e)
{
EmployeeScheduleAvailablity = (
RadGridView)sender;
Employee Employee = (Employee)EmployeeScheduleAvailablity.ParentRow.DataContext;
BeginAvailablityRequest(Employee);
}
#endregion
}
}