WPF:多用户调度程序

时间:2013-07-21 00:28:47

标签: c# wpf scheduler

我意识到Outlook就像调度程序一样。我以http://www.codeproject.com/Articles/30881/Creating-an-Outlook-Calendar-Using-WPF-Part-2作为基础,但我的日历应该有一些用户数量的显示数据列。当然,我可以通过XAML添加一些用户列,但这是静态解决方案,我不知道我的程序会显示多少用户。

如何改进此程序以添加用户的动态计数,或者可能还有其他一些开源WPF控件?

XAML的日历样式代码,在下一个中创建3个静态列:

 <Style TargetType="{x:Type local:Calendar}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type local:Calendar}">
                    <Border Background="#E3EFFF"
                            BorderBrush="#6593CF"
                            BorderThickness="2,2,2,2">
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="50" />
                                <ColumnDefinition Width="*" />
                            </Grid.ColumnDefinitions>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="38" />
                                <RowDefinition Height="22" />
                                <RowDefinition Height="*" />
                            </Grid.RowDefinitions>

                            <StackPanel Orientation="Horizontal" Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" Margin="5,0,0,0">
                                <Button Content="ToPreviousDay" Height="25" Command="{x:Static local:Calendar.PreviousDay}" Background="{x:Null}" BorderBrush="{x:Null}">

                                </Button>
                                <Button Content="ToNextDay" Height="25" Command="{x:Static local:Calendar.NextDay}" Background="{x:Null}" BorderBrush="{x:Null}">

                                </Button>
                            </StackPanel>
                            <Border BorderBrush="#6593CF" BorderThickness="0,0,1,1" Grid.Column="0" Grid.Row="1" />
                            <local:CalendarDayHeader Grid.Column="1" Grid.Row="1" x:Name="PART_DayHeader"/>
                            <ScrollViewer Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2" ScrollViewer.HorizontalScrollBarVisibility="Auto" 
                                          ScrollViewer.VerticalScrollBarVisibility="Visible" x:Name="PART_ScrollViewer">
                                <Grid>
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="50" />
                                        <ColumnDefinition Width="*" />
                                    </Grid.ColumnDefinitions>




                                    <local:CalendarLedger Grid.Column="0" x:Name="PART_Ledger" Margin="0,25,0,0"/>

                                    <StackPanel Orientation="Horizontal" Grid.Column="1">
                                        <Grid>
                                            <Grid.RowDefinitions>
                                                <RowDefinition Height="Auto"/>
                                                <RowDefinition Height="*"/>
                                            </Grid.RowDefinitions>

                                            <Label Grid.Row="0" Content="User1_Column" x:Name="PART_Label"/>
                                                <local:CalendarDay Grid.Row="1" x:Name="PART_Day" />
                                        </Grid>
                                        <Grid>
                                            <Grid.RowDefinitions>
                                                <RowDefinition Height="Auto"/>
                                                <RowDefinition Height="*"/>
                                            </Grid.RowDefinitions>

                                            <Label Grid.Row="0" Content="User2_Column" x:Name="PART_Label2"/>
                                            <local:CalendarDay Grid.Row="1" x:Name="PART_Day2" />
                                        </Grid>
                                        <Grid Width>
                                            <Grid.RowDefinitions>
                                                <RowDefinition Height="Auto"/>
                                                <RowDefinition Height="*"/>
                                            </Grid.RowDefinitions>

                                            <Label Grid.Row="0" Content="User3_Column" x:Name="PART_Label3"/>
                                            <local:CalendarDay Grid.Row="1" x:Name="PART_Day3" />
                                        </Grid>
                                    </StackPanel>
                                </Grid>
                            </ScrollViewer>
                        </Grid>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

我想动态添加用户的列

0 个答案:

没有答案