翻譯|使用教程|編輯:陳津勇|2019-11-19 10:22:22.023|閱讀 314 次
概述:本文詳細(xì)介紹了使用DotNetBar for Silverlight用戶界面工具箱在Silverlight計劃中自定義Appointment Views的操作步驟。
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
DotNetBar for Silverlight是一個能幫助用戶創(chuàng)建專業(yè)Silverlight應(yīng)用程序的用戶界面工具箱,它包含了Calendar/Scheduler控件、徑向菜單、超級工具提示等。本文詳細(xì)介紹了在Silverlight計劃中自定義Appointment Views的操作步驟。
免費下載DotNetBar for Silverlight正式版
可以在全局級別、每個日歷視圖(即日、周、月或時間軸)和/或每個預(yù)約的基礎(chǔ)上自定義Appointment Views。
使用Appointment.ViewDefinitions屬性可以在每個約定的基礎(chǔ)上定義自定義項。
使用CalendarModel.AppointmentViewDefinitions屬性或CalendarView.ViewCustomizations可以在全局級別上定義自定義項。
CalendarView.ViewCustomizations是CalendarViewCustomizations類型的屬性,而該屬性又具有三個用于自定義日歷視圖不同方面的屬性:GlobalAppointmentViewDefinitions,DayTimeSlotAppearances和MonthDayAppearances。若要自定義預(yù)定視圖,請使用GlobalAppointmentViewDefinitions屬性。
注意:預(yù)定視圖的尺寸(寬度和高度)在內(nèi)部設(shè)置。在“月”視圖、“時間軸”視圖、“周”和“天”視圖中的多日預(yù)約的高度是不變的。使用的值在ScheduleSettings(DevComponents.Silverlight.Schedule)中定義,并且可以在運行時更改。其屬性和默認(rèn)值是:MonthViewAppointmentHeight = 18,TimelineViewAppointmentHeight = 21,WeekViewMultiDayAppointmentHeight = 18。
定義一組appointment視圖自定義項的類型是AppointmentViewDefinitionSet。雖然AppointmentViewDefinitionSet是AppointmentViewDefinition實例的集合,但它也暴露了以下依賴項屬性,這些屬性可用于為所有日歷視圖中的預(yù)約設(shè)置視圖屬性:
CommonBackground –用于所有視圖類型(日、周、月和時間軸)中預(yù)約背景的畫筆
CommonBorderBrush –一種畫筆,用于所有視圖類型中的預(yù)約邊框。
CommonCornerRadius –用于所有視圖類型的預(yù)約的CornerRadius。
CommonToolTip –用于所有視圖類型的預(yù)約的工具提示。其值可以是DevComponents.Silverlight.Controls.SuperToolTip或System.Windows.Controls.ToolTip的實例。或是任何Clr對對象,在這種情況下,值被設(shè)置為SuperToolTip的內(nèi)容。
CommonImageSource –用于所有視圖類型的預(yù)約的圖像。值可以是指定圖像位置的字符串或Uri,也可以是ImageSource對象。
CommonSelectionBorderBrush –選擇預(yù)約時所有視圖類型中預(yù)約邊框的畫筆。
通過類AppiontmentViewDefinition支持在每個日歷視圖基礎(chǔ)上設(shè)置屬性。定義集中設(shè)置的值總是優(yōu)先于定義集中定義的對應(yīng)值。定義集公開了類型為AppointmentViewDefinition的四個屬性,每個日歷視圖類型各有一個屬性:日、周、月和時間線。appointment視圖定義公開以下依賴項屬性:
AppointmentTemplate –定義一個數(shù)據(jù)模板,用作AppointmentView控件的ContentTemplate。AppointmentView控件是一個ContentControl。默認(rèn)情況下,Content屬性設(shè)置為等于DataContext屬性,該屬性是DevComponents.Silverlight.Calendar.ViewModel.AppointmentViewModel的實例。
Background –定義用于appointment視圖背景的筆刷。如果設(shè)置了Appointment.CategoryColor的有效值,則忽略此值。
BorderBrush –定義用于appointment視圖邊框的畫筆。如果將Appointment.CategoryColor的值設(shè)置為內(nèi)置值之一,則忽略此值。
CornerRadius –定義appointment視圖的拐角半徑。默認(rèn)值為0。
CustomData –放置自定義數(shù)據(jù)對象的位置,然后可以在AppointmentTemplate和/或ToolTipTemplate中對其進(jìn)行綁定。
ImageSource –指定要與預(yù)約關(guān)聯(lián)的圖像。值可以是指定圖像位置的字符串或Uri,也可以是ImageSource對象。
MultiDayAppointmentTemplate –定義一個DataTemplate用于多日預(yù)約的視圖。注意:對于“月”和“時間軸”視圖,如果在提供AppointmentTemplate的值時未設(shè)置此值,則AppointmemtTemplate的值將用于所有預(yù)約,包括單日和多日。
SelectionBorderBrush –選中時用于預(yù)約邊框的畫筆。默認(rèn)值由資源提供,鍵為“AppointmentSelectedBorderBrush”。
ToolTip–與適用視圖中的預(yù)約相關(guān)聯(lián)的工具提示。此值可以是DevComponents.Silverlight.Controls.SuperToolTip或System.Windows.Controls.ToolTip的實例。或者,它可以是任何Clr對象,在這種情況下,值被設(shè)置為SuperToolTip的內(nèi)容。
ToolTipTemplate – 用于appointment視圖創(chuàng)建的SuperToolTip的ContentTemplate。默認(rèn)情況下,將創(chuàng)建一個SuperToolTip,并將其content屬性設(shè)置為與預(yù)約關(guān)聯(lián)的AppointmentViewModel實例。如果未設(shè)置此值,則默認(rèn)工具提示內(nèi)容模板由具有靜態(tài)屬性AppointmentView.DefaultToolTipContentTemplateKey定義的鍵的資源定義,其默認(rèn)值為“ StandardAppointmentToolTipTemplate”。
注意,可以從AppointmentViewDefinitionSet和AppointmentViewDefinition之一或兩者中派生出更大的自定義可能性。為了支持這個場景,屬性AppointmentViewDefinition.CurrentView將始終包含AppointmentViewModel的活躍實例,該實例為當(dāng)前視圖提供數(shù)據(jù),可用于運行時屬性修改。
免費下載DotNetBar for Silverlight正式版
完全支持屬性繼承。最高優(yōu)先級是appointment視圖定義提供的值,這些定義取自直接應(yīng)用于預(yù)約的定義集。下一個最高優(yōu)先級是在預(yù)約定義上設(shè)置的值,這些值取自通過日歷控件本身直接或間接應(yīng)用到日歷模型的全局定義集。如果它們都不具有值集,則將檢查定義集提供的公用值,并將對直接應(yīng)用于約會的集合上的值設(shè)置優(yōu)先于全局集合的值。
這是在單個預(yù)約中設(shè)置要用于周視圖和日視圖的圖像的示例:
字符串 url = “ images / don.png” ; 如果 (預(yù)約。ViewDefinitions == 空) 預(yù)約。ViewDefinitions = new AppointmentViewDefinitionSet (); 任命。ViewDefinitions 。天。ImageSourceUri =約會。ViewDefinitions 。周。ImageSourceUri = 新的 Uri (網(wǎng)址,UriKind 。相對);
全局appointment視圖定義集可以在Xaml中定義和應(yīng)用。這是從樣例ScheduleControlMVVMSample獲取并在Xaml中設(shè)置,且應(yīng)用的全局定義集的示例:
<時間表:CalendarViewCustomizations X:鍵 = “ViewCustomizations” > <時間表:CalendarViewCustomizations.GlobalAppointmentViewDefinitions > <時間表:AppointmentViewDefinitionSet > <時間表:AppointmentViewDefinitionSet.CommonToolTip > <控件:SuperToolTip 樣式 = “{StaticResource的AppointmentToolTipStyle}” /> </時間表:AppointmentViewDefinitionSet .CommonToolTip > <schedule:AppointmentViewDefinitionSet.Day > <schedule:AppointmentViewDefinition AppointmentTemplate = “ {StaticResource CustomDayViewAppointmentTemplate}” /> </schedule:AppointmentViewDefinitionSet.Day > </ schedule:AppointmentViewDefinitionSet > </schedule:CalendarViewCustomizations.GlobalAppointmentViewDefinitions > </ schedule:CalendarViewCustomizations >
通過將ViewCustomizations屬性設(shè)置為以下方式,將該自定義應(yīng)用于CalendarView:
ViewCustomizations =“ {StaticResource CalendarViewCustomizations}”
Appointment View模型
Appointment - 視圖模型是其包裝器的實際預(yù)約實例。
ViewDefinition – 有效的預(yù)約視圖定義。該實例基于繼承鏈將所有屬性綁定到最相關(guān)的源。
ImageSource –獲取或設(shè)置由Image的ImagesSource屬性綁定的值。默認(rèn)情況下,它將在有效Appointment視圖定義上返回ImageSource的值,或者返回null。
OwnerKey –獲取或設(shè)置預(yù)約所有者的Key。有效地設(shè)置此值將更改預(yù)約的所有者。
Owner –獲取類Owner的實例,該類代表預(yù)約的所有者。
IsLocked –獲取或設(shè)置預(yù)約的Locked屬性。
IsSelected –獲取或設(shè)置預(yù)約的IsSelected屬性。
IsRecurrenceRoot –獲取預(yù)約是否為重復(fù)的根預(yù)約。
IsRecurring –獲取預(yù)約是否為重復(fù)預(yù)約的一部分。
StartTime –獲取或設(shè)置預(yù)約的開始時間。
EndTime –獲取或設(shè)置預(yù)約的結(jié)束時間。
Subject–獲取或設(shè)置預(yù)約的主題。
Description–獲取或設(shè)置預(yù)約的說明。
CategoryColor –獲取或設(shè)置預(yù)約CategoryColor的值。
TimeMarkedAs –獲取或設(shè)置預(yù)約TimeMarkedAs的值。
CornerRadius –獲取預(yù)約視圖的角半徑。
SelectionBorderBrush –選擇預(yù)約時獲取用于邊框的畫筆。
Background–獲得有效的預(yù)約背景畫筆。
BorderBrush –獲取預(yù)約的有效邊框筆刷。
TimeMarkerBrush –獲取用于時間標(biāo)記的有效畫筆。
CurrentViewType –獲取當(dāng)前活動視圖(例如Month、Week、Day或Timeline)的CalendarViewType。
默認(rèn)模板
默認(rèn)的AppointmentView和ToolTip ContentTemplates在運行時合并到當(dāng)前應(yīng)用程序的資源字典中。系統(tǒng)提供了一些默認(rèn)模板,您可以用它們來自定義模板。
請注意,可以通過在Application.Resources部分中使用相同的鍵定義一個新值來覆蓋所有默認(rèn)模板。這是在全局級別上自定義預(yù)約的另一種方法。
Appointment View模板
<!-定義用于“月”視圖中約會的默認(rèn)DataTemplate。-> <DataTemplate x:Key = “ MonthViewAppointmentTemplate” > <TextBlock Margin = “ 5,0,1,0” > <Run Text = “ {Binding Subject}” /> <Run Text = “ {Binding StartTime,StringFormat = '{0:t}'}“ /> </ TextBlock > </ DataTemplate > <!-在月視圖中為多日約會定義默認(rèn)的DataTemplate。-> <DataTemplate x:Key = “ -在“周”或“天”視圖中使用約會的默認(rèn)DataTemplate。 -> <DataTemplate x:Key = “ WeekViewAppointmentTemplate” > <網(wǎng)格> <Grid.ColumnDefinitions > <ColumnDefinition Width = “自動” /> <ColumnDefinition Width = “自動” /> <ColumnDefinition /> </Grid.ColumnDefinitions > <Grid.RowDefinitions > < RowDefinition Height = “ Auto” /> <RowDefinition /> </Grid.RowDefinitions > <Border Grid.RowSpan = “ 2” 寬度 = “ 5” HorizontalAlignment =“左” BorderThickness = “ 0,0,1,0” CornerRadius = “ {Binding CornerRadius}” BorderBrush = “ {Binding BorderBrush}” 背景 = “ {Binding TimeMarkerBrush}” 可見性 = “ {Binding TimeMarkerVisibility}” /> <圖像保證金 = “ 3,3,0,0” Grid.Column = “ 1” HorizontalAlignment = “ Left” VerticalAlignment = “ Top” MaxHeight = “ 20” MaxWidth = “ 20”拉伸 = “均勻” 來源 = “ {Binding ViewDefinition.ImageSource}” 可見性 = “ {Binding ViewDefinition.ImageSource,Converter = {StaticResource nullableToVisibilityConverter}}” /> <TextBlock Grid.Column = “ 2” Margin = “ 3,3,0,0” TextWrapping = “ Wrap“ Text = ” {Binding Subject}“ /> <TextBlock Margin = ” 3,3,0,0“ Grid.Row = ” 1“ Grid.Column = ” 1“ Grid.ColumnSpan = ” 3“ TextWrapping = ”包裝”文字 = “ {綁定說明}” /> </ Grid > </ DataTemplate > <!-在“周”或“天”視圖中定義多天約會的默認(rèn)數(shù)據(jù)模板。-> <DataTemplate x:Key = “ WeekViewMultiDayAppointmentTemplate” > <TextBlock 保證金 = “ 10,0,5,0” HorizontalAlignment = “左” > <運行 文本 = “ {綁定主題}” /> <運行 文本 = “ { Binding StartTime,StringFormat ='{0:MMMM dd}'}“ /> <Run Text = ” {Binding EndTime, Text = “ {Binding StartTime,StringFormat ='-{0:t}'}} /> /> <Run Text = ” {Binding EndTime,StringFormat ='to {0:t}'}“ /> </ TextBlock > </ DataTemplate > <!-在“時間軸”視圖中定義約會的默認(rèn)數(shù)據(jù)模板。-> <DataTemplate x:Key = “ TimelineViewAppointmentTemplate” > <TextBlock Margin = “ 10,0,5,0” HorizontalAlignment = “左” > <Run Text = “ {Binding Subject}” /> “ {Binding StartTime,StringFormat ='{0:MMMM dd}'}” /> <運行 文本 = “ {Binding EndTime,StringFormat ='thru {0:MMMM dd}'}” /> <Run Text = “ {Binding StartTime,StringFormat ='-{0:t}'}“ /> <Run Text = ” {綁定EndTime,StringFormat ='至{0:t}'}“ /> </ TextBlock > </ DataTemplate >
工具提示模板
<!-在“日”,“周”和“時間軸”視圖中為約會工具提示定義默認(rèn)的DataTemplate。-> <DataTemplate x:Key = “ StandardAppointmentToolTipTemplate” > <Grid MaxWidth = “ 300” > <Grid.RowDefinitions > <RowDefinition Height = “ Auto” /> <RowDefinition Height = “ Auto” /> <RowDefinition Height = “ Auto “ /> </Grid.RowDefinitions > <TextBlock Text = ” {Binding Subject}“ <TextBlock Grid.Row = “ 1” > <運行 文本 = “ {Binding StartTime,StringFormat ='t'}” /> <Run Text = “ {Binding EndTime,StringFormat ='to {0:t}'}” / > </ TextBlock > <TextBlock Grid.Row = “ 2” Text = “ {Binding Description}” TextWrapping = “ Wrap” /> </ Grid > </ DataTemplate > <!-定義月約會視圖的默認(rèn)DataTemplate工具提示-> <DataTemplate x:Key = “ MonthCalloutToolTipTemplate” > <Grid > <Grid.ColumnDefinitions > <ColumnDefinition Width = “ Auto” /> <ColumnDefinition /> <ColumnDefinition Width = “ Auto” /> </Grid.ColumnDefinitions > <Grid.RowDefinitions > <RowDefinition /> <RowDefinition /> < RowDefinition /> </Grid.RowDefinitions > <邊框 高度 = “ 10” 寬度 = “ 10” HorizontalAlignment = “中心” VerticalAlignment = “中心” CornerRadius = “ 3” BorderThickness = “ 1” 背景 = “ {綁定背景}” BorderBrush = “ {Binding BorderBrush}” /> <TextBlock Grid.Column = “ 1” 保證金 = “ 7,0,8,0” HorizontalAlignment = “左” 文本 = “ {綁定主題}” FontWeight = “粗體” TextWrapping = “包裝” ctrls:DynamicResource.ForegroundKey = “ CalloutSubjectForeground” /> <TextBlock Margin = “ 0,0,5,0” Grid.Column = “ 2” HorizontalAlignment = “ Right” ctrls:DynamicResource.ForegroundKey = “ CalloutTimeForeground” > <Run Text = “ {Binding StartTime,StringFormat ='t'}” /> <Run Text = “ {Binding EndTime,StringFormat ='至{0:t}'}“ /> </ TextBlock > <Line Grid.ColumnSpan = ” 3“ Grid.Row = ” 1“ 裕度 = ” 0,3“ StrokeThickness = ” 1“ X1 = “ 0” X2 = “ 1” Y1 =“ 0” Y2 = “ 0” Stretch = “填充” ctrls:DynamicResource.StrokeKey = “ CalloutSeparatorBorder” 可見性 = “ {綁定說明,轉(zhuǎn)換器= {StaticResource nullableToVisibilityConverter}}” /> <Grid Grid.Row = “ 2” 網(wǎng)格。 ColumnSpan = “ 3” > <Grid.ColumnDefinitions > <ColumnDefinition Width = “自動” /> <ColumnDefinition /> </Grid.ColumnDefinitions > <圖像邊距 = “ 0,0,5,0” VerticalAlignment = “ Top” MaxHeight = “ 20” MaxWidth = “ 20” Stretch = “ Uniform” 源 = “ {Binding ImageSource}” 可見性 = “ {Binding ImageSource,Converter = {StaticResource nullableToVisibilityConverter}}” /> <TextBlock MaxWidth = “ 370” Grid.Column = “ 1” VerticalAlignment = “居中” Text = “ {裝訂說明}” TextWrapping = “包裝” HorizontalAlignment = “左”ctrls:DynamicResource.ForegroundKey = “ CalloutDescriptionForeground” /> </ Grid > </ Grid > </ DataTemplate >
基于AppointmentView的控件的默認(rèn)樣式和模板
如果有必要,可以使用Silverlight提供的隱式樣式繼承,通過AppointmentView控件的Style屬性來修改預(yù)約視圖。注意,使用預(yù)約視圖的隱式樣式只能在全局級別上自定義預(yù)約。不能為單個預(yù)約的視圖提供自定義樣式或模板。
AppointmentView控件是從AppointmentView派生的控件– AppointmentView本身是一個抽象類。為每種日歷視圖類型定義了特定的約會視圖控件。具體的AppointmentView控件是:
Month Appointmemt View – 在“月”視圖中提供單日預(yù)約的視圖。
MonthMultiDaySegmentAppointmentView –在“月”視圖中提供多天預(yù)約的一部分視圖。一個段代表一個星期包含的預(yù)約的時間跨度。
Week Appointment View –在“周”和“日”視圖中提供一天預(yù)約的視圖。
Week MultiDay Appointment View –在“周”和“天”視圖中提供多天預(yù)約的視圖。
Timeline Appointment View –在“時間軸”視圖中提供預(yù)約的視圖。
為方便,系統(tǒng)提供了默認(rèn)控件模板。您可以使用它們進(jìn)行自定義。
Month Appointment View控件模板
Month Appointment View的默認(rèn)控件模板:
<ControlTemplate TargetType = “ sch:MonthAppointmentView” > <網(wǎng)格> <邊框 背景 = “ {Binding Background}” BorderBrush = “ {Binding BorderBrush}” BorderThickness = “ 1” CornerRadius = “ {Binding CornerRadius}” /> <ContentPresenter VerticalAlignment = “ Center” Content = “ {TemplateBinding DataContext}” ContentTemplate = “ {TemplateBinding AppointmentTemplate}” /> <邊框 名稱 = “ SelectedBorder” BorderThickness= “ 2” BorderBrush = “ {Binding SelectionBorderBrush}” 不透明度 = “ 0” CornerRadius = “ {Binding CornerRadius}” /> <sch:MonthAppointmentMoveThumb x:Name = “ MoveThumb” /> <VisualStateManager.VisualStateGroups > <VisualStateGroup x:Name = “ SelectedStates” > <VisualState x:Name = “未選擇” /> <VisualState x:Name = “ Selected” > <故事板> <DoubleAnimation Storyboard.TargetName =“ SelectedBorder” Storyboard.TargetProperty = “ Opacity” To = “ 1” 持續(xù)時間 = “ 0:0:0.01” /> </ Storyboard > </ VisualState > </ VisualStateGroup > <VisualStateGroup x:Name = “ RecurrenceStates” > <VisualState x:Name = “ NonRecurring” /> <VisualState x:Name = “ RecurrenceRoot” /> <VisualState x:Name = “ RecurringInstance” > <故事板> <ObjectAnimationUsingKeyFrames Storyboard.TargetName = “ MoveThumb” Storyboard.TargetProperty = “可見性” > <DiscreteObjectKeyFrame KeyTime = “ 0” 值 = “ Collapsed” /> </ ObjectAnimationUsingKeyFrames > </ Storyboard > </ VisualState > </ VisualStateGroup > </VisualStateManager.VisualStateGroups > </ Grid > </ ControlTemplate >
Month MultiDay Segment Appointment View的默認(rèn)控件模板:
<ControlTemplate TargetType = “ sch:MonthMultiDaySegmentAppointmentView” > <網(wǎng)格> <邊框 名稱 = “ NormalBorder” 背景 = “ {綁定背景}” BorderBrush = “ {Binding BorderBrush}” BorderThickness = “ 1” CornerRadius = “ {Binding CornerRadius}” / > <ContentPresenter Content = “ {TemplateBinding DataContext}” ContentTemplate = “ {TemplateBinding AppointmentTemplate}” VerticalAlignment = “中心” /> <邊框 名稱= “ SelectedBorder” BorderThickness = “ 2” BorderBrush = “ {Binding SelectionBorderBrush}” 不透明度 = “ 0” CornerRadius = “ {Binding CornerRadius}” /> <sch:MonthAppointmentMoveThumb x:Name = “ MoveThumb” /> <Grid Name = “ MoveResizeGroup“ 可見性 = ”崩潰“ > <sch:MonthAppointmentResizeThumb x:Name = ” ResizeLeft“ 保證金 = ” -2,0,0,0“ HorizontalAlignment = “左” 可見性 =“ Collapsed” /> <sch:MonthAppointmentResizeThumb x:Name = “ ResizeRight” Margin = “ 0,0,-2,0” HorizontalAlignment = “ Right” Visibility = “ Collapsed” /> </ Grid > <VisualStateManager.VisualStateGroups > < VisualStateGroup x:Name = “ SelectedStates” > <VisualState x:Name = “未選擇” /> <VisualState x:Name = “ Selected” > <故事板> <DoubleAnimation Storyboard.TargetName =“ SelectedBorder” Storyboard.TargetProperty = “不透明度” To = “ 1” 持續(xù)時間 = “ 0:0:0” /> <ObjectAnimationUsingKeyFrames Storyboard.TargetName = “ MoveResizeGroup” Storyboard.TargetProperty = “可見性” > <DiscreteObjectKeyFrame KeyTime = “ 0” 值 = “可見” /> </ ObjectAnimationUsingKeyFrames > </ Storyboard > </ VisualState > </ VisualStateGroup > <VisualStateGroup x:Name =“ RecurrenceStates” > <VisualState x:Name = “ NonRecurring” /> <VisualState x:Name = “ RecurrenceRoot” /> <VisualState x:Name = “ RecurringInstance” > <Storyboard > <ObjectAnimationUsingKeyFrames Storyboard.TargetName = “ ResizeLeft” 故事板。 TargetProperty = “可見性” > <DiscreteObjectKeyFrame KeyTime = “ 0” 值 = “已崩潰” /> </ ObjectAnimationUsingKeyFrames > <ObjectAnimationUsingKeyFrames Storyboard.TargetName = “ResizeRight” Storyboard.TargetProperty = “可見性” > <DiscreteObjectKeyFrame KeyTime = “0” 值 = “折疊” /> </ ObjectAnimationUsingKeyFrames > <ObjectAnimationUsingKeyFrames Storyboard.TargetName = “MoveThumb” Storyboard.TargetProperty = “可見性” > <DiscreteObjectKeyFrame KeyTime = “ 0” 值 = “已崩潰” /> </ ObjectAnimationUsingKeyFrames > </ Storyboard > </ VisualState > </ VisualStateGroup > <VisualStateGroup x:Name = “ BoundaryStates” > <VisualState x:Name = “ Closed” > <Storyboard > <ObjectAnimationUsingKeyFrames Storyboard.TargetName = “ ResizeLeft” Storyboard.TargetProperty = “ Visibility” > <DiscreteObjectKeyFrame > KeyTime = “ 0” 值 = “ Visible” /> </ ObjectAnimationUsingKeyFrames > <ObjectAnimationUsingKeyFrames Storyboard.TargetName = “ ResizeRight” Storyboard.TargetProperty = “可見性” > <DiscreteObjectKeyFrame KeyTime = “ 0” 值 = “ Visible” /> </ ObjectAnimationUsingKeyFrames > </ Storyboard > </ VisualState > <VisualState x:Name = “ OpenRight” > <Storyboard > <ObjectAnimationUsingKeyFrames 故事板.TargetName = “ NormalBorder” 故事板。TargetProperty = “ BorderThickness” > <DiscreteObjectKeyFrame KeyTime = “ 0” 值 =“ 1,1,0,1” /> </ ObjectAnimationUsingKeyFrames > <ObjectAnimationUsingKeyFrames Storyboard.TargetName = “ SelectedBorder” Storyboard.TargetProperty = “ BorderThickness” > <DiscreteObjectKeyFrame KeyTime = “ 0” 值 = “ 2,2,0,2” /> </ ObjectAnimationUsingKeyFrames > <ObjectAnimationUsingKeyFrames Storyboard.TargetName = “ ResizeLeft” Storyboard.TargetProperty = “ Visibility” > <DiscreteObjectKeyFrame KeyTime = “ 0” 值 =“ Visible” /> </ ObjectAnimationUsingKeyFrames > </ Storyboard > </ VisualState > <VisualState x:Name = “ OpenLeft” > <Storyboard > <ObjectAnimationUsingKeyFrames Storyboard.TargetName = “ NormalBorder” Storyboard.TargetProperty = “ BorderThickness” > <DiscreteObjectKeyFrame KeyTime = “ 0” 值 = “ 0,1,1,1” /> </ ObjectAnimationUsingKeyFrames > <ObjectAnimationUsingKeyFrames Storyboard.TargetName = “ SelectedBorder” Storyboard.TargetProperty = “ BorderThickness” > <DiscreteObjectKeyFrame KeyTime = “ 0” 值 = “ 0,2,2,2” /> </ ObjectAnimationUsingKeyFrames > <ObjectAnimationUsingKeyFrames Storyboard.TargetName = “ ResizeRight” Storyboard.TargetProperty = “ Visibility” > < DiscreteObjectKeyFrame KeyTime = “ 0” 值 = “ Visible” /> </ ObjectAnimationUsingKeyFrames > </ Storyboard > </ VisualState > <VisualState x:名稱= “ OpenBothEnds” > <故事板> <ObjectAnimationUsingKeyFrames Storyboard.TargetName = “ NormalBorder” Storyboard.TargetProperty = “ BorderThickness” > <DiscreteObjectKeyFrame KeyTime = “ 0” 值 = “ 0,1” /> </ ObjectAnimationUsingKeyFrames > <ObjectAnimationUsingKeyFrames 故事。 = “ SelectedBorder” 故事板。TargetProperty = “ BorderThickness” > <DiscreteObjectKeyFrame KeyTime = “ 0” 值 =“ 0,2” /> </ ObjectAnimationUsingKeyFrames > </ Storyboard > </ VisualState > </ VisualStateGroup > </VisualStateManager.VisualStateGroups > </ Grid > </ ControlTemplate >
Day/Week Appointment View控制模板
Week Appointment View的默認(rèn)控件模板:
<ControlTemplate TargetType="sch:WeekAppointmentView"> <Grid> <Grid.Resources> <ctrls:BoolToVisibilityConverter x:Key="boolToVisibilityConverter" /> </Grid.Resources> <Border Background="{Binding Background}" BorderBrush="{Binding BorderBrush}" BorderThickness="1" CornerRadius="{Binding CornerRadius}" /> <ContentPresenter Content="{TemplateBinding DataContext}" ContentTemplate="{TemplateBinding AppointmentTemplate}" /> <Border Name="SelectedBorder" Background="Transparent" BorderThickness="2" Opacity="0" BorderBrush="{Binding SelectionBorderBrush}" CornerRadius="{Binding CornerRadius}" /> <sch:WeekAppointmentMoveThumb x:Name="MoveThumb" Margin="0,4" Cursor="Hand" Visibility="{Binding Path=IsLocked, Converter={StaticResource boolToVisibilityConverter}, ConverterParameter=Inverse}" /> <Grid Name="MoveResizeGroup" Visibility="{Binding Path=IsLocked, Converter={StaticResource boolToVisibilityConverter}, ConverterParameter=Inverse}" > <sch:WeekAppointmentMoveThumb x:Name="ResizeTop" Opacity="0" VerticalAlignment="Top" Margin="0,-2,0,0" Cursor="SizeNS" Style="{StaticResource ResizeThumbStyle}" /> <sch:WeekAppointmentMoveThumb x:Name="ResizeBottom" Opacity="0" VerticalAlignment="Bottom" Margin="0,0,0,-2" Cursor="SizeNS" Style="{StaticResource ResizeThumbStyle}" /> </Grid> <VisualStateManager.VisualStateGroups> <VisualStateGroup x:Name="SelectedStates"> <VisualState x:Name="Unselected" /> <VisualState x:Name="Selected"> <Storyboard> <DoubleAnimation Storyboard.TargetName="ResizeTop" Storyboard.TargetProperty="Opacity" Duration="0" To="1" /> <DoubleAnimation Storyboard.TargetName="ResizeBottom" Storyboard.TargetProperty="Opacity" Duration="0" To="1" /> <DoubleAnimation Storyboard.TargetName="SelectedBorder" Storyboard.TargetProperty="Opacity" Duration="0" To="1" /> </Storyboard> </VisualState> </VisualStateGroup> <VisualStateGroup x:Name="RecurrenceStates"> <VisualState x:Name="NonRecurring" /> <VisualState x:Name="RecurrenceRoot" /> <VisualState x:Name="RecurringInstance"> <Storyboard> <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ResizeTop" Storyboard.TargetProperty="Visibility"> <DiscreteObjectKeyFrame KeyTime="0" Value="Collapsed" /> </ObjectAnimationUsingKeyFrames> <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ResizeBottom" Storyboard.TargetProperty="Visibility"> <DiscreteObjectKeyFrame KeyTime="0" Value="Collapsed" /> </ObjectAnimationUsingKeyFrames> <ObjectAnimationUsingKeyFrames Storyboard.TargetName="MoveThumb" Storyboard.TargetProperty="Visibility"> <DiscreteObjectKeyFrame KeyTime="0" Value="Collapsed" /> </ObjectAnimationUsingKeyFrames> </Storyboard> </VisualState> </VisualStateGroup> </VisualStateManager.VisualStateGroups> </Grid> </ControlTemplate>
Week MultiDay Appointment View的默認(rèn)控件模板:
<ControlTemplate TargetType = “ sch:WeekMultiDayAppointmentView” > <網(wǎng)格> <邊框 名稱 = “ NormalBorder” 背景 = “ {綁定背景}” BorderBrush = “ {Binding BorderBrush}” BorderThickness = “ 1” CornerRadius = “ {Binding CornerRadius}” / > <ContentPresenter Content = “ {TemplateBinding DataContext}” ContentTemplate = “ {TemplateBinding AppointmentTemplate}” /> <邊框 名稱 = “ SelectedBorder” BorderThickness= “ 2” BorderBrush = “ {Binding SelectionBorderBrush}” 不透明度 = “ 0” CornerRadius = “ {Binding CornerRadius}” /> <VisualStateManager.VisualStateGroups > <VisualStateGroup x:Name = “ SelectedStates” > <VisualState x:Name = “未選擇“ /> <VisualState x:Name = ”已選擇“ > <Storyboard > <DoubleAnimation Storyboard.TargetName = ” SelectedBorder“ 故事板。TargetProperty = “不透明度” 至= “ 1” 持續(xù)時間 = “ 0:0:0.01” /> </ Storyboard > </ VisualState > </ VisualStateGroup > <VisualStateGroup x:Name = “ BoundaryStates” > <VisualState x:Name = “ Closed” /> <VisualState x:Name = “ OpenRight” > <Storyboard > <ObjectAnimationUsingKeyFrames Storyboard.TargetName = “ NormalBorder” Storyboard.TargetProperty = “ BorderThickness” > <DiscreteObjectKeyFrame KeyTime =“ 0” 值 = “ 1,1,0,1” /> </ ObjectAnimationUsingKeyFrames > <ObjectAnimationUsingKeyFrames Storyboard.TargetName = “ SelectedBorder” Storyboard.TargetProperty = “ BorderThickness” > <DiscreteObjectKeyFrame KeyTime = “ 0” 值 = “ 2,2 ,0,2“ /> </ ObjectAnimationUsingKeyFrames > </ Storyboard > </ VisualState > <VisualState x:Name = ” OpenLeft“ > <Storyboard > <ObjectAnimationUsingKeyFrames Storyboard.TargetName = “ NormalBorder” Storyboard.TargetProperty = “ BorderThickness” > <DiscreteObjectKeyFrame KeyTime = “ 0” 值 = “ 0,1,1,1” /> </ ObjectAnimationUsingKeyFrames > <ObjectAnimationUsingKeyFrames Storyboard.TargetName = “ SelectedBorder” 故事板。 TargetProperty = “ BorderThickness” > <DiscreteObjectKeyFrame KeyTime = “ 0” 值 = “ 0,2,2,2” /> </ ObjectAnimationUsingKeyFrames > </ Storyboard > </ VisualState > <VisualState x:Name = “ OpenBothEnds” > <Storyboard > <ObjectAnimationUsingKeyFrames Storyboard.TargetName = “ NormalBorder” Storyboard.TargetProperty = “ BorderThickness” > <DiscreteObjectKeyFrame KeyTime = “ 0” 值 = “ 0,1” /> </ ObjectAnimationUsingKeyFrames > <ObjectAnimationUsingKeyFrames Storyboard.TargetName = “ SelectedBorder” Storyboard.TargetProperty = “BorderThickness“ > <DiscreteObjectKeyFrame KeyTime = “ 0” 值 = “ 0,2” /> </ ObjectAnimationUsingKeyFrames > </ Storyboard > </ VisualState > </ VisualStateGroup > </VisualStateManager.VisualStateGroups > </ Grid > </ ControlTemplate >
Timeline Appointment View控件模板
Timeline Appointment View的默認(rèn)控件模板:
<ControlTemplate TargetType = “ sch:TimelineAppointmentView” > <網(wǎng)格> <邊框 名稱 = “ NormalBorder” 背景 = “ {綁定背景}” BorderBrush = “ {Binding BorderBrush}” BorderThickness = “ 1” CornerRadius = “ {Binding CornerRadius}” / > <ContentPresenter Content = “ {TemplateBinding DataContext}” ContentTemplate = “ {TemplateBinding AppointmentTemplate}” VerticalAlignment = “ Center” /> <邊界 名稱 =“ SelectedBorder” 背景 = “ {Binding BackgroundBrush}” BorderThickness = “ 2” BorderBrush = “ {Binding SelectionBorderBrush}” 不透明度 = “ 0” CornerRadius = “ {Binding CornerRadius}” /> <sch:TimelineAppointmentMoveThumb x:Name = “ MoveThumb” 保證金 = “ 4,0” 光標(biāo) = “手” /> <網(wǎng)格 名稱 = “ MoveResizeGroup” 可見性 = “已崩潰” > <sch:TimelineAppointmentMoveThumb x:Name =“ ResizeLeft” HorizontalAlignment = “左” 保證金 = “ -2,0,0,0” 游標(biāo) = “ SizeWE” 樣式 = “ {StaticResource ResizeThumbStyle}” /> <sch:TimelineAppointmentMoveThumb x:Name = “ ResizeRight” HorizontalAlignment = “ Right “ 保證金 = ” 0,0,-2,0“ 游標(biāo) = ” SizeWE“ 樣式 = ” {StaticResource ResizeThumbStyle}“ /> </ Grid > <VisualStateManager.VisualStateGroups > <VisualStateGroup x:Name = “ SelectedStates”> <VisualState x:Name = “未選擇” /> <VisualState x:Name = “已選擇” > <Storyboard > <DoubleAnimation Storyboard.TargetName = “ SelectedBorder” Storyboard.TargetProperty = “ Opacity” To = “ 1” 持續(xù)時間 = “ 0 :0:0“ /> <DoubleAnimation Storyboard.TargetName = ” NormalBorder“ Storyboard.TargetProperty = ”不透明度“ To = ” 0“ 持續(xù)時間 = “ 0:0:0” /> <ObjectAnimationUsingKeyFrames Storyboard.TargetName = “ MoveResizeGroup” Storyboard.TargetProperty = “ Visibility” > <DiscreteObjectKeyFrame KeyTime = “ 0” Value = “ Visible” /> </ ObjectAnimationUsingKeyFrames > </ Storyboard > </ VisualState > </ VisualStateGroup > <VisualStateGroup x :Name = “ RecurrenceStates” > <VisualState x:Name = “ NonRecurring” /> <VisualState x:名稱= “ RecurrenceRoot” /> <VisualState x:Name = “ RecurringInstance” > <Storyboard > <ObjectAnimationUsingKeyFrames Storyboard.TargetName = “ ResizeLeft” Storyboard.TargetProperty = “ Visibility” > <DiscreteObjectKeyFrame KeyTime = “ 0” Value = “ Collapsed” /> </ ObjectAnimationUsingKeyFrames > <ObjectAnimationUs Storyboard.TargetName = “ ResizeRight” Storyboard.TargetProperty = “可見性” > <DiscreteObjectKeyFrame KeyTime = “ 0” 值 = “折疊” /> </ ObjectAnimationUsingKeyFrames > <ObjectAnimationUsingKeyFrames Storyboard.TargetName = “MoveThumb” Storyboard.TargetProperty = “可見性” > <DiscreteObjectKeyFrame KeyTime = “0” 值 = “折疊” /> </ ObjectAnimationUsingKeyFrames > </故事板> </ VisualState > </ VisualStateGroup > <VisualStateGroup x:Name = “ BoundaryStates” > <VisualState x:Name = “已關(guān)閉” /> <VisualState x:Name = “ OpenRight” > <Storyboard > <ObjectAnimationUsingKeyFrames Storyboard.TargetName = “ NormalBorder” Storyboard.TargetProperty = “ BorderThickness” > <DiscreteObjectKeyFrame KeyTime = “ 0” 值 = “ 1,1,0,1” /> </ ObjectAnimationUsingKeyFrames > <ObjectAnimationUsingKeyFrames Storyboard.TargetName = “ SelectedBorder” Storyboard.TargetProperty = “ BorderThickness” > <DiscreteObjectKeyFrame KeyTime= “ 0” 值 = “ 2,2,0,2” /> </ ObjectAnimationUsingKeyFrames > <ObjectAnimationUsingKeyFrames Storyboard.TargetName = “ ResizeRight” Storyboard.TargetProperty = “ Visibility” > <DiscreteObjectKeyFrame KeyTime = “ 0” 值 = “崩潰” /> </ ObjectAnimationUsingKeyFrames > </ Storyboard > </ VisualState > <VisualState x:Name = “ OpenLeft” > <故事板> <ObjectAnimationUsingKeyFrames Storyboard.TargetName = “ NormalBorder” Storyboard.TargetProperty = “ BorderThickness” > <DiscreteObjectKeyFrame KeyTime = “ 0” 值 = “ 0,1,1,1” /> </ ObjectAnimationUsingKeyFrames > <ObjectAnimationUsingKeyFrames Storyboard.TargetName = “ SelectedBorder” 故事板。 TargetProperty = “ BorderThickness” > <DiscreteObjectKeyFrame KeyTime = “ 0” 值 = “ 0,2,2,2” /> </ ObjectAnimationUsingKeyFrames > <ObjectAnimationUsingKeyFrames Storyboard.TargetName = “ ResizeLeft” Storyboard.TargetProperty = “可見性” > <DiscreteObjectKeyFrame KeyTime = “ 0” 值 = “ Collapsed” /> </ ObjectAnimationUsingKeyFrames > </ Storyboard > </ VisualState > <VisualState x:Name = “ OpenBothEnds” > <Storyboard > <ObjectAnimationUsingKeyFrames Storyboard.TargetName = “ NormalBorder” Storyboard.TargetProperty = “ BorderThickness”> <DiscreteObjectKeyFrame KeyTime = “ 0” 值 = “ 0,1” /> </ ObjectAnimationUsingKeyFrames > <ObjectAnimationUsingKeyFrames Storyboard.TargetName = “ SelectedBorder” Storyboard.TargetProperty = “ BorderThickness” > <DiscreteObjectKeyFrame KeyTime = “ 0” 值 = “ 0,2” / > </ ObjectAnimationUsingKeyFrames > <ObjectAnimationUsingKeyFrames Storyboard.TargetName = “ ResizeRight” Storyboard.TargetProperty = “可見性”> <DiscreteObjectKeyFrame KeyTime = “ 0” 值 = “ Collapsed” /> </ ObjectAnimationUsingKeyFrames > <ObjectAnimationUsingKeyFrames Storyboard.TargetName = “ ResizeLeft” Storyboard.TargetProperty = “ Visibility” > <DiscreteObjectKeyFrame KeyTime = “ 0” 值 = “ Collapsed” /> </ ObjectAnimationUsingKey > </ Storyboard > </ VisualState > </ VisualStateGroup > </VisualStateManager.VisualStateGroups > </ Grid > </ ControlTemplate>
想要獲取DotNetBar for Silverlight更多資源或正版授權(quán)的伙伴請聯(lián)系領(lǐng)取
慧都16周年·技術(shù)服務(wù)月,軟件商城優(yōu)惠券不限量免費放送,購物立減服務(wù)升級,享受折上折>>>
本站文章除注明轉(zhuǎn)載外,均為本站原創(chuàng)或翻譯。歡迎任何形式的轉(zhuǎn)載,但請務(wù)必注明出處、不得修改原文相關(guān)鏈接,如果存在內(nèi)容上的異議請郵件反饋至chenjj@fc6vip.cn
文章轉(zhuǎn)載自: