2

このサイトで非常に多くの良い回答を読んだので、何かを尋ねる必要はありませんでした. 今、私は答えを見つけることができない問題を抱えています。私は7.1用のWindowsアプリをプログラミングしていて、Calendar Controlを使用しようとしています.CalendarまたはDatePickerの場合はあまり気にしません。

しかし、そこで値を変更するたびに、次のエラーが発生します。

「このタイプのコレクションは、Dispatcher スレッドとは異なるスレッドからの SourceCollection への変更をサポートしていません。」

私は非常に初心者なので、スレッドで特別なことは何もしていませんし、Web でこのエラーについて何も見つけられなかったので、これは私の環境での固有のエラーに違いないと思います。

このエラーがどこから来るのか、誰にも分かりますか?

ご回答ありがとうございます

ミュラー・マティアス

4

1 に答える 1

0

SDK 名前空間の DatePicker を使用する必要があります。

http://samples.msdn.microsoft.com/silverlight/samplebrowser/#/?sref=System.Windows.Controls.Calendar

Telerik の Silverlight コントロールを提案することもできます http://demos.telerik.com/silverlight/

<UserControl  xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk" x:Class="CalendarExample.Page"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
FontFamily="Trebuchet MS" FontSize="11"
Width="600" Height="750">

<StackPanel x:Name="LayoutRoot" Background="White">
    <StackPanel Orientation="Horizontal" Margin="5" >
    <!-- A basic Calendar. -->
    <TextBlock  Width="100" 
               Text="Calendar with date ranges defined:" TextWrapping="Wrap" Margin="5" />
    <sdk:Calendar x:Name="cal" />

    <!-- A Calendar does not highlight today's date. -->
        <TextBlock  Width="100" 
               Text="Calendar that does not highlight today's date:" TextWrapping="Wrap" Margin="5"/>
        <sdk:Calendar x:Name="cal2" Canvas.Left="270" Canvas.Top="100" 
                    IsTodayHighlighted="false" />
    </StackPanel>
    <!-- Two DatePicker controls, one using the default Short date format -->
    <!-- and the other using the Long date format. -->
    <StackPanel Orientation="Horizontal" >
    <TextBlock Width="200" Margin="5" 
               Text="DatePicker with Short date format and Calendar event handlers:" TextWrapping="Wrap" />
    <sdk:DatePicker x:Name="dp1" Height="20" Width="200" />
    </StackPanel>
    <StackPanel Orientation="Horizontal" >
    <TextBlock Width="200" Margin="5"
               Text="DatePicker with Long date format and DateSelected event handler:" TextWrapping="Wrap" />
    <sdk:DatePicker Height="20" x:Name="dp2" SelectedDateFormat="Long" Width="200"/>
    </StackPanel>
    <!-- Output TextBlock -->
    <TextBlock x:Name="text1" HorizontalAlignment="Left" Height="40" Width="350" Margin="5" />

    <!-- A Calendar to demonstrate multiple selection. -->
    <StackPanel Orientation="Horizontal" >
    <TextBlock  Width="200" Margin="5"
               Text="Calendar with multiple selections and blackout dates:" TextWrapping="Wrap" />
    <sdk:Calendar x:Name="cal3" />
    </StackPanel>
 </StackPanel>

于 2013-02-21T08:32:51.313 に答える