Last active
January 30, 2023 07:47
-
-
Save Nia-TN1012/03294b7ee7feed0afadd22044b848cde to your computer and use it in GitHub Desktop.
XAMLでカレンダーを出力するコードです。ロジック用コードは初期化のみです。
This file contains hidden or 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 hidden or 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
<!-- | |
名前 : Nia Tomonaka | |
Twitter : https://twitter.com/nia_tn1012 | |
--> | |
<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-2023 Nia T.N. Tech Lab. / Chronoir.net. | |
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
GitHubのアカウント統合のため、Myoga1012→Nia-TN1012に移行しました。
旧URL: https://gist.github.com/Myoga1012/b5cf2db272e585560535
移行元のGistのコメント履歴
Calendar.DisplayDate
とのデータバインディング時、StringFormat
を{0:d}
と指定すると、値がMM/DD/YYYY
という文字列になります。さらにConverterCulture
をデフォルトのen-us
からja-jp
にすると、YYYY/MM/DD
という表現になります。