Skip to content

Instantly share code, notes, and snippets.

@hilapon
hilapon / gist:adb050776e1e83de62b4
Created January 14, 2015 04:51
WPF の Hello world (その1)
<Window x:Class="Helloworld1.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
Hello World
</Window>
@hilapon
hilapon / gist:8f65dc9bfc48dd8697c6
Created January 14, 2015 06:56
WPF の Hello world (その2)
using System;
using System.Windows;
namespace ConsoleApplication3 {
class Program {
[STAThread]
static void Main(string[] args) {
var window = new Window() { Content = "Hello world" };
window.ShowDialog();
}
@hilapon
hilapon / gist:270ab7961e5ebf9d1dba
Created January 14, 2015 08:04
WPF の Hello world (その3)
using System;
using System.Windows;
using System.Windows.Controls;
namespace ConsoleApplication3 {
class Program {
[STAThread]
static void Main(string[] args) {
var window = new Window() {
Content = new TextBlock() {
@hilapon
hilapon / Person.cs
Created January 14, 2015 08:21
単純なパーソンクラス
using System;
namespace MenuButtonApp.Models {
public class Person {
public Int32 Id { get; set; }
public string Name { get; set; }
public Int32 Age { get; set; }
}
}
@hilapon
hilapon / Person.vb
Last active August 29, 2015 14:13
単純なパーソンクラス、VB版
Option Explicit On
Option Strict On
Namespace Models
Public Class Person
Public Property Id() As Int32
Public Property Name() As String
Public Property Age() As Int32
End Class
End Namespace
@hilapon
hilapon / MainWindowViewModel.cs
Created January 14, 2015 08:31
Person のコレクションを保持するViewModel
using Livet;
using Livet.Commands;
using MenuButtonApp2.Models;
using System.Collections.ObjectModel;
using System.Windows;
namespace MenuButtonApp2.ViewModels {
public class MainWindowViewModel : ViewModel {
public MainWindowViewModel() {
this.Persons = new ObservableCollection<Person>();
@hilapon
hilapon / MainWindowViewModel.vb
Last active August 29, 2015 14:13
Person のコレクションを保持する ViewModel、VB版
Option Explicit On
Option Strict On
Imports System.Collections.ObjectModel
Imports MenuButtonApp.Models
Namespace ViewModels
Public Class MainWindowViewModel
Inherits ViewModel
@hilapon
hilapon / MainWindow.xaml
Last active August 29, 2015 14:13
[WPF] 項目を Button で表示する ListBox のサンプル
<!-- MainWindow.xaml -->
<Window x:Class="MenuButtonApp.Views.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions"
xmlns:l="http://schemas.livet-mvvm.net/2011/wpf"
xmlns:v="clr-namespace:MenuButtonApp2.Views"
xmlns:vm="clr-namespace:MenuButtonApp2.ViewModels"
Title="MainWindow" Height="350" Width="525">
@hilapon
hilapon / DropDownTextBoxStyle.xaml
Last active August 29, 2015 14:13
[WPF] : ドロップダウン付き TextBox のサンプル
<Style x:Key="TextBoxStyle1" TargetType="{x:Type TextBox}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type TextBox}">
<Border>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition Width="24" />
</Grid.ColumnDefinitions>
@hilapon
hilapon / DefaultWPFViewerTemplates.xaml
Created January 14, 2015 10:04
[WPF] : カスタマイズされた ActiveReports Viewer のリソースディクショナリを使用するサンプル
<Window x:Class="ReportWindow"
・・・・・中略・・・・・
<Window.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source=".\DefaultWPFViewerTemplates.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Window.Resources>
・・・・・中略・・・・・