Scheduler for WPF
手順1:アプリケーションの作成

この手順では、XAML マークアップおよびコードを使用して、メインスケジューラアプリケーションを作成します。

  1. 新しい WPF アプリケーションを作成します。次に、ソリューションエクスプローラで[参照]を右クリックし、リストから[参照の追加]を選択して、次の参照を追加します。

    • C1.WPF.4.dll

    • C1.WPF.Schedule.4.dll

    • C1.WPF.DateTimeEditors.4.dll

  2. <Window> タグを使用して、プロジェクトに次の XAML 名前空間を追加します。

    • xmlns:c1="clr-namespace:C1.WPF;assembly=C1.WPF"

    • xmlns:c1sched="clr-namespace:C1.WPF.Schedule;assembly=C1.WPF.Schedule"

    • xmlns:c1datetime="clr-namespace:C1.WPF.DateTimeEditors;assembly=C1.WPF.DateTimeEditors"

    <Window> タグは次のようになります。

    XAML
    コードのコピー
    <Window x:Class="CustomGroupingView.MainWindow"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      Title="Custom Grouping View"
      xmlns:c1sched="http://schemas.componentone.com/wpf/Schedule"   xmlns:c1datetime="http://schemas.componentone.com/wpf/DateTimeEditors"
    xmlns:c1="http://schemas.componentone.com/wpf/Basic"
      Width="1024" Height="800">
    
  3. <Grid> タグの上部に <Window.Resources> </Window.Resources> タグセットを追加します。

  4. <Window.Resources> </Window.Resources> タグの間に次のマークアップを追加して、リソースディクショナリを作成します。

    XAML
    コードのコピー
    <ResourceDictionary>
                 <ResourceDictionary x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type c1sched:C1Scheduler},
                              ResourceId=custom_theme}" Source="CustomViews.xaml" />
            </ResourceDictionary>
    
  5. <Window.Resources> </Window.Resources> タグの間に次の XAML を挿入して、スケジュールビューと C1Scheduler コントロールを作成します。

    XAML
    コードのコピー
    <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="192"/>
                <ColumnDefinition />
            </Grid.ColumnDefinitions>
            <ToolBar Grid.Row="0" Grid.ColumnSpan="2">
                <TextBlock HorizontalAlignment="Left" VerticalAlignment="Center" TextWrapping="NoWrap" Margin="4,2" Text="Contacts navigation:" />
                <Button Content="|&lt;&lt;" Margin="2"
                           Command="c1sched:C1Scheduler.NavigateToPreviousGroupCommand"
                              CommandParameter="Home" CommandTarget="{Binding ElementName=c1Scheduler1}"/>
                <Button Content="&lt;&lt;" Margin="2"
                           Command="c1sched:C1Scheduler.NavigateToPreviousGroupCommand"
                              CommandParameter="Page" CommandTarget="{Binding ElementName=c1Scheduler1}"/>
                <Button Content="&lt;" Margin="2"
                           Command="c1sched:C1Scheduler.NavigateToPreviousGroupCommand" CommandTarget="{Binding ElementName=c1Scheduler1}"/>
                <Button Content="&gt;" Margin="2"
                              Command="c1sched:C1Scheduler.NavigateToNextGroupCommand" CommandTarget="{Binding ElementName=c1Scheduler1}"/>
                <Button Content="&gt;&gt;" Margin="2"
                              Command="c1sched:C1Scheduler.NavigateToNextGroupCommand"
                              CommandParameter="Page" CommandTarget="{Binding ElementName=c1Scheduler1}"/>
                <Button Content="&gt;&gt;|" Margin="2"
                              Command="c1sched:C1Scheduler.NavigateToNextGroupCommand"
                              CommandParameter="End" CommandTarget="{Binding ElementName=c1Scheduler1}"/>
                <Separator/>
                <TextBlock HorizontalAlignment="Left" VerticalAlignment="Center" TextWrapping="NoWrap" Margin="4,2" Text="Contacts per page:" />
                <c1:C1NumericBox Margin="2" Value="{Binding GroupPageSize, ElementName=c1Scheduler1, Mode=TwoWay}" Minimum="2" Maximum="5" MinWidth="35"/>
            </ToolBar>
            <c1sched:C1Calendar x:Name="cal1" Grid.Row="1" Grid.Column="0"
                                CalendarHelper="{Binding CalendarHelper, ElementName=c1Scheduler1, Mode=OneWay}"
                                     SelectedDates="{Binding VisibleDates, ElementName=c1Scheduler1, Mode=OneWay}"
                                          BoldedDates="{Binding BoldedDates, ElementName=c1Scheduler1, Mode=OneWay}"
                                MaxSelectionCount="42" />
            <c1sched:C1Scheduler x:Name="c1Scheduler1" Grid.Row="1" Grid.Column="1">
                 Theme="{DynamicResource {ComponentResourceKey TypeInTargetAssembly=c1sched:C1Scheduler, ResourceId=custom_theme}}">
                <c1sched:C1Scheduler.Settings>
                    <c1sched:C1SchedulerSettings FirstVisibleTime="7:00:00" />
                </c1sched:C1Scheduler.Settings>
            </c1sched:C1Scheduler>
        </Grid>
    

この手順では、リソースディクショナリを呼び出すマークアップを作成し、カスタムスケジューラビューを作成しました。次の手順では、連絡先を追加し、指定された日の VisualIntervalCollection を返すコードをプロジェクトに追加します。