View MyCheckBox.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MyCheckBox : CheckBox | |
{ | |
public new object IsChecked | |
{ | |
get { return GetValue(IsCheckedProperty); } | |
set { SetValue(IsCheckedProperty, value); } | |
} | |
public static new readonly DependencyProperty IsCheckedProperty = | |
DependencyProperty.Register("IsChecked", typeof(object), typeof(MyCheckBox), | |
new PropertyMetadata(null, new PropertyChangedCallback(OnIsCheckedChanged))); |
View MainPage.xaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- ページ・リソースにバリュー・コンバータとデータ・テンプレートを追加 --> | |
<Page.Resources> | |
<!-- TODO: Delete this line if the key AppName is declared in App.xaml --> | |
<x:String x:Key="AppName">My Application</x:String> | |
<local:ObjectTypeToTextAlignmentConverter x:Key="ObjectTypeToTextAlignmentConverter" /> | |
<DataTemplate x:Key="MyListboxItemTemplate"> | |
<Grid HorizontalAlignment="Stretch" Width="150" Margin="0,0,20,0"> |
View gist:4634046
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Microsoft.Xna.Framework.Media; | |
using System; | |
namespace PhoneApp1 | |
{ | |
public class PhotoAlbums | |
{ | |
public static Picture GetFirstPhoto() { | |
MediaLibrary mediaLib = new MediaLibrary(); | |
foreach (var album in mediaLib.RootPictureAlbum.Albums) |
View calendar.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var firstDate = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1); | |
int dayOfWeek= (int)firstDate.DayOfWeek; //日曜=0 … 土曜=6 | |
int lastDay = firstDate.AddMonths(1).AddDays(-1).Day; | |
for (int day = 1; day <= lastDay; day++) | |
{ | |
int index = (day - 1) + dayOfWeek; // 左上のマスを0番として、左から右へ数えていった番号 | |
int x = index % 7; // column(横方向)位置 | |
int y = index / 7; // row(縦方向)位置 | |
var color = Windows.UI.Colors.White; |
View calendar.xaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Grid x:Name="CalendarGrid" Grid.Row="1" Margin="120,20,40,20" > | |
<Grid.ColumnDefinitions> | |
<ColumnDefinition Width="1*" /> | |
<ColumnDefinition Width="1*" /> | |
<ColumnDefinition Width="1*" /> | |
<ColumnDefinition Width="1*" /> | |
<ColumnDefinition Width="1*" /> | |
<ColumnDefinition Width="1*" /> | |
<ColumnDefinition Width="1*" /> | |
</Grid.ColumnDefinitions> |
View MainPage.xaml.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private async void ReadFile() | |
{ | |
// バイト配列に読み込んでから、MultiByteToWideChar()を通す | |
const string FileUrl = "ms-appx:///TextFile1.txt"; | |
var storage = await StorageFile.GetFileFromApplicationUriAsync(new Uri(FileUrl)); | |
using (var stream = await storage.OpenReadAsync()) | |
{ | |
byte[] buff = new byte[stream.Size]; | |
await stream.AsStreamForRead().ReadAsync(buff, 0, buff.Length); |
View WindowsPhoneRuntimeComponent1.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "pch.h" | |
#include "WindowsPhoneRuntimeComponent1.h" | |
#define CP_SJIS 932 | |
using namespace WindowsPhoneRuntimeComponent1; | |
using namespace Platform; | |
Platform::String^ WindowsPhoneRuntimeComponent::MultiByteToWideCharWP8(const Platform::Array<byte>^ buff) | |
{ |
View TextDecoder.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class TextDecoder | |
{ | |
[DllImport("Kernel32.dll", CharSet = CharSet.Unicode)] | |
static extern int MultiByteToWideChar( | |
uint CodePage, | |
uint dwFlags, | |
[MarshalAs(UnmanagedType.LPArray)] byte[] lpMultiByteStr, | |
int cbMultiByte, | |
[Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder lpWideCharStr, | |
int cchWideChar); |
View CustomGridView.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Windows.UI.Xaml; | |
using Windows.UI.Xaml.Controls; | |
namespace BluewaterSoft.DevTools.Win8Common.Control | |
{ | |
public class CustomGridView : GridView | |
{ | |
private ScrollViewer _sv; | |
private ItemsPresenter _ip; |
View MainPage.xaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- GridView を ScrollViewer に埋め込んでやる。GridView のサイズは、その中身だけで決まるようになる。 --> | |
<ScrollViewer x:Name="ScrollViewer1" Grid.Row="1" | |
HorizontalScrollMode="Enabled" HorizontalScrollBarVisibility="Auto" | |
VerticalScrollMode="Disabled" VerticalScrollBarVisibility="Disabled" > | |
<GridView x:Name="GridView1" Margin="120,0,0,0" SizeChanged="GridView1_SizeChanged" | |
SelectedIndex="-1" | |
ItemsSource="{Binding Source={StaticResource definedColorsSource}}" | |
ItemTemplate="{StaticResource ColorInfoDataTemplate150x150}" /> | |
</ScrollViewer> |
NewerOlder