如何编辑日历约会?

时间:2014-09-25 11:09:04

标签: c# calendar windows-phone appointment

我正在开发Windows Phone应用。 我有一个ListBox,其中填充了appointments (native calendar)

使用API​​找不到编辑这些约会的方法。我怎么编辑它们?

我的XAML:

<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
 <toolkit:DatePicker x:Name="DateBox" Margin="0,37,0,428" ValueChanged="DateBox_ValueChanged" />
  <TextBlock Height="30" HorizontalAlignment="Left" Margin="12,6,0,0" Name="textBlock1" VerticalAlignment="Top" Width="189" >
  <Run Text="Selecione a data:"/>
   </TextBlock>
    <ListBox x:Name="DateList" Margin="0,143,0,0">
     <ListBox.ItemTemplate>
      <DataTemplate>
       <Grid>
        <Grid.ColumnDefinitions>
         <ColumnDefinition Width="600" />
          </Grid.ColumnDefinitions>
           <StackPanel Grid.ColumnSpan="3" Margin="0,0,-62,17">
            <StackPanel.Background>
              <SolidColorBrush Color="#FF858585" Opacity="0.5"/>
               </StackPanel.Background>
                <TextBlock Text="{Binding StartTime, StringFormat=dd/MM/yyy - HH:mm - }" FontSize="16" />
                 <TextBlock Text="{Binding Subject}" TextWrapping="NoWrap" FontWeight="Bold" FontSize="24" />
                 <TextBlock Text="{Binding Location}" TextWrapping="NoWrap" Margin="0,0,0,15" FontSize="20" Foreground="#FFCDCDCD"/>
                </StackPanel>
                <TextBlock Grid.Column="0" Text="{Binding EndTime, StringFormat=HH:mm}" Margin="148,0,158,17" FontSize="16"/>
               </Grid>
             </DataTemplate>
          </ListBox.ItemTemplate>
          <ListBox.ItemContainerStyle>
                <Style TargetType="ListBoxItem">
                    <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
                </Style>
       </ListBox.ItemContainerStyle>

     </ListBox>

我的代码:

 public partial class calendar : PhoneApplicationPage
{

    Appointments appointments = new Appointments();
    public static Microsoft.Phone.UserData.Appointment compromisso;
    public static Microsoft.Phone.UserData.Appointment appt;
    public calendar()
    {
        InitializeComponent();

        appointments.SearchCompleted += new EventHandler<AppointmentsSearchEventArgs>(appointments_SearchCompleted);
        SearchCalendar(); 


    }

    private void SearchCalendar()
    {
        appointments.SearchAsync(DateBox.Value.Value, DateBox.Value.Value.AddDays(1), null);

    }

    private void DateBox_ValueChanged(object sender, DateTimeValueChangedEventArgs e)
    {
        SearchCalendar();
    }

    void appointments_SearchCompleted(object sender, AppointmentsSearchEventArgs e)
    {
        if (e.Results.Count() == 0)
        {
            MessageText.Text = "Nenhum compromisso na data escolhida!";
        }
        else
        {
            MessageText.Text = e.Results.Count() + " compromissos encontrados";
            DateList.ItemsSource = e.Results;
        }
    }

0 个答案:

没有答案