<
Window.Resources
>
<
DataTemplate
x:Key
=
"ItemContDataTemplateKey"
>
<
Grid
x:Name
=
"radCmb"
Width
=
"210"
HorizontalAlignment
=
"Left"
>
<
Grid.ColumnDefinitions
>
<
ColumnDefinition
Width
=
"20"
></
ColumnDefinition
>
<
ColumnDefinition
Width
=
"*"
></
ColumnDefinition
>
</
Grid.ColumnDefinitions
>
<
CheckBox
x:Name
=
"chkSelct"
HorizontalAlignment
=
"Left"
DataContext
=
"{Binding}"
Grid.Column
=
"0"
Unchecked
=
"chkSelct_Unchecked"
Checked
=
"chkSelct_Checked"
></
CheckBox
>
<
TextBlock
x:Name
=
"txtDropDown"
Text
=
"{Binding FullName}"
Grid.Column
=
"1"
></
TextBlock
>
</
Grid
>
</
DataTemplate
>
</
Window.Resources
>
<
Telerik:RadComboBox
Name
=
"radCmbCompany"
HorizontalAlignment
=
"Center"
Height
=
"25"
Width
=
"250"
SelectedValuePath
=
"Id"
IsEditable
=
"True"
IsReadOnly
=
"True"
ItemTemplate
=
"{StaticResource ItemContDataTemplateKey}"
>
</
Telerik:RadComboBox
>
//CODE BEHIND
public string DisplayMember { get; set; }
public static readonly DependencyProperty SelectedItemsProperty =
DependencyProperty.Register("SelectedItems", typeof(ObservableCollection<
object
>), typeof(Window1),
new FrameworkPropertyMetadata(new ObservableCollection<
object
>()));
public ObservableCollection<
object
> SelectedItems
{
get { return (ObservableCollection<
object
>)base.GetValue(SelectedItemsProperty); }
set { base.SetValue(SelectedItemsProperty, value); }
}
public static readonly DependencyProperty SelectedTextProperty =
DependencyProperty.Register("SelectedText", typeof(string), typeof(Window1),
new FrameworkPropertyMetadata());
public string SelectedText
{
get { return (string)base.GetValue(SelectedTextProperty); }
set { base.SetValue(SelectedTextProperty, value); }
}
private void chkSelct_Checked(object sender, RoutedEventArgs e)
{
SetSelectedText(sender);
}
private void chkSelct_Unchecked(object sender, RoutedEventArgs e)
{
SetSelectedText(sender);
}
private void SetSelectedText(object sender)
{
CheckBox chkbx = sender as CheckBox;
if (chkbx != null && chkbx.IsChecked.Equals(true))
{
this.SelectedItems.Add(chkbx.DataContext);
string CurrentselectedText = Convert.ToString(chkbx.DataContext.GetType().GetProperty(this.DisplayMember).GetValue(chkbx.DataContext, null));
if (this.SelectedText != null && this.SelectedText.Length > 0)
{
this.SelectedText += "," + CurrentselectedText;
}
else
{
this.SelectedText = CurrentselectedText;
}
}
else if (chkbx != null && chkbx.IsChecked.Equals(false))
{
string CurrentselectedText = Convert.ToString(chkbx.DataContext.GetType().GetProperty(this.DisplayPath).GetValue(chkbx.DataContext, null));
if (this.SelectedText != null && this.SelectedText.Length > 0 && this.SelectedText.IndexOf(',') > 0)
{
if (this.SelectedText.IndexOf(CurrentselectedText) + CurrentselectedText.Length <
this.SelectedText.Length
&& this.SelectedText.Substring(this.SelectedText.IndexOf(CurrentselectedText) + CurrentselectedText.Length, 1) == ",")
{
this.SelectedText
= this.SelectedText.Remove(this.SelectedText.IndexOf(CurrentselectedText), CurrentselectedText.Length + 1);
}
else
{
this.SelectedText
= this.SelectedText.Remove(this.SelectedText.IndexOf(CurrentselectedText) + 1, CurrentselectedText.Length);
}
}
else if (this.SelectedText != null && this.SelectedText.Length > 0)
{
this.SelectedText = string.Empty;
}
}
}
<!-- ScheduleView -->
<telerik:RadScheduleView x:Name="scheduleView"
Grid.Row="2"
MaxTimeRulerExtent="500"
AppointmentsSource="{Binding Tasks, Mode=TwoWay}"
ResourceTypesSource="{Binding ScheduleOptionList, Mode=TwoWay}"
GroupDescriptionsSource="{Binding GroupCollection, Mode=TwoWay}"
CurrentDate="{Binding DefaultDate}"
NavigationHeaderVisibility="Collapsed"
AllowDrop="True"
SnapAppointments="True"
MinAppointmentWidth="22"
Height="Auto">
<telerik:RadScheduleView.DragDropBehavior>
<local:ScheduleDragDropBehavior/>
</telerik:RadScheduleView.DragDropBehavior>
<telerik:RadScheduleView.AppointmentItemContentTemplate>
<DataTemplate>
<StackPanel>
<TextBlock Text="{Binding Subject}" FontWeight="Bold"/>
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding Start, StringFormat={}{0:H:mm}}"/>
<TextBlock Text=" - "/>
<TextBlock Text="{Binding End, StringFormat={}{0:H:mm}}"/>
</StackPanel>
</StackPanel>
</DataTemplate>
</telerik:RadScheduleView.AppointmentItemContentTemplate>
<telerik:RadScheduleView.ActiveViewDefinition>
<telerik:DayViewDefinition Orientation="Horizontal" FirstDayOfWeek="Monday" TimerulerMajorTickStringFormat="{}{0:HH}"
MinorTickLength="1h" MajorTickLength="1h" MinTimeRulerExtent="700" GroupHeaderDateStringFormat="{}{0:MM/dd}" />
</telerik:RadScheduleView.ActiveViewDefinition>
</telerik:RadScheduleView>
<
t:GridViewDataColumn
DataMemberBinding
=
"{Binding LastSave, Mode=OneWay}"
DataType
=
"{x:Type System:DateTime}"
Header
=
"Last Save"
IsReadOnly
=
"True"
IsGroupable
=
"False"
/>
<t:RadExpander MaxWidth="350" MinWidth="350" IsTabStop="False" Margin="10" IsExpanded="True" Name="xDrawing"> |
<t:RadExpander.Header> |
<StackPanel Orientation="Horizontal"> |
<TextBlock Text="DRAWING:" Width="55" Margin="0,5,20,2"/> |
<t:RadButton x:Name="btnAddDwg" IsTabStop="False" Content="+" Width="25" Height="20" Margin="10,0,0,5" ToolTip="Click to add a new Drawing to the current Job./nAlt D" Click="btnAddDwg_Click" /> |
<t:RadButton x:Name="btnDeleteDwg" Content="-" IsTabStop="False" Width="25" Height="20" Margin="10,0,0,5" ToolTip="Remove Assembly" Click="btnDeleteDwg_Click"/> |
</StackPanel> |
</t:RadExpander.Header> |
<StackPanel> |
<StackPanel Margin="3,3,3,3" Orientation="Horizontal"> |
<TextBlock Text="Drawing#" Margin="0,2,2,2"/> |
<xcd:AutoSelectTextBox x:Name="txtdwgNo" Text="{Binding CurrentDrawing.dwgNo}" AutoSelectBehavior="OnFocus" Width="100" Margin="3,3,3,3" TextChanged="UCase_TextChanged"/> |
<TextBlock Text="Date" Margin="20,2,2,2"/> |
<xcd:AutoSelectTextBox x:Name="txtDate" Text="{Binding CurrentDrawing.dwgDate}" AutoSelectBehavior="OnFocus" Width="125" Margin="3,3,3,3" TextChanged="UCase_TextChanged"/> |
</StackPanel> |
<StackPanel Margin="3,3,3,3" Orientation="Horizontal"> |
<TextBlock Text="Drawn By" Margin="0,2,2,2"/> |
<xcd:AutoSelectTextBox x:Name="txtDrawnBy" AutoSelectBehavior="OnFocus" Text="{Binding CurrentDrawing.dwgBy}" Width="200" Margin="3,3,3,3"/> |
<TextBlock Text="HOLD" Margin="20,2,2,2"/> |
<xcd:CheckBox Name="chkDWGHold" Margin="3,3,3,3" IsChecked="{Binding CurrentDrawing.hold}"/> |
</StackPanel> |
</StackPanel> |
</t:RadExpander> |