Instantly share code, notes, and snippets.
atzimler
/ PurpleButton.cs
Created
April 9, 2017 05:28
PurpleButton from Code, http://highvaluecode.com.au/creating-custom-wpf-controls-from-code
This file contains 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
using System.Windows; | |
using System.Windows.Controls; | |
using System.Windows.Media; | |
namespace PurpleButtonLib | |
{ | |
public class PurpleButton : Button | |
{ | |
public PurpleButton() | |
{ |
atzimler
/ AquaPurpleButton.cs
Created
April 9, 2017 06:17
AquaPurpleButton from code, http://highvaluecode.com.au/creating-custom-wpf-controls-from-code
This file contains 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
using System.Windows.Media; | |
namespace PurpleButtonLib | |
{ | |
public class AquaPurpleButton : PurpleButton | |
{ | |
public AquaPurpleButton() | |
{ | |
Background = Brushes.Aqua; | |
BorderBrush = Brushes.DarkCyan; |
atzimler
/ AquaPurpleButton.xaml
Created
April 9, 2017 06:21
AquaPurpleButton from XAML, http://highvaluecode.com.au/creating-custom-wpf-controls-from-code
This file contains 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
<purpleButtonLib:PurpleButton x:Class="WpfApplication.AquaPurpleButton" | |
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |
mc:Ignorable="d" | |
d:DesignHeight="25" d:DesignWidth="100" | |
Background="Aqua" BorderBrush="DarkCyan"> | |
</purpleButtonLib:PurpleButton> |
atzimler
/ HelloMessageButton.cs
Last active
April 17, 2017 03:19
This file contains 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
using System.Windows; | |
using System.Windows.Controls; | |
namespace DependencyProperties | |
{ | |
public class HelloMessageButton : Button | |
{ | |
public static DependencyProperty MessageProperty = | |
DependencyProperty.Register(nameof(Message), | |
typeof(string), |
atzimler
/ HelloMessageButton_Derived.cs
Created
April 17, 2017 03:44
This file contains 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
public class HelloMessageButton : Button |
atzimler
/ HelloMessageButton_Message.cs
Created
April 17, 2017 03:45
This file contains 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
public string Message | |
{ | |
get { return (string)GetValue(MessageProperty); } | |
set { SetValue(MessageProperty, value); } | |
} |
atzimler
/ HelloMessageButton_DependencyProperty.cs
Created
April 17, 2017 03:47
This file contains 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
public static DependencyProperty MessageProperty = | |
DependencyProperty.Register(nameof(Message), | |
typeof(string), | |
typeof(HelloMessageButton), | |
new PropertyMetadata(null)); |
atzimler
/ HelloMessageButton_Click.cs
Created
April 17, 2017 03:48
This file contains 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
Click += (o, e) => MessageBox.Show(Message); |
atzimler
/ HelloMessageButton_MainWindow.xaml
Last active
April 17, 2017 03:53
This file contains 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
<Window x:Class="DependencyProperties.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:DependencyProperties" | |
mc:Ignorable="d" | |
Title="MainWindow" Height="350" Width="525"> | |
<Grid> | |
<Grid.RowDefinitions> |
atzimler
/ AddCalculation.cs
Last active
April 25, 2017 11:11
This file contains 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
public class AddCalculation : DependencyObject |
OlderNewer