Skip to content

Instantly share code, notes, and snippets.

@Nia-TN1012
Forked from Myoga1012/Calendar.cs
Last active January 30, 2023 07:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Nia-TN1012/03294b7ee7feed0afadd22044b848cde to your computer and use it in GitHub Desktop.
Save Nia-TN1012/03294b7ee7feed0afadd22044b848cde to your computer and use it in GitHub Desktop.
XAMLでカレンダーを出力するコードです。ロジック用コードは初期化のみです。
// ロジック用コードです。主役はXAMLのコードです。
using System.Windows;
namespace WPF {
public partial class MainWindow : Window {
public MainWindow() { InitializeComponent(); }
}
}
<!--
名前 : 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
-->
@Nia-TN1012
Copy link
Author

GitHubのアカウント統合のため、Myoga1012→Nia-TN1012に移行しました。

旧URL: https://gist.github.com/Myoga1012/b5cf2db272e585560535

移行元のGistのコメント履歴

  • 2014/10/17:
    • Calendar.DisplayDateとのデータバインディング時、StringFormat{0:d}と指定すると、値がMM/DD/YYYYという文字列になります。さらにConverterCultureをデフォルトのen-usからja-jpにすると、YYYY/MM/DDという表現になります。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment