674 / 420 / 44
Регистрация: 09.07.2012
Сообщений: 1,419
|
08.05.2014, 20:04
|
2
|
Сообщение было отмечено Khan как решение
Решение
В microsoft пишут "here is no existing Calendar control in Windows Store app".
Пишите сами...
Тут готовые:
http://www.perpetuumsoft.com/W... trols.aspx
XAML WinRT Calendar
https://xamlwinrtcalendar.codeplex.com/
Есть и кодом ( http://social.msdn.microsoft.com/):
C# | 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
| XMAL:
<Grid x:Name="dateGrid" Grid.Column="1" Margin="35,24,0,0" Grid.Row="3">
<Grid.RowDefinitions>
<RowDefinition Height="3*"/>
<RowDefinition Height="3*"/>
<RowDefinition Height="3*"/>
<RowDefinition Height="3*"/>
<RowDefinition Height="3*"/>
<RowDefinition Height="3*"/>
<RowDefinition Height="3*"/>
<RowDefinition Height="3*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="3*"/>
<ColumnDefinition Width="3*"/>
<ColumnDefinition Width="3*"/>
<ColumnDefinition Width="3*"/>
<ColumnDefinition Width="3*"/>
<ColumnDefinition Width="3*"/>
<ColumnDefinition Width="3*"/>
</Grid.ColumnDefinitions>
<TextBlock x:Name="fullDateTextBlock" Grid.Column="0" Grid.Row="0" Grid.ColumnSpan="7" TextWrapping="Wrap" Text="" FontFamily="Segoe UI Semibold" FontSize="24" TextAlignment="Center" FontWeight="Bold" Margin="0,0,0,5"/>
<TextBlock Grid.Column="0" Grid.Row="1" TextWrapping="Wrap" Text="Su" FontFamily="Segoe UI Semibold" FontSize="24" TextAlignment="Center" FontWeight="Bold"/>
<TextBlock Grid.Column="1" Grid.Row="1" Margin="0" TextWrapping="Wrap" Text="Mo" FontFamily="Segoe UI Semibold" FontSize="24" TextAlignment="Center" FontWeight="Bold"/>
<TextBlock Grid.Column="2" Grid.Row="1" Margin="0" TextWrapping="Wrap" Text="Tu" FontFamily="Segoe UI Semibold" FontSize="24" TextAlignment="Center" FontWeight="Bold"/>
<TextBlock Grid.Column="3" Grid.Row="1" Margin="0" TextWrapping="Wrap" Text="We" FontFamily="Segoe UI Semibold" FontSize="24" TextAlignment="Center" FontWeight="Bold"/>
<TextBlock Grid.Column="4" Grid.Row="1" Margin="0" TextWrapping="Wrap" Text="Th" FontFamily="Segoe UI Semibold" FontSize="24" TextAlignment="Center" FontWeight="Bold"/>
<TextBlock Grid.Column="5" Grid.Row="1" Margin="0" TextWrapping="Wrap" Text="Fr" FontFamily="Segoe UI Semibold" FontSize="24" TextAlignment="Center" FontWeight="Bold"/>
<TextBlock Grid.Column="6" Grid.Row="1" Margin="0" TextWrapping="Wrap" Text="Sa" FontFamily="Segoe UI Semibold" FontSize="24" TextAlignment="Center" FontWeight="Bold"/>
<TextBlock x:Name="calendarTextBox0" Grid.Column="0" Grid.Row="2" Margin="0" TextWrapping="Wrap" Text="1" FontFamily="Segoe UI Semibold" FontSize="24" TextAlignment="Center" FontWeight="Bold"/>
<TextBlock x:Name="calendarTextBox1" Grid.Column="1" Grid.Row="2" Margin="0" TextWrapping="Wrap" Text="1" FontFamily="Segoe UI Semibold" FontSize="24" TextAlignment="Center" FontWeight="Bold"/>
<TextBlock x:Name="calendarTextBox2" Grid.Column="2" Grid.Row="2" Margin="0" TextWrapping="Wrap" Text="1" FontFamily="Segoe UI Semibold" FontSize="24" TextAlignment="Center" FontWeight="Bold"/>
<TextBlock x:Name="calendarTextBox3" Grid.Column="3" Grid.Row="2" Margin="0" TextWrapping="Wrap" Text="1" FontFamily="Segoe UI Semibold" FontSize="24" TextAlignment="Center" FontWeight="Bold"/>
<TextBlock x:Name="calendarTextBox4" Grid.Column="4" Grid.Row="2" Margin="0" TextWrapping="Wrap" Text="1" FontFamily="Segoe UI Semibold" FontSize="24" TextAlignment="Center" FontWeight="Bold"/>
<TextBlock x:Name="calendarTextBox5" Grid.Column="5" Grid.Row="2" Margin="0" TextWrapping="Wrap" Text="1" FontFamily="Segoe UI Semibold" FontSize="24" TextAlignment="Center" FontWeight="Bold"/>
<TextBlock x:Name="calendarTextBox6" Grid.Column="6" Grid.Row="2" Margin="0" TextWrapping="Wrap" Text="1" FontFamily="Segoe UI Semibold" FontSize="24" TextAlignment="Center" FontWeight="Bold"/>
<TextBlock x:Name="calendarTextBox7" Grid.Column="0" Grid.Row="3" Margin="0" TextWrapping="Wrap" Text="1" FontFamily="Segoe UI Semibold" FontSize="24" TextAlignment="Center" FontWeight="Bold"/>
<TextBlock x:Name="calendarTextBox8" Grid.Column="1" Grid.Row="3" Margin="0" TextWrapping="Wrap" Text="1" FontFamily="Segoe UI Semibold" FontSize="24" TextAlignment="Center" FontWeight="Bold"/>
<TextBlock x:Name="calendarTextBox9" Grid.Column="2" Grid.Row="3" Margin="0" TextWrapping="Wrap" Text="1" FontFamily="Segoe UI Semibold" FontSize="24" TextAlignment="Center" FontWeight="Bold"/>
<TextBlock x:Name="calendarTextBox10" Grid.Column="3" Grid.Row="3" Margin="0" TextWrapping="Wrap" Text="1" FontFamily="Segoe UI Semibold" FontSize="24" TextAlignment="Center" FontWeight="Bold"/>
<TextBlock x:Name="calendarTextBox11" Grid.Column="4" Grid.Row="3" Margin="0" TextWrapping="Wrap" Text="1" FontFamily="Segoe UI Semibold" FontSize="24" TextAlignment="Center" FontWeight="Bold"/>
<TextBlock x:Name="calendarTextBox12" Grid.Column="5" Grid.Row="3" Margin="0" TextWrapping="Wrap" Text="1" FontFamily="Segoe UI Semibold" FontSize="24" TextAlignment="Center" FontWeight="Bold"/>
<TextBlock x:Name="calendarTextBox13" Grid.Column="6" Grid.Row="3" Margin="0" TextWrapping="Wrap" Text="1" FontFamily="Segoe UI Semibold" FontSize="24" TextAlignment="Center" FontWeight="Bold"/>
<TextBlock x:Name="calendarTextBox14" Grid.Column="0" Grid.Row="4" Margin="0" TextWrapping="Wrap" Text="1" FontFamily="Segoe UI Semibold" FontSize="24" TextAlignment="Center" FontWeight="Bold"/>
<TextBlock x:Name="calendarTextBox15" Grid.Column="1" Grid.Row="4" Margin="0" TextWrapping="Wrap" Text="1" FontFamily="Segoe UI Semibold" FontSize="24" TextAlignment="Center" FontWeight="Bold"/>
<TextBlock x:Name="calendarTextBox16" Grid.Column="2" Grid.Row="4" Margin="0" TextWrapping="Wrap" Text="1" FontFamily="Segoe UI Semibold" FontSize="24" TextAlignment="Center" FontWeight="Bold"/>
<TextBlock x:Name="calendarTextBox17" Grid.Column="3" Grid.Row="4" Margin="0" TextWrapping="Wrap" Text="1" FontFamily="Segoe UI Semibold" FontSize="24" TextAlignment="Center" FontWeight="Bold"/>
<TextBlock x:Name="calendarTextBox18" Grid.Column="4" Grid.Row="4" Margin="0" TextWrapping="Wrap" Text="1" FontFamily="Segoe UI Semibold" FontSize="24" TextAlignment="Center" FontWeight="Bold"/>
<TextBlock x:Name="calendarTextBox19" Grid.Column="5" Grid.Row="4" Margin="0" TextWrapping="Wrap" Text="1" FontFamily="Segoe UI Semibold" FontSize="24" TextAlignment="Center" FontWeight="Bold"/>
<TextBlock x:Name="calendarTextBox20" Grid.Column="6" Grid.Row="4" Margin="0" TextWrapping="Wrap" Text="1" FontFamily="Segoe UI Semibold" FontSize="24" TextAlignment="Center" FontWeight="Bold"/>
<TextBlock x:Name="calendarTextBox21" Grid.Column="0" Grid.Row="5" Margin="0" TextWrapping="Wrap" Text="1" FontFamily="Segoe UI Semibold" FontSize="24" TextAlignment="Center" FontWeight="Bold"/>
<TextBlock x:Name="calendarTextBox22" Grid.Column="1" Grid.Row="5" Margin="0" TextWrapping="Wrap" Text="1" FontFamily="Segoe UI Semibold" FontSize="24" TextAlignment="Center" FontWeight="Bold"/>
<TextBlock x:Name="calendarTextBox23" Grid.Column="2" Grid.Row="5" Margin="0" TextWrapping="Wrap" Text="1" FontFamily="Segoe UI Semibold" FontSize="24" TextAlignment="Center" FontWeight="Bold"/>
<TextBlock x:Name="calendarTextBox24" Grid.Column="3" Grid.Row="5" Margin="0" TextWrapping="Wrap" Text="1" FontFamily="Segoe UI Semibold" FontSize="24" TextAlignment="Center" FontWeight="Bold"/>
<TextBlock x:Name="calendarTextBox25" Grid.Column="4" Grid.Row="5" Margin="0" TextWrapping="Wrap" Text="1" FontFamily="Segoe UI Semibold" FontSize="24" TextAlignment="Center" FontWeight="Bold"/>
<TextBlock x:Name="calendarTextBox26" Grid.Column="5" Grid.Row="5" Margin="0" TextWrapping="Wrap" Text="1" FontFamily="Segoe UI Semibold" FontSize="24" TextAlignment="Center" FontWeight="Bold"/>
<TextBlock x:Name="calendarTextBox27" Grid.Column="6" Grid.Row="5" Margin="0" TextWrapping="Wrap" Text="1" FontFamily="Segoe UI Semibold" FontSize="24" TextAlignment="Center" FontWeight="Bold"/>
<TextBlock x:Name="calendarTextBox28" Grid.Column="0" Grid.Row="6" Margin="0" TextWrapping="Wrap" Text="1" FontFamily="Segoe UI Semibold" FontSize="24" TextAlignment="Center" FontWeight="Bold"/>
<TextBlock x:Name="calendarTextBox29" Grid.Column="1" Grid.Row="6" Margin="0" TextWrapping="Wrap" Text="1" FontFamily="Segoe UI Semibold" FontSize="24" TextAlignment="Center" FontWeight="Bold"/>
<TextBlock x:Name="calendarTextBox30" Grid.Column="2" Grid.Row="6" Margin="0" TextWrapping="Wrap" Text="1" FontFamily="Segoe UI Semibold" FontSize="24" TextAlignment="Center" FontWeight="Bold"/>
<TextBlock x:Name="calendarTextBox31" Grid.Column="3" Grid.Row="6" Margin="0" TextWrapping="Wrap" Text="1" FontFamily="Segoe UI Semibold" FontSize="24" TextAlignment="Center" FontWeight="Bold"/>
<TextBlock x:Name="calendarTextBox32" Grid.Column="4" Grid.Row="6" Margin="0" TextWrapping="Wrap" Text="1" FontFamily="Segoe UI Semibold" FontSize="24" TextAlignment="Center" FontWeight="Bold"/>
<TextBlock x:Name="calendarTextBox33" Grid.Column="5" Grid.Row="6" Margin="0" TextWrapping="Wrap" Text="1" FontFamily="Segoe UI Semibold" FontSize="24" TextAlignment="Center" FontWeight="Bold"/>
<TextBlock x:Name="calendarTextBox34" Grid.Column="6" Grid.Row="6" Margin="0" TextWrapping="Wrap" Text="1" FontFamily="Segoe UI Semibold" FontSize="24" TextAlignment="Center" FontWeight="Bold"/>
<TextBlock x:Name="calendarTextBox35" Grid.Column="0" Grid.Row="7" Margin="0" TextWrapping="Wrap" Text="1" FontFamily="Segoe UI Semibold" FontSize="24" TextAlignment="Center" FontWeight="Bold"/>
<TextBlock x:Name="calendarTextBox36" Grid.Column="1" Grid.Row="7" Margin="0" TextWrapping="Wrap" Text="1" FontFamily="Segoe UI Semibold" FontSize="24" TextAlignment="Center" FontWeight="Bold"/>
<TextBlock x:Name="calendarTextBox37" Grid.Column="2" Grid.Row="7" Margin="0" TextWrapping="Wrap" Text="1" FontFamily="Segoe UI Semibold" FontSize="24" TextAlignment="Center" FontWeight="Bold"/>
<TextBlock x:Name="calendarTextBox38" Grid.Column="3" Grid.Row="7" Margin="0" TextWrapping="Wrap" Text="1" FontFamily="Segoe UI Semibold" FontSize="24" TextAlignment="Center" FontWeight="Bold"/>
<TextBlock x:Name="calendarTextBox39" Grid.Column="4" Grid.Row="7" Margin="0" TextWrapping="Wrap" Text="1" FontFamily="Segoe UI Semibold" FontSize="24" TextAlignment="Center" FontWeight="Bold"/>
<TextBlock x:Name="calendarTextBox40" Grid.Column="5" Grid.Row="7" Margin="0" TextWrapping="Wrap" Text="1" FontFamily="Segoe UI Semibold" FontSize="24" TextAlignment="Center" FontWeight="Bold"/>
<TextBlock x:Name="calendarTextBox41" Grid.Column="6" Grid.Row="7" Margin="0" TextWrapping="Wrap" Text="1" FontFamily="Segoe UI Semibold" FontSize="24" TextAlignment="Center" FontWeight="Bold"/>
</Grid>
C# Code to build the calendar:
private void BuildCalander()
{
DateTime dateValue = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1);
int dayOfWeek = (int)dateValue.DayOfWeek; // Displays 3
int dayCounter = 1;
int restCounter = 1;
// fill out the current month first
for (int i = dayOfWeek; i <= System.DateTime.DaysInMonth(DateTime.Now.Year, DateTime.Now.Month); i++)
{
var tb = this.FindName("calendarTextBox" + i.ToString());
((TextBlock)tb).Text = dayCounter.ToString();
if (dayCounter == DateTime.Now.Day)
{
((TextBlock)tb).Foreground = new SolidColorBrush(Colors.Red);
}
else
{
((TextBlock)tb).Foreground = new SolidColorBrush(Colors.White);
}
dayCounter++;
}
// now fill in the rest of the next month
for (int i = dayOfWeek + (dayCounter - 1); i < 42; i++)
{
var tb = this.FindName("calendarTextBox" + i.ToString());
((TextBlock)tb).Text = restCounter.ToString();
((TextBlock)tb).Foreground = new SolidColorBrush(Colors.DarkGray);
restCounter++;
}
int preMonth = DateTime.Now.Month;
preMonth = preMonth == 1 ? preMonth = 12 : preMonth--;
dateValue = new DateTime(DateTime.Now.Year, preMonth, 1);
preMonth = DateTime.DaysInMonth(dateValue.Year, dateValue.Month);
// now fill in the rest of the previous month
for (int i = 0; i < dayOfWeek; i++)
{
var tb = this.FindName("calendarTextBox" + i.ToString());
((TextBlock)tb).Text = preMonth.ToString();
((TextBlock)tb).Foreground = new SolidColorBrush(Colors.DarkGray);
preMonth++;
}
} |
|
0
|