Skip to content

Instantly share code, notes, and snippets.

View cwensley's full-sized avatar

Curtis Wensley cwensley

View GitHub Profile
@cwensley
cwensley / ExpandableView.cs
Last active August 29, 2015 14:25
ExpandableView for Eto.Forms
using System;
using Eto.Forms;
using Eto.Drawing;
using EtoPill2.Resources;
namespace EtoPill2.Views
{
public class ExpandableView : TableLayout
{
readonly Panel content;
@cwensley
cwensley / GridBackgroundColorBinding.cs
Created July 16, 2015 16:12
Background color binding to gridview
var binding = Binding.Property((MyModel m) => m.Color);
var grid = new GridView();
grid.CellFormatting += (sender, e) => e.BackgroundColor = binding.GetValue(e.Item);
@cwensley
cwensley / etofsharp.fs
Created July 14, 2015 04:31
Eto in F#
namespace FsCombined
open System
open Eto.Forms
open Eto.Drawing
type MainForm() =
inherit Form()
do
base.Title <- "My Eto Form"
@cwensley
cwensley / Direct2DTransformTest.cs
Created June 3, 2015 05:58
Eto.Forms Direct2D transform test
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Eto.Forms;
using Eto.Drawing;
namespace MyApp1
{
@cwensley
cwensley / PaddingSpacing.json
Created May 29, 2015 16:58
Eto.Forms JSON UI with padding/spacing
{
/* $type can be specified if loading json directly (without existing instance), but when loading from a specific instance (like this example) you omit it */
Content: {
$type: "TabControl",
Pages: [
{
Text: "Table Layout & Controls",
Content: {
$type: "TableLayout",
Padding: "30",
@cwensley
cwensley / SerializableEtoBitmap.cs
Created April 20, 2015 22:04
Serializable Eto Bitmap
using System;
using System.IO;
using System.Runtime.Serialization;
namespace Eto.Drawing
{
[Serializable]
public class SerializableBitmap : Eto.Drawing.Bitmap, ISerializable
{
static System.IO.Stream Init(System.IO.Stream s)
@cwensley
cwensley / AppendToTextArea.cs
Created April 12, 2015 21:25
Eto.Forms sample for a form that adds lines to a TextArea
public class TestForm : Form
{
TextArea messagesBox;
TextBox messageEntryBox;
Button sendButton;
public TestForm()
{
ClientSize = new Size(400, 300);
messagesBox = new TextArea { ReadOnly = true };
@cwensley
cwensley / PropertyLayoutTest.cs
Last active August 29, 2015 14:15
Example of creating a custom PropertyLayout based on DynamicLayout
using System;
using Eto.Forms;
using Eto.Drawing;
namespace Eto.Test
{
public class PropertyLayout : Panel
{
readonly DynamicLayout layout;
DynamicTable currentTable;
@cwensley
cwensley / StackLayout.cs
Last active August 29, 2015 14:15
StackLayout using separate properties
using System;
using System.Collections.ObjectModel;
using Eto.Drawing;
using System.ComponentModel;
namespace Eto.Forms
{
/// <summary>
/// Alignment for child controls of the <see cref="StackLayout"/>.
@cwensley
cwensley / StackLayoutTest.cs
Created February 17, 2015 17:27
Shows the new StackLayout
public class MyForm : Form
{
public MyForm()
{
ClientSize = new Size(200, 200);
Content = new StackLayout
{
Orientation = Orientation.Vertical,
ContentAlign = StackLayoutAlign.Center,
Spacing = 10,