or
<Grid> <Grid.RowDefinitions> <RowDefinition Height="Auto" /> <RowDefinition Height="*" /> </Grid.RowDefinitions> <Border Grid.Row="0" Height="22" BorderBrush="#FFD6D4D4" BorderThickness="0,0,0,1" VerticalAlignment="Top" Background="#FFF7F7F7" HorizontalAlignment="Stretch"> <TextBlock Style="{StaticResource HeaderTextBlockStyle}" Text="Final tournament" Margin="6 2 2 2" /> </Border> <telerik:RadListBox Grid.Row="1" AllowDrop="True" ItemsSource="{Binding GroupD}" ItemTemplate="{StaticResource ListBoxItemTemplate}"> <telerik:RadListBox.DragVisualProvider> <telerik:ScreenshotDragVisualProvider /> </telerik:RadListBox.DragVisualProvider> <telerik:RadListBox.DragDropBehavior> <telerik:ListBoxDragDropBehavior AllowReorder="True" /> </telerik:RadListBox.DragDropBehavior></telerik:RadListBox> </Grid><Popup x:Name="popUpnotifyIcon" AllowsTransparency="True" PopupAnimation="Fade" Placement="Top" PlacementTarget="{Binding ElementName=yahoo}" HorizontalOffset="0" VerticalOffset="20" > <Viewbox VerticalAlignment="Top" > <TextBlock Text="dfsdfsdf" /> </Viewbox></Popup><UserControl x:Class="MonitoringRounds" xmlns:local="clr-namespace:EScIS.Win.Controls.MonitoringRounds" xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" mc:Ignorable="d" d:DesignHeight="600" d:DesignWidth="1000" > <UserControl.DataContext> <local:MonitoringRoundsViewModel/> </UserControl.DataContext> <Grid> <Grid.RowDefinitions> <RowDefinition Height="0.05*" /> <RowDefinition /> </Grid.RowDefinitions> <TextBlock Grid.Row="0">Monitoring Rounds</TextBlock> <telerik:RadScheduleView Grid.Row="1" Name="radsvMonitoringRounds" Padding="5" MaxHeight="400" MaxWidth="600" AppointmentsSource="{Binding Appointments}" ResourceTypesSource="{Binding ResourcesTypes}"> <telerik:RadScheduleView.ViewDefinitions> <telerik:MonthViewDefinition /> <telerik:TimelineViewDefinition /> </telerik:RadScheduleView.ViewDefinitions> </telerik:RadScheduleView> </Grid></UserControl><Window x:Class="LSpecs" xmlns:menu="clr-namespace:EScIS.Win.LSpecs.UI.Controls.Menu;assembly=EScIS.Win.LSpecs.UI.Controls.Menu" xmlns:ma ="clr-namespace:EScIS.Win.Controls.MonitoringAssignees;assembly=EScIS.Win.Controls.MonitoringAssignees" xmlns:mp ="clr-namespace:EScIS.Win.Controls.MonitoringPrograms;assembly=EScIS.Win.Controls.MonitoringPrograms" xmlns:mr ="clr-namespace:EScIS.Win.Controls.MonitoringRounds;assembly=EScIS.Win.Controls.MonitoringRounds" Title="Desktop" Height="1200" Width="1900" WindowState="Maximized"> <Grid> <Grid.RowDefinitions> <RowDefinition Height="40" /> <RowDefinition /> <RowDefinition Height="20"/> </Grid.RowDefinitions> <Border Grid.Row="0" Name="borderMainToolBar" BorderThickness="0,0,0,2" BorderBrush="Gray"> <menu:MainToolbar Name="ctrlMainToolBar" menu:MainToolbar.Button_Click_WorkflowMenu="ctrlDesktop_Button_Click_WorkflowMenu"/> </Border> <menu:Desktop Grid.Row="1" Name="ctrlDesktop" menu:WorkflowFieldPreparation.Button_Click_MonitoringAssignees="Desktop_Button_Click_MonitoringAssignees" menu:WorkflowFieldPreparation.Button_Click_MonitoringPrograms="ctrlDesktop_Button_Click_MonitoringPrograms" menu:WorkflowFieldPreparation.Button_Click_MonitoringRounds="ctrlDesktop_Button_Click_MonitoringRounds" /> <ma:MonitoringAssignees Grid.Row="1" Name="ctrlMonitoringAssignees" Visibility="Hidden"/> <mp:MonitoringPrograms Grid.Row="1" Name="ctrlMonitoringPrograms" Visibility="Hidden"/> <mr:MonitoringRounds Grid.Row="1" Name="ctrlMonitoringRounds" Visibility="Hidden"/> </Grid></Window>Imports EScIS.DatabaseImports EScIS.MVVM.BaseImports System.ComponentModelImports System.Collections.ObjectModelImports System.Windows.DataImports Telerik.Windows.ControlsImports Telerik.Windows.Controls.ScheduleViewPublic Class MonitoringRoundsViewModel Inherits EScIS.MVVM.Base.ViewModelBase Private _context As ESdatEntities Private _monitoringRounds As ObservableCollection(Of Monitoring_Rounds) Private _monitoringRoundsView As ICollectionView Private _monitoringPrograms As ObservableCollection(Of LSPECS_Monitoring_Programs) Private _monitoringProgramsView As ICollectionView Private _monitoringRoundsAssignedMonitoringPrograms As ObservableCollection(Of LSPECS_Monitoring_Round_Assigned_Monitoring_Programs) Private _monitoringRoundsAssignedMonitoringProgramsView As ICollectionView Private _appointments As ObservableCollection(Of Appointment) Private _resourcesTypes As ObservableCollection(Of ResourceType) Public Property MonitoringRoundsList() As ObservableCollection(Of Monitoring_Rounds) Get Return Me._monitoringRounds End Get Set(value As ObservableCollection(Of Monitoring_Rounds)) Me._monitoringRounds = value Me.OnPropertyChanged("MonitoringRoundsList") End Set End Property Public Property MonitoringProgramsList() As ObservableCollection(Of LSPECS_Monitoring_Programs) Get Return Me._monitoringPrograms End Get Set(value As ObservableCollection(Of LSPECS_Monitoring_Programs)) Me._monitoringPrograms = value Me.OnPropertyChanged("MonitoringProgramsList") End Set End Property Public Property MonitoringRoundsAssignedMonitoringProgramsList() As ObservableCollection(Of LSPECS_Monitoring_Round_Assigned_Monitoring_Programs) Get Return Me._monitoringRoundsAssignedMonitoringPrograms End Get Set(value As ObservableCollection(Of LSPECS_Monitoring_Round_Assigned_Monitoring_Programs)) Me._monitoringRoundsAssignedMonitoringPrograms = value Me.OnPropertyChanged("MonitoringRoundsAssignedMonitoringProgramsList") End Set End Property Public Property Appointments() As ObservableCollection(Of Appointment) Get Return Me._appointments End Get Set(value As ObservableCollection(Of Appointment)) Me._appointments = value Me.OnPropertyChanged("Appointments") End Set End Property Public Property ResourcesTypes() As ObservableCollection(Of ResourceType) Get Return Me._resourcesTypes End Get Set(value As ObservableCollection(Of ResourceType)) Me._resourcesTypes = value Me.OnPropertyChanged("ResourcesTypes") End Set End Property Public Sub New() Me.Load(Nothing) End Sub Protected Overrides Sub Add(action As Object) End Sub Protected Overrides Sub Delete(action As Object) End Sub Protected Overrides Sub Edit(action As Object) End Sub Protected Overrides Sub Load(action As Object) LoadData() LoadCalendarData() End Sub Public Sub LoadControlData() Me.Load(Nothing) End Sub Private Sub LoadData() Try With Me._context Me._context = New ESdatEntities() Me.MonitoringRoundsList = New ObservableCollection(Of Monitoring_Rounds)( From mr In Me._context.Monitoring_Rounds Select mr) Me.MonitoringProgramsList = New ObservableCollection(Of LSPECS_Monitoring_Programs)( From mp In Me._context.LSPECS_Monitoring_Programs Select mp) Me.MonitoringRoundsAssignedMonitoringProgramsList = New ObservableCollection(Of LSPECS_Monitoring_Round_Assigned_Monitoring_Programs)( From mramp In Me._context.LSPECS_Monitoring_Round_Assigned_Monitoring_Programs Select mramp) End With Catch ex As Exception Debug.WriteLine(ex.Message) Throw New ApplicationException("Database Error: " & ex.Message) End Try Me._monitoringRoundsView = CollectionViewSource.GetDefaultView(Me.MonitoringRoundsList) Me._monitoringProgramsView = CollectionViewSource.GetDefaultView(Me.MonitoringProgramsList) Me._monitoringRoundsAssignedMonitoringProgramsView = CollectionViewSource.GetDefaultView(Me.MonitoringRoundsAssignedMonitoringProgramsList) Me.OnPropertyChanged("MonitoringRoundsList") Me.OnPropertyChanged("MonitoringProgramsList") Me.OnPropertyChanged("MonitoringRoundsAssignedMonitoringProgramsList") End Sub Private Sub LoadCalendarData() 'GenerateResourcesFromMonitoringPrograms() 'GenerateAppointmentsFromMonitoringPrograms() 'GenerateAppointmentsFromMonitoringRounds() Me.ResourcesTypes = New ObservableCollection(Of ResourceType) Me.Appointments = New ObservableCollection(Of Appointment) End Sub Private Sub GenerateResourcesFromMonitoringPrograms() Me.ResourcesTypes = New ObservableCollection(Of ResourceType) 'Add monitoring program resource type Dim mpType As New ResourceType("Monitoring Program") 'Add monitoring programs as resources If Me._monitoringPrograms Is Nothing Then Return End If For Each mp In _monitoringPrograms Dim res As New Resource(mp.Monitoring_Program) mpType.Resources.Add(res) Next Me.ResourcesTypes.Add(mpType) Me.OnPropertyChanged("ResourcesTypes") End Sub Private Sub GenerateAppointmentsFromMonitoringPrograms() Me.Appointments = New ObservableCollection(Of Appointment) 'Add monitoring programs as appointments If Me._monitoringPrograms Is Nothing Then Return End If For Each mp In _monitoringPrograms Dim app As New Appointment() app.Subject = mp.Monitoring_Program app.Start = mp.Start_Date app.End = If(mp.End_Date.HasValue, mp.End_Date, mp.Start_Date) Me.Appointments.Add(app) Next Me.OnPropertyChanged("Appointments") End Sub Private Sub GenerateAppointmentsFromMonitoringRounds() If Me.Appointments Is Nothing Then Me.Appointments = New ObservableCollection(Of Appointment) End If 'Add MonitoringRounds as appointments If Me._monitoringRounds Is Nothing Then Return End If For Each mr In _monitoringRounds Dim app As New Appointment() app.Subject = mr.Monitoring_Round app.Start = mr.Start_Date app.End = If(mr.End_Date.HasValue, mr.End_Date, mr.Start_Date) Me.Appointments.Add(app) Next Me.OnPropertyChanged("Appointments") End Sub Public Overrides Sub Dispose() If Not Me.disposed Then Me._context.Dispose() Me.disposed = True End If MyBase.Dispose() End SubEnd Class<telerik:RadButton cal:Message.Attach="Show" BorderBrush="{x:Null}" Background="{x:Null}" Foreground="Black" FontFamily="Arial" Margin="1,3"> <Grid> <telerik:RadContextMenu.ContextMenu> <telerik:RadContextMenu ItemsSource="{Binding Items}" Placement="Right" DisplayMemberPath="DisplayName" / > </telerik:RadContextMenu.ContextMenu> <TextBlock VerticalAlignment="Top" Foreground="Red" HorizontalAlignment="Right" Margin="2" Text="{Binding Status}" /> <StackPanel> <Image Source="{Binding Icon}" HorizontalAlignment="Center" VerticalAlignment="Center" /> <TextBlock Text="{Binding IconName}" Foreground="White" HorizontalAlignment="Center" /> </StackPanel> </Grid> </telerik:RadButton><telerik:RadContextMenu.ContextMenu> <telerik:RadContextMenu ItemsSource="{Binding Items}" Placement="Right" DisplayMemberPath="DisplayName" > <telerik:RadContextMenu.ItemTemplate> <DataTemplate> <TextBlock Text="{Binding DisplayName}" /> </DataTemplate> </telerik:RadContextMenu.ItemTemplate> </telerik:RadContextMenu> </telerik:RadContextMenu.ContextMenu>