Last active
January 30, 2023 07:44
-
-
Save Myoga1012/b5cf2db272e585560535 to your computer and use it in GitHub Desktop.
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
// ロジック用コードです。主役はXAMLのコードだよ。 | |
using System.Windows; | |
namespace WPF { | |
public partial class MainWindow : Window { | |
public MainWindow() { InitializeComponent(); } | |
} | |
} |
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
<!-- | |
名前 : Myoga Screw-bright (旧名:Myoga S. Tomonaka) | |
Twitter : https://twitter.com/Myoga1012 | |
--> | |
<Window x:Class="WPF.MainWindow" | |
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |
Title="{Binding DisplayDate, ElementName=cal, StringFormat=\{0:d\}, ConverterCulture=ja-jp}" | |
Height="207" Width="200" ResizeMode="NoResize"> | |
<Calendar x:Name="cal"/> | |
</Window> | |
<!-- | |
Calender.xaml | |
Copyright (c) 2014 Myoga-TN.net All Rights Reserved. | |
This software is released under the MIT License. | |
http://opensource.org/licenses/mit-license.php | |
--> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Calendar.DisplayDateとのデータバインディング時、StringFormatを「{0:d}」と指定すると、値が「MM/DD/YYYY」という文字列になります。さらにConverterCultureをデフォルトの「en-us」から
「ja-jp」にすると、「YYYY/MM/DD」という表現になります。