or
<
telerik:RadTabControl
IsSynchronizedWithCurrentItem
=
"True"
>
<
telerik:RadTabControl.Resources
>
<
system:String
x:Key
=
"Mandatory"
>* Mandatory field</
system:String
>
</
telerik:RadTabControl.Resources
>
<
telerik:EventToCommandBehavior.EventBindings
>
<
telerik:EventBinding
Command
=
"{Binding PreviewSelectionChanged}"
EventName
=
"PreviewSelectionChanged"
RaiseOnHandledEvents
=
"True"
PassEventArgsToCommand
=
"True"
/>
</
telerik:EventToCommandBehavior.EventBindings
>
<
telerik:RadTabItem
Visibility
=
"{Binding ProjectVisibility}"
>
<
telerik:RadTabItem.Header
>
<
Label
Content
=
"_Projects"
/>
</
telerik:RadTabItem.Header
>
<
DockPanel
>
<
DockPanel.DataContext
>
<
local:ProjectGridViewModel
/>
</
DockPanel.DataContext
>
<
local:ButtonPanel
DockPanel.Dock
=
"Top"
/>
<
TextBlock
Text
=
"{StaticResource Mandatory}"
DockPanel.Dock
=
"Bottom"
/>
<
telerik:RadGridView
ItemsSource
=
"{Binding Path=ItemCollectionProperty, Mode=TwoWay}"
SelectedItem
=
"{Binding CurrentlySelectedItem, Mode=TwoWay, Converter={StaticResource ignoreNewItemPlaceHolderConverter}}"
AutoGenerateColumns
=
"False"
CanUserDeleteRows
=
"True"
IsSynchronizedWithCurrentItem
=
"True"
ShowGroupPanel
=
"False"
DockPanel.Dock
=
"Top"
AlternateRowBackground
=
"Beige"
AlternationCount
=
"2"
SelectionMode
=
"Extended"
>
<
telerik:EventToCommandBehavior.EventBindings
>
<
telerik:EventBinding
Command
=
"{Binding SelectionChangingCommand}"
EventName
=
"SelectionChanging"
RaiseOnHandledEvents
=
"True"
PassEventArgsToCommand
=
"True"
/>
<
telerik:EventBinding
Command
=
"{Binding NewEventCommand}"
EventName
=
"AddingNewDataItem"
RaiseOnHandledEvents
=
"True"
PassEventArgsToCommand
=
"True"
/>
<
telerik:EventBinding
Command
=
"{Binding DeleteEventCommand}"
EventName
=
"Deleting"
RaiseOnHandledEvents
=
"True"
PassEventArgsToCommand
=
"True"
/>
</
telerik:EventToCommandBehavior.EventBindings
>
<
telerik:RadGridView.Columns
>
<
telerik:GridViewDataColumn
Header
=
"Name*"
IsReadOnly
=
"False"
DataMemberBinding
=
"{Binding ItemProperty.Name, Mode=TwoWay}"
>
<
telerik:GridViewDataColumn.CellEditTemplate
>
<
DataTemplate
>
<
TextBox
Text
=
"{Binding ItemProperty.Name, Mode=TwoWay}"
telerik:TextBoxBehavior.UpdateTextOnTextChanged
=
"True"
/>
</
DataTemplate
>
</
telerik:GridViewDataColumn.CellEditTemplate
>
</
telerik:GridViewDataColumn
>
<
telerik:GridViewDataColumn
Header
=
"Description"
IsReadOnly
=
"False"
DataMemberBinding
=
"{Binding ItemProperty.Description, Mode=TwoWay}"
>
<
telerik:GridViewDataColumn.CellEditTemplate
>
<
DataTemplate
>
<
TextBox
Text
=
"{Binding ItemProperty.Description, Mode=TwoWay}"
telerik:TextBoxBehavior.UpdateTextOnTextChanged
=
"True"
/>
</
DataTemplate
>
</
telerik:GridViewDataColumn.CellEditTemplate
>
</
telerik:GridViewDataColumn
>
<
telerik:GridViewComboBoxColumn
Header
=
"Coordinator*"
ItemsSource
=
"{Binding RelativeSource={RelativeSource Findancestor, AncestorType={x:Type Window}}, Path=DataContext.EmployeeCollection}"
DataMemberBinding
=
"{Binding Path=ItemProperty.coordinator}"
DisplayMemberPath
=
"ItemProperty.Name"
SelectedValueMemberPath
=
"ItemProperty.Name"
IsVisible
=
"{Binding CoordinatorColumnIsVisible}"
/>
</
telerik:RadGridView.Columns
>
</
telerik:RadGridView
>
</
DockPanel
>
</
telerik:RadTabItem
>
<
telerik:RadTabItem
Visibility
=
"{Binding EmployeeVisibility}"
>
<
telerik:RadTabItem.Header
>
<
Label
Content
=
"_Employees"
/>
</
telerik:RadTabItem.Header
>
<
DockPanel
>
<
DockPanel.DataContext
>
<
local:EmployeeGridViewModel
/>
</
DockPanel.DataContext
>
<
local:ButtonPanel
DockPanel.Dock
=
"Top"
/>
<
TextBlock
Text
=
"{StaticResource Mandatory}"
DockPanel.Dock
=
"Bottom"
/>
<
telerik:RadGridView
ItemsSource
=
"{Binding Path=ItemCollectionProperty, Mode=TwoWay}"
SelectedItem
=
"{Binding CurrentlySelectedItem, Mode=TwoWay, Converter={StaticResource ignoreNewItemPlaceHolderConverter}}"
CurrentItem
=
"{Binding CurrentlySelectedItem, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, Converter={StaticResource ignoreNewItemPlaceHolderConverter}}"
AutoGenerateColumns
=
"False"
CanUserDeleteRows
=
"True"
IsSynchronizedWithCurrentItem
=
"True"
ShowGroupPanel
=
"False"
DockPanel.Dock
=
"Top"
AlternateRowBackground
=
"Beige"
AlternationCount
=
"2"
SelectionMode
=
"Extended"
VerticalContentAlignment
=
"Stretch"
>
<
telerik:EventToCommandBehavior.EventBindings
>
<
telerik:EventBinding
Command
=
"{Binding SelectionChangingCommand}"
EventName
=
"SelectionChanging"
RaiseOnHandledEvents
=
"True"
PassEventArgsToCommand
=
"True"
/>
<
telerik:EventBinding
Command
=
"{Binding NewEventCommand}"
EventName
=
"AddingNewDataItem"
RaiseOnHandledEvents
=
"True"
PassEventArgsToCommand
=
"True"
/>
<
telerik:EventBinding
Command
=
"{Binding DeleteEventCommand}"
EventName
=
"Deleting"
RaiseOnHandledEvents
=
"True"
PassEventArgsToCommand
=
"True"
/>
</
telerik:EventToCommandBehavior.EventBindings
>
<
telerik:RadGridView.Columns
>
<
telerik:GridViewDataColumn
Header
=
"Name*"
IsReadOnly
=
"False"
DataMemberBinding
=
"{Binding ItemProperty.Name, Mode=TwoWay}"
>
<
telerik:GridViewDataColumn.CellEditTemplate
>
<
DataTemplate
>
<
TextBox
Text
=
"{Binding ItemProperty.Name, Mode=TwoWay}"
telerik:TextBoxBehavior.UpdateTextOnTextChanged
=
"True"
/>
</
DataTemplate
>
</
telerik:GridViewDataColumn.CellEditTemplate
>
</
telerik:GridViewDataColumn
>
<
telerik:GridViewComboBoxColumn
Header
=
"Location*"
x:Name
=
"Location"
ItemsSource
=
"{Binding RelativeSource={RelativeSource Findancestor, AncestorType={x:Type Window}}, Path=DataContext.ROLocationDbmCollectionProperty}"
DataMemberBinding
=
"{Binding Path=ItemProperty.Location}"
DisplayMemberPath
=
"ItemProperty.Name"
SelectedValueMemberPath
=
"ItemProperty.Name"
/>
<
telerik:GridViewDataColumn
Header
=
"Recruitment Date*"
DataMemberBinding
=
"{Binding ItemProperty.RecruitmentDate}"
DataFormatString
=
"dd/MM/yyyy"
Width
=
"86"
/>
</
telerik:RadGridView.Columns
>
</
telerik:RadGridView
>
</
DockPanel
>
</
telerik:RadTabItem
>
<
telerik:RadTabItem
Visibility
=
"{Binding LocationVisibility}"
>
<
telerik:RadTabItem.Header
>
<
Label
Content
=
"_Locations"
/>
</
telerik:RadTabItem.Header
>
<
DockPanel
>
<
DockPanel.DataContext
>
<
local:LocationGridViewModel
/>
</
DockPanel.DataContext
>
<
local:ButtonPanel
DockPanel.Dock
=
"Top"
/>
<
TextBlock
Text
=
"{StaticResource Mandatory}"
DockPanel.Dock
=
"Bottom"
/>
<
telerik:RadGridView
ItemsSource
=
"{Binding Path=ItemCollectionProperty, Mode=TwoWay}"
SelectedItem
=
"{Binding CurrentlySelectedItem, Mode=TwoWay, Converter={StaticResource ignoreNewItemPlaceHolderConverter}}"
CurrentItem
=
"{Binding CurrentlySelectedItem, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, Converter={StaticResource ignoreNewItemPlaceHolderConverter}}"
AutoGenerateColumns
=
"False"
CanUserDeleteRows
=
"True"
IsSynchronizedWithCurrentItem
=
"True"
ShowGroupPanel
=
"False"
DockPanel.Dock
=
"Top"
AlternateRowBackground
=
"Beige"
AlternationCount
=
"2"
SelectionMode
=
"Extended"
VerticalContentAlignment
=
"Stretch"
>
<
telerik:EventToCommandBehavior.EventBindings
>
<
telerik:EventBinding
Command
=
"{Binding SelectionChangingCommand}"
EventName
=
"SelectionChanging"
RaiseOnHandledEvents
=
"True"
PassEventArgsToCommand
=
"True"
/>
<
telerik:EventBinding
Command
=
"{Binding NewEventCommand}"
EventName
=
"AddingNewDataItem"
RaiseOnHandledEvents
=
"True"
PassEventArgsToCommand
=
"True"
/>
<
telerik:EventBinding
Command
=
"{Binding DeleteEventCommand}"
EventName
=
"Deleting"
RaiseOnHandledEvents
=
"True"
PassEventArgsToCommand
=
"True"
/>
</
telerik:EventToCommandBehavior.EventBindings
>
<
telerik:RadGridView.Columns
>
<
telerik:GridViewDataColumn
Header
=
"Name*"
IsReadOnly
=
"False"
DataMemberBinding
=
"{Binding ItemProperty.Name, Mode=TwoWay}"
>
<
telerik:GridViewDataColumn.CellEditTemplate
>
<
DataTemplate
>
<
TextBox
Text
=
"{Binding ItemProperty.Name, Mode=TwoWay}"
telerik:TextBoxBehavior.UpdateTextOnTextChanged
=
"True"
/>
</
DataTemplate
>
</
telerik:GridViewDataColumn.CellEditTemplate
>
</
telerik:GridViewDataColumn
>
</
telerik:RadGridView.Columns
>
</
telerik:RadGridView
>
</
DockPanel
>
</
telerik:RadTabItem
>
... several more similar-looking tab-items
</
telerik:RadTabControl
>
private void OnGridPasting(object sender, GridViewClipboardEventArgs e)
{
((RadGridView) sender).CurrentColumn.SortingState = SortingState.None;
}
private void OnPastingCellClipboardContent(object sender, GridViewCellClipboardEventArgs e)
{
e.Cell.Column.SortingState = SortingState.None;
}
dynamic model =
new
ExpandoObject();
model.MyProperty = 42;
PropertyDefinition property =
new
PropertyDefinition
{
DisplayName = "MyProperty",
Binding =
new
Binding(
"MyProperty"
)
{
Source = model,
Mode = BindingMode.TwoWay
}
};