CodePaste Logo
New Snippet New Snippet Recent Snippets Recent Snippets My Snippets My Snippets Web Code Search Snippets Search
Sign inor Register
Format:
Recent snippets matching tags of Xaml
C#
public class MyValidation
{
    public enum ValidFormats
    {
        Any, Numeric
    }
 
    public static ValidFormats GetFormat(DependencyObject obj)
    {
        return (ValidFormats)obj.GetValue(FormatProperty);
by Jerry Nixon   May 15, 2012 @ 12:51pm
Tags: XAML, WinRT
15 Views
no comments
 
XML
<DataGrid.Resources>
    <SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="#FFFFFF"/>
    <SolidColorBrush x:Key="{x:Static SystemColors.HighlightTextBrushKey}" Color="#000000"/>
</DataGrid.Resources>
by patrick   March 05, 2012 @ 6:13am
29 Views
no comments
 
XML
<Application x:Class="MyApp.App"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:local="clr-namespace:MyApp">
    <Application.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary>
                    <local:AppBootstrapper x:Key="bootstrapper" />
                </ResourceDictionary>
by patrick   March 02, 2012 @ 1:30am
49 Views
no comments
 
C#
ObservableCollection<string> m_Data;
public MainPage()
{
    InitializeComponent();
    m_Data = new ObservableCollection<string>
    {
        "One", "Two", "Three", "Four"
    };
    MyListBox.ItemsSource = m_Data;
}
by Jerry Nixon   January 19, 2012 @ 8:53am
Tags: WP, XAML, Animation
86 Views
no comments
 
C#
ObservableCollection<string> m_Data;
public MainPage()
{
    InitializeComponent();
    m_Data = new ObservableCollection<string> 
    { 
        "One", "Two", "Three", "Four"
    };
    MyListBox.ItemsSource = m_Data;
}
by Jerry Nixon   January 19, 2012 @ 8:52am
Tags: WP, XAML, Animation
63 Views
no comments
 
C#
/// <summary>
/// State flag which indicates whether the grid is in edit
/// mode or not.
/// </summary>
public bool IsEditing { get; set; }
 
private void OnBeginEdit(object sender, DataGridBeginningEditEventArgs e)
{
  IsEditing = true;
  //in case we are in the middle of a drag/drop operation, cancel it...
by Athens Springer   June 29, 2011 @ 7:57am
154 Views
no comments
 
XML
<Popup
  x:Name="popup1"
  IsHitTestVisible="False"
  Placement="RelativePoint"
  PlacementTarget="{Binding ElementName=me}"
  AllowsTransparency="True">
  <Border
    BorderBrush="{DynamicResource CellBorderBrush}"
    BorderThickness="2"
    Background="White"
by Athens Springer   June 29, 2011 @ 7:56am
122 Views
no comments
 
C#
using System;
using System.Diagnostics;
using System.Windows;
using System.Windows.Media;
public partial class MyWPFClass : Window
{
public MyWPFClass()
{
InitializeComponent();
PrintLogicalTree(0, this);
by Vijay Sharma   April 22, 2011 @ 2:14am
185 Views
no comments
 
XML
<Border BorderBrush="Black" BorderThickness="1.5" CornerRadius="12">
    <Border.Background>
        <ImageBrush>
            <ImageBrush.ImageSource>
                <BitmapImage UriSource="c:\temp\happy.jpg" />
            </ImageBrush.ImageSource>
        </ImageBrush>
    </Border.Background>
</Border>
by bnaya   February 08, 2011 @ 7:19am
267 Views
no comments
 
C#
public class Popper
{
    public static void PopItem(UIElement control)
    {
        DoItem(TimeSpan.FromMilliseconds(200), 1, 1.5, control);
    }
 
    public static void UnPopItem(UIElement control)
    {
        DoItem(TimeSpan.FromMilliseconds(200), 1.5, 1, control);
by Jerry Nixon   February 01, 2011 @ 4:39pm
363 Views
no comments
 
XML
<Rectangle Width="100" Height="100" Fill="RoyalBlue" Margin="20">
    <Rectangle.RenderTransform>
        <TransformGroup>
            <ScaleTransform CenterX="50" CenterY="50" ScaleX="1.5" ScaleY="1.5" />
            <RotateTransform CenterX="50" CenterY="50" Angle="5" />
        </TransformGroup>
    </Rectangle.RenderTransform>
</Rectangle>
by Jerry Nixon   February 01, 2011 @ 4:35pm
296 Views
no comments
 
C#
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using System.Windows.Media.Animation;
 
public class Flipper
{
    public enum Directions { LeftToRight, RightToLeft }
by Jerry Nixon   February 01, 2011 @ 1:23pm
837 Views
1 comments
 
XML
<Rectangle x:Name="myRect2" Width="20" Height="20" >
 <Rectangle.Fill>
  <ImageBrush ImageSource="Images/nav_logo13.png" Stretch="None" AlignmentX="Left" AlignmentY="Top" >
   <ImageBrush.Transform>
    <CompositeTransform TranslateX="-20" TranslateY="-20"/>
   </ImageBrush.Transform>
  </ImageBrush>
 </Rectangle.Fill>
</Rectangle>
by Arjan   July 15, 2010 @ 10:35pm
360 Views
no comments
 
Rect rect = new Rect(canvas.RenderSize);
RenderTargetBitmap rtb = new RenderTargetBitmap((int)rect.Right,
  (int)rect.Bottom, 96d, 96d, System.Windows.Media.PixelFormats.Default);
rtb.Render(canvas);
//endcode as PNG
BitmapEncoder pngEncoder = new PngBitmapEncoder();
pngEncoder.Frames.Add(BitmapFrame.Create(rtb));
 
//save to memory stream
System.IO.MemoryStream ms = new System.IO.MemoryStream();
by bnaya   May 03, 2010 @ 11:58am
203 Views
no comments
 
C#
/*
 
DataSet myDataSet;
Example
 
If you have a common language runtime (CLR) object you would like to bind to from XAML, one way you can make the object available for binding is to define it as a resource and give it an x:Key. In the following example, you have a Person object with a string property named PersonName. The Person object is defined in the namespace called SDKSample.
XAML
Copy
 
<Window
by FoxyComputersLtd   April 24, 2010 @ 8:56am
309 Views
no comments
 
XML
<Canvas>
    <Line X1="-50000" Y1="10" X2="500" Y2="400" Stroke="Green" />
</Canvas>
 
by Alan Mendelevich   April 06, 2010 @ 8:11am
332 Views
no comments
 
C#
public static void ExportToJpeg() {
    prepare(true);
    SaveFileDialog saveDialog = new SaveFileDialog
    {
        Filter = "JPEG Files (*.jpeg)|*.jpeg",
        DefaultExt = ".jpeg",
    };
    if ((bool)saveDialog.ShowDialog()) {
        using (Stream fileStream = saveDialog.OpenFile()) {
            WriteableBitmap bitmap = new WriteableBitmap(containerPanel, null);
by Danijel Stulic   August 17, 2009 @ 5:18am
885 Views
no comments
 
brought to you by:
West Wind Techologies



If you find this site useful and use it frequently please consider making a donation to support this free service.
Donate