Skip to content

Instantly share code, notes, and snippets.

Created April 23, 2015 22:13
Show Gist options
  • Save anonymous/705baa68d1a46eed7e51 to your computer and use it in GitHub Desktop.
Save anonymous/705baa68d1a46eed7e51 to your computer and use it in GitHub Desktop.
Kyle's UserControl code-behind
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using System.Windows.Input;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
// The User Control item template is documented at http://go.microsoft.com/fwlink/?LinkId=234236
namespace MyCalcCS
{
public sealed partial class CalculatorButton : UserControl
{
public string WhiteString
{
get { return (string)GetValue(WhiteStringProperty); }
set { SetValue(WhiteStringProperty, value); }
}
// Using a DependencyProperty as the backing store for WhiteString. This enables animation, styling, binding, etc...
public static readonly DependencyProperty WhiteStringProperty =
DependencyProperty.Register("WhiteString", typeof(string), typeof(CalculatorButton), new PropertyMetadata(0));
/***********************************************************************************************************************/
public string OrangeString
{
get { return (string)GetValue(OrangeStringProperty); }
set { SetValue(OrangeStringProperty, value); }
}
// Using a DependencyProperty as the backing store for OrangeString. This enables animation, styling, binding, etc...
public static readonly DependencyProperty OrangeStringProperty =
DependencyProperty.Register("OrangeString", typeof(string), typeof(CalculatorButton), new PropertyMetadata(0));
/***********************************************************************************************************************/
public string BlueString
{
get { return (string)GetValue(BlueStringProperty); }
set { SetValue(BlueStringProperty, value); }
}
// Using a DependencyProperty as the backing store for BlueString. This enables animation, styling, binding, etc...
public static readonly DependencyProperty BlueStringProperty =
DependencyProperty.Register("BlueString", typeof(string), typeof(CalculatorButton), new PropertyMetadata(0));
/***********************************************************************************************************************/
public string Content
{
get { return (string)GetValue(ContentProperty); }
set { SetValue(ContentProperty, value); }
}
// Using a DependencyProperty as the backing store for Content. This enables animation, styling, binding, etc...
public static readonly DependencyProperty ContentProperty =
DependencyProperty.Register("Content", typeof(string), typeof(CalculatorButton), new PropertyMetadata(0));
/***********************************************************************************************************************/
public ICommand Command
{
get { return (ICommand)GetValue(CommandProperty); }
set { SetValue(CommandProperty, value); }
}
// Using a DependencyProperty as the backing store for Command. This enables animation, styling, binding, etc...
public static readonly DependencyProperty CommandProperty =
DependencyProperty.Register("Command", typeof(ICommand), typeof(CalculatorButton), new PropertyMetadata(0));
/***********************************************************************************************************************/
public CalculatorButton()
{
this.InitializeComponent();
LayoutRoot.DataContext = this;
this.WhiteString = "White Text";
this.OrangeString = "Orange Text";
this.BlueString = "Blue Text";
MyCalcCS.ViewModels_designTime.CalculatorButtonViewModel_designTime dtvm = new MyCalcCS.ViewModels_designTime.CalculatorButtonViewModel_designTime();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment