Format:
Recent snippets for: Jerry Nixon
private void PhoneApplicationPage_ManipulationDelta1(object sender, ManipulationDeltaEventArgs e) { MyTransform1.X += e.DeltaManipulation.Translation.X; MyTransform1.Y += e.DeltaManipulation.Translation.Y; Collide(); } private void PhoneApplicationPage_ManipulationDelta2(object sender, ManipulationDeltaEventArgs e) { MyTransform2.X += e.DeltaManipulation.Translation.X;
15 Views
no comments
<!--LayoutRoot is the root grid where all page content is placed--> <Grid x:Name="LayoutRoot" Background="Transparent"> <Grid.RowDefinitions> <RowDefinition Height="Auto"/> <RowDefinition Height="*"/> </Grid.RowDefinitions> <!--TitlePanel contains the name of the application and page title--> <StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28"> <TextBlock x:Name="ApplicationTitle" Text="MY APPLICATION" Style="{StaticResource PhoneTextNormalStyle}"/>
16 Views
no comments
public partial class MainPage : PhoneApplicationPage { // Constructor public MainPage() { InitializeComponent(); MyListBox.ItemsSource = new string[] { "Red", "Green", "Blue" }; } private void MyListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
70 Views
no comments
ObservableCollection<string> m_Data; public MainPage() { InitializeComponent(); m_Data = new ObservableCollection<string> { "One", "Two", "Three", "Four" }; MyListBox.ItemsSource = m_Data; }
33 Views
no comments
ObservableCollection<string> m_Data; public MainPage() { InitializeComponent(); m_Data = new ObservableCollection<string> { "One", "Two", "Three", "Four" }; MyListBox.ItemsSource = m_Data; }
28 Views
no comments
public class MatchConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo c) { if (value == null && Match == null) return Then; // convert Match to the value's type if (Match != null && value != null)
36 Views
no comments
public sealed class InfoHub: INotifyPropertyChanged { /* VERSION 1.0 // 2012.01.06 // blog.jerrynixon.com */ /* SEND UPDATES/BUGS/SUGGESTIONS TO jnixon@microsoft.com */ public enum Theme { Light, Dark } public enum Version { Nodo, Mango, Tango, Apollo, Unkown } public enum Accent { Blue, Pink, Brown, Purple, Green, Red, Lime, Teal, Magenta, Mango, Other } // used for the blocking Load()
118 Views
1 comments
static void Delete(PhoneApplicationPage page, UIElement item, Action callback) { // setup var _Scale = new ScaleTransform { ScaleX = 1, ScaleY = 1, CenterX = item.RenderSize.Width / 2, CenterY = item.RenderSize.Height / 2,
48 Views
no comments
public ItemViewer() { InitializeComponent(); Loaded += ItemViewer_Loaded; } void ItemViewer_Loaded(object sender, RoutedEventArgs e) { if (LayoutRoot.Visibility != Visibility.Collapsed) throw new Exception("item.Visibility != Collapsed");
64 Views
no comments
private void MyListBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { // get the ListBoxItem that was pressed var _UIElement = MyListBox.ItemContainerGenerator .ContainerFromItem(MyListBox.SelectedItem) as UIElement; // resize the ListBoxItem Resize(_UIElement, () => { /* TODO: nav away */ }, 1, .25, .1); }
48 Views
no comments
Rectangle m_Rectangle;
TranslateTransform m_Transform;
Microsoft.Devices.Sensors.Accelerometer m_Accelerometer;
public MainPage()
{
InitializeComponent();
Loaded += MainPage_Loaded;
Unloaded += (s, e) => { m_Accelerometer.Stop(); };
}
121 Views
no comments
static void Main(string[] args) { Console.WriteLine(PhoneNumber("12345678901234")); Console.WriteLine(PhoneNumber("1234567890123")); Console.WriteLine(PhoneNumber("123456789012")); Console.WriteLine(PhoneNumber("12345678901")); Console.WriteLine(PhoneNumber("1234567890")); Console.WriteLine(PhoneNumber("123456789")); Console.WriteLine(PhoneNumber("12345678")); Console.WriteLine(PhoneNumber("1234567"));
71 Views
no comments
public static bool IsDouble(TextBox textBox, Key newKey) { var _Letter = string.Empty; switch (newKey) { case Key.A: _Letter = "A"; break; case Key.Add: _Letter = "+"; break; case Key.Alt: break; case Key.B: _Letter = "B"; break; case Key.Back: break;
62 Views
no comments
public partial class MainPage : PhoneApplicationPage { // Constructor public MainPage() { InitializeComponent(); LoadButton.Click += LoadButton_Click; SaveButton.Click += SaveButton_Click; }
54 Views
no comments
public class HandleTheme { // light public static string GetLightUrl(DependencyObject obj) { return (string)obj.GetValue(LightUrlProperty); } public static void SetLightUrl(DependencyObject obj, string value) { obj.SetValue(LightUrlProperty, value);
82 Views
no comments
public partial class MyDataContext : System.Data.Linq.DataContext { public void OnCreated() { if (!this.DatabaseExists()) MoveDatabase("MyDatabase.sdf"); } public static void MoveDatabase(string name) {
102 Views
no comments
public abstract class ViewModelBase : INotifyPropertyChanged { public event PropertyChangedEventHandler PropertyChanged; protected void RaisePropertyChanged(string property) { if (PropertyChanged == null) return; PropertyChanged(this, new PropertyChangedEventArgs(property)); PropertyChanged(this,
100 Views
no comments
<!-- CTRL+K, CTRL+X = Insert Snippet --> <!-- CTRL+K, CTRL+B = Manage Snippets --> <CodeSnippet Format="1.0.0" xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet"> <Header> <Title>Property with NotifyPropertyChanged</Title> <Author>Jerry Nixon</Author> <Shortcut>propnote</Shortcut> <Description>Property with NotifyPropertyChanged</Description>
289 Views
1 comments
void DoQuery() { // Register for the LoadCompleted event. var _Data = new DataServiceCollection<CityCrime>(); _Data.LoadCompleted += _Data_LoadCompleted; // start the servery query var _Query = GetContext().CityCrime .Where(x => x.State == "Colorado") .Where(x => x.City == "Denver");
71 Views
no comments
// https://datamarket.azure.com/ private const string AZUREDATAACCOUNT = "Your Customer ID"; private const string AZUREDATAKEY = "Your Account Key"; private const string AZUREDATAURL = "https://api.datamarket.azure.com/Data.ashx/data.gov/Crimes/"; // create a new context to the odata feed private static Mango.Sample.AzureMarket .CityCrimeService.datagovCrimesContainer GetContext() {
57 Views
no comments
Subscribe
Discuss
What's new
What is it
New Snippet
Recent Snippets
My Snippets
Web Code
Search
