Skip to content

Instantly share code, notes, and snippets.

@gekka
gekka / QnA138091.md
Created October 30, 2020 10:17
Answer code for QnA 138091

[QnA] How to apply animation on ListBoxItem before removal?

<Window x:Class="Gekka.GPL.Sample.WPF.App1.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"  xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:Gekka.GPL.Sample.WPF.App1" mc:Ignorable="d"
        Title="MainWindow" Height="500" Width="300" >
    <DockPanel TextElement.FontSize="20">
        <Button Content="Test" Click="Button_Click"  DockPanel.Dock="Bottom" />
        <local:DelayRemoveListBox ItemsSource="{Binding}"/>
    </DockPanel>
@gekka
gekka / QnA102861.md
Last active January 5, 2021 09:29
Answer code for QnA 102861

[QnA] WPF DataGrid resizing column causes extreme scrolling

<DataGrid x:Name="TheDataGrid" AutoGenerateColumns="False" >
    <DataGrid.ColumnHeaderStyle>
        <Style TargetType="{x:Type DataGridColumnHeader}">
            <EventSetter Event="FrameworkElement.Loaded" Handler="DataGridColumnHeader_Loaded"/>
        </Style>
    </DataGrid.ColumnHeaderStyle>
    <DataGrid.Columns>
<Window x:Class="WpfApp39.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:WpfApp39"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="600">
<Window.Resources>
// CListCtrlEx
IMPLEMENT_DYNAMIC(CListCtrlEx, CListCtrl)
CListCtrlEx::CListCtrlEx()
{
}
CListCtrlEx::~CListCtrlEx()
{
Class TextBoxEx
Inherits TextBox
Sub New()
If Tool.IsWin11 Then
Me.BorderStyle = BorderStyle.FixedSingle
End If
End Sub
Protected Overrides Sub OnBorderStyleChanged(e As EventArgs)
namespace ConsoleApp1
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Collections.Concurrent;
class Program
@gekka
gekka / sample.vb
Created September 2, 2022 11:42
VB.NetでOutlookのメールをmsgファイルに書き出し
'https://social.msdn.microsoft.com/Forums/ja-JP/04531896-4b17-4b7f-851b-4b43dad05438
Imports Microsoft.Office.Interop 'OutlookのCOM参照を追加
Module Module1
Sub Main()
'出力先のフォルダ
Dim output As String = System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyDocuments), "output_msg")
#include "pch.h"
#include "test.h"
#include <objbase.h>
#include <initguid.h>
#include <mmsystem.h>
#include <dsound.h>
#pragma comment(lib, "dsound.lib")
static BOOL ReadWav(void** ppmem, DWORD* psize, WAVEFORMATEX* pformat);
<Window x:Class="WpfApp1.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:WpfApp1"
mc:Ignorable="d"
Title="MainWindow" Height="200" Width="300">
<Window.Resources>
@gekka
gekka / ContentDialogSample.cs
Created April 11, 2023 10:40
UWPのContentDialogのサンプル
//https://social.msdn.microsoft.com/Forums/ja-JP/8a58899a-a324-48db-80c0-e0befddfee52/
public async static Task<string> MessageQuestion(string title, string text, params string[] answers)
{
StackPanel panel = new StackPanel();
foreach (var ans in answers)
{
RadioButton r = new RadioButton() { Content = ans };
panel.Children.Add(r);