Timer Windows 8 (WinRT)

private DispatcherTimer timer;
private void StartTimer()
{
if (timer == null)
{
timer = new DispatcherTimer();
timer.Interval = new TimeSpan(0, 0, 0, 0,33);
timer.Tick += timer_Tick;
}
timer.Stop();
timer.Start();
}
public void timer_Tick(object sender, object args)
{
//какой-то код
}

GridView Parallax - Смещение фона при скроле GridView в WinRT

Для того чтобы добавить этот функционал нужно добраться до свойства ScrollViewer .HorizontalOffset.
Но у GridView нет доступа к ScrollViewer. Для того чтобы добраться до него нужно добавить в проект :  WinRT XAML Toolkit (http://winrtxamltoolkit.codeplex.com/)
Или взять есть из NuGet: winrtxamltoolkit
Теперь вы сможете получить доступ к ScrollViewer

Дальше на фон вы должны положить изображение (или что угодно):

<Image x:Name="BackImage1"  Source="/Assets/parallax/Parrallax_bg_1.jpg" 
Grid.RowSpan="2" 
Grid.Row="0" 
HorizontalAlignment="Center" 
VerticalAlignment="Bottom" 
Stretch="None">
</Image>

 

И добавить такой код (взял отсюда http://www.silverlightplayground.org/....GridView.aspx):

public MainPage()
{
this.InitializeComponent();
itemGridView.Loaded += itemGridView_Loaded; // наш GridView
}
void itemGridView_Loaded(object sender, RoutedEventArgs e)
{
var scrollViewer = this.itemGridView.GetFirstDescendantOfType<ScrollViewer>();
scrollViewer.ViewChanged += scrollViewer_ViewChanged;
}
void scrollViewer_ViewChanged(object sender, ScrollViewerViewChangedEventArgs e)
{
//функция расчета смещения
var scrollViewer = this.itemGridView.GetFirstDescendantOfType<ScrollViewer>();
var delta = (scrollViewer.HorizontalOffset / scrollViewer.ScrollableWidth) * 
(BackImage1.ActualWidth - scrollViewer.ViewportWidth);
BackImage1.Margin = new Thickness(-delta, 0, 0, 0);
}

 

 

Настройка локализации KendoUI

По умолчанию валидаторы настроены на американский формат. Чтобы локализировать компоненты под вашу локацию нужно добавить ссылку на js файлы с необходимыми ресурсами:

@{
var culture = System.Threading.Thread.CurrentThread.CurrentCulture.ToString();
}
<script src="@Url.Content("~/Scripts/kendo/{KENDOVERSION}/cultures/kendo.culture." + culture + ".min.js")"></script>
<script>
kendo.culture("@culture");
var culture = kendo.culture();
</script>

js и css для KendoUI - порядок подключения

Кстати, нужно использовать минифицированные версии, чтобы были символы типа “$”

<link href="~/Content/Site.css" rel="stylesheet" type="text/css" />
<link href="~/Content/kendo/2012.3.1315/kendo.common.min.css" rel="stylesheet" type="text/css" />
<link href="~/Content/kendo/2012.3.1315/kendo.dataviz.min.css" rel="stylesheet" type="text/css" />
<link href="~/Content/kendo/2012.3.1315/kendo.default.min.css" rel="stylesheet" type="text/css" />
<link href="~/Content/kendo/2012.3.1315/kendo.dataviz.default.min.css" rel="stylesheet" type="text/css" />
<script src="~/Scripts/jquery-1.9.0.min.js"></script>
<script src="~/Scripts/kendo/2012.3.1315/jquery.min.js"></script>
<script src="~/Scripts/jquery.unobtrusive-ajax.min.js"></script>
<script src="~/Scripts/modernizr-2.6.2.js"></script>
<script src="~/Scripts/kendo/2012.3.1315/kendo.all.min.js"></script>
<script src="~/Scripts/kendo/2012.3.1315/kendo.aspnetmvc.min.js"></script>
<script src="~/Scripts/kendo.modernizr.custom.js"></script>

Минификация файлов в MVC

В страинце:

<link href="@System.Web.Optimization.BundleTable.Bundles.ResolveBundleUrl("~/css")" 
rel="stylesheet" type="text/css" />
<script src="@System.Web.Optimization.BundleTable.Bundles.ResolveBundleUrl("~/js")"></script>

В коде:

bundles.Add(new ScriptBundle("~/js").Include(
"~/Scripts/jquery-{version}.js",
"~/Scripts/jquery.unobtrusive*",
"~/Scripts/TR/jquery.jscrollpane.js",
"~/Scripts/TR/jquery.selectBox.js"
));
bundles.Add(new StyleBundle("~/css").Include(
"~/Content/site.css",
"~/Content/fonts/stylesheet.css",
"~/Content/jquery.jscrollpane.css",
"~/Content/jquery.selectBox.css"
));

 

Описание стандартных стилей Windows Phone

Brush Resources

This table lists and describes the various brushes that can be applied.

 

Name

Type

Description

PhoneAccentBrush

SolidColorBrush

Foreground color to single-out items of interest

PhoneForegroundBrush

SolidColorBrush

Default foreground and border color

PhoneBackgroundBrush

SolidColorBrush

Default background for pages and other controls

PhoneContrastBackgroundBrush

SolidColorBrush

Background for contrasting elements

PhoneContrastForegroundBrush

SolidColorBrush

Foreground for contrasting elements

PhoneDisabledBrush

SolidColorBrush

Disabled foreground and color

PhoneSubtleBrush

SolidColorBrush

Subtle foreground and border

TransparentBrush

SolidColorBrush

100% transparent brush used for background and touch targets

PhoneSemitransparentBrush

SolidColorBrush

Partially transparent background brush used to provide contrast against image backgrounds

PhoneChromeBrush

SolidColorBrush

Used to match the application bar color

 

TextBox Brushes

 

Name

Type

Description

PhoneTextBoxBrush

SolidColorBrush

Brush for the TextBox control

PhoneTextCaretBrush

SolidColorBrush

Brush for the caret in the TextBox

PhoneTextBoxForegroundBrush

SolidColorBrush

Brush for the TextBox control foreground

PhoneTextBoxEditBackgroundBrush

SolidColorBrush

Brush for the TextBox control edit background

PhoneTextBoxEditBorderBrush

SolidColorBrush

Brush for the TextBox control edit border

PhoneTextBoxReadOnlyBrush

SolidColorBrush

Brush for the TextBox control read-only state.

PhoneTextBoxSelectionForegroundBrush

SolidColorBrush

Brush for the TextBox control selection foreground

 

RadioButton and CheckBox Brushes

 

Name

Type

Description

PhoneRadioCheckBoxBrush

SolidColorBrush

Brush for the RadioButton and CheckBox

PhoneRadioCheckBoxDisabledBrush

SolidColorBrush

Brush for disabled RadioButton and CheckBox state

PhoneRadioCheckBoxCheckBrush

SolidColorBrush

Brush for the CheckBox check

PhoneRadioCheckBoxCheckDisabledBrush

SolidColorBrush

Brush for the disabled CheckBox check

PhoneRadioCheckBoxPressedBrush

SolidColorBrush

Brush for the RadioButton and CheckBox pressed state

PhoneRadioCheckBoxPressedBorderBrush

SolidColorBrush

Brush for the RadioButton and CheckBox pressed state

Color Resources

 

Name

Type

Description

PhoneBackgroundColor

Color

Default background for pages and other controls

PhoneForegroundColor

Color

Default foreground and border color

PhoneDisabledColor

Color

Disabled foreground and color

PhoneSubtleColor

Color

Subtle foreground and border

PhoneAccentColor

Color

Foreground color to single-out items of interest

PhoneContrastBackgroundColor

Color

Background for contrasting elements

PhoneContrastForegroundColor

Color

Foreground for contrasting elements

PhoneChromeColor

Color

Color of the status bar and application bar

PhoneSemitransparentColor

Color

Partially transparent color used to provide contrast against image backgrounds

 

TextBox Colors

 

Name

Type

Description

PhoneTextBoxColor

Color

Color for the TextBox control

PhoneTextCaretColor

Color

Color for the caret in the TextBox

PhoneTextBoxForegroundColor

Color

Color for the TextBox control foreground

PhoneTextBoxEditBackgroundColor

Color

Color for the TextBox control edit background

PhoneTextBoxEditBorderColor

Color

Color for the TextBox control edit border

PhoneTextBoxReadOnlyColor

Color

Color for the TextBox control read-only state.

PhoneTextBoxSelectionForegroundColor

Color

Color for the TextBox control selection foreground

 

RadioButton and CheckBox Colors

 

Name

Type

Description

PhoneRadioCheckBoxColor

Color

Color for the RadioButton and CheckBox

PhoneRadioCheckBoxDisabledColor

Color

Color for disabled RadioButton and CheckBox state

PhoneRadioCheckBoxCheckColor

Color

Color for the CheckBox check

PhoneRadioCheckBoxCheckDisabledColor

Color

Color for the disabled CheckBox check

PhoneRadioCheckBoxPressedColor

Color

Color for the RadioButton and CheckBox pressed state

PhoneRadioCheckBoxPressedBorderColor

Color

Color for the RadioButton and CheckBox pressed state

Font Names

This table lists and describes the various font names that can be applied. Attribute = FontFamily

 

Name

Type

Value

PhoneFontFamilyNormal

Font Family

Segoe WP

PhoneFontFamilyLight

Font Family

Segoe WP Light

PhoneFontFamilySemiLight

Font Family

Segoe WP Semilight

PhoneFontFamilySemiBold

Font Family

Segoe WP Semibold

Thickness

This table lists and describes the thickness that can be applied to UI elements. Attribute = BorderThickness, Margin, Padding

 

Name

Type

Value

PhoneHorizontalMargin

BorderThickness, Margin, Padding

12, 0

PhoneVerticalMargin

BorderThickness, Margin, Padding

0, 12

PhoneMargin

BorderThickness, Margin, Padding

12

PhoneTouchTargetOverhang

BorderThickness, Margin, Padding

12

PhoneTouchTargetLargeOverhang

BorderThickness, Margin, Padding

12, 20

PhoneTextBoxInnerMargin

BorderThickness, Margin, Padding

1,2

PhonePasswordBoxInnerMargin

BorderThickness, Margin, Padding

3,2

PhoneBorderThickness

BorderThickness, Margin, Padding

3

PhoneStrokeThickness

BorderThickness, Margin, Padding

3

Font Sizes

This table lists and describes the various font sizes that can be applied. Attribute = FontSize

 

Name

Type

Description

PhoneFontSizeSmall

Double

18.667

PhoneFontSizeNormal

Double

20

PhoneFontSizeMedium

Double

22.667

PhoneFontSizeMediumLarge

Double

25.333

PhoneFontSizeLarge

Double

32

PhoneFontSizeExtraLarge

Double

42.667

PhoneFontSizeExtraExtraLarge

Double

72

PhoneFontSizeHuge

Double

186.667

Text Styles

 

Name

Applies to:

Type

Description

PhoneTextBlockBase

TextBlock

Style

FontFamily: PhoneFontFamilyNormal

FontSize: PhoneFontSizeNormal

Foreground: PhoneForegroundBrush

Margin: PhoneHorizontalMargin

PhoneTextNormalStyle

TextBlock

Style

BasedOn: PhoneTextBlockBase

PhoneTextSubtleStyle

TextBlock

Style

BasedOn: PhoneTextBlockBase

Foreground: PhoneSubtleBrush

PhoneTextTitle1Style

TextBlock

Style

BasedOn: PhoneTextBlockBase

FontFamily: PhoneFontFamilySemiLight

FontSize: PhoneFontSizeExtraExtraLarge

PhoneTextTitle2Style

TextBlock

Style

BasedOn: PhoneTextBlockBase

FontFamily:PhoneFontFamilySemiLight

FontSize: PhoneFontSizeLarge

PhoneTextTitle3Style

TextBlock

Style

BasedOn: PhoneTextBlockBase

FontFamily: PhoneFontFamilySemiLight

FontSize: PhoneFontSizeMedium

PhoneTextSmallStyle

TextBlock

Style

BasedOn: PhoneTextBlockBase

FontSize: PhoneFontSizeSmall

Foreground: PhoneSubtleBrush

PhoneTextLargeStyle

TextBlock

Style

BasedOn: PhoneTextBlockBase

FontFamily: PhoneFontFamilySemiLight

FontSize: PhoneFontSizeLarge

PhoneTextExtraLargeStyle

TextBlock

Style

BasedOn: PhoneTextBlockBase

FontFamily: PhoneFontFamilySemiLight

FontSize: PhoneFontSizeExtraLarge

PhoneTextGroupHeaderStyle

TextBlock

Style

BasedOn: PhoneTextBlockBase

FontFamily: PhoneFontFamilySemiLight

FontSize: PhoneFontSizeLarge

Foreground: PhoneSubtleBrush

PhoneTextContrastStyle

TextBlock

Style

BasedOn: PhoneTextBlockBase

FontFamily: PhoneFontFamilySemiBold

Foreground: PhoneContrastForegroundBrush

 

PhoneTextAccentStyle

TextBlock

Style

BasedOn: PhoneTextBlockBase

FontFamily: PhoneFontFamilySemiBold

Foreground: PhoneAccentBrush

 

PhoneTextHugeStyle

TextBlock

Style

BasedOn: PhoneTextBlockBase

FontFamily: PhoneFontFamilyLight

FontSize: PhoneFontSizeHuge

 

Theme Visibility and Opacity

There are also resources available to adjust the visibility and opacity of the dark and light theme backgrounds:

Visibility

 

Name

Type

Description

PhoneDarkThemeVisibility

Visibility

Visible in dark theme and collapsed in the light theme

PhoneLightThemeVisibility

Visibility

Visible in light theme and collapsed in the dark theme

 

Opacity

 

Name

Type

Description

PhoneDarkThemeOpacity

Double

1 in the dark theme, 0 in the light theme

PhoneLightThemeOpacity

Double

0 in the dark theme, 1 in the light theme

 

MSDN http://msdn.microsoft.com/en-us/library/ff769552(VS.92).aspx