Format:
Recent snippets matching tags of Xaml
public class MyValidation { public enum ValidFormats { Any, Numeric } public static ValidFormats GetFormat(DependencyObject obj) { return (ValidFormats)obj.GetValue(FormatProperty);
15 Views
no comments
<DataGrid.Resources> <SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="#FFFFFF"/> <SolidColorBrush x:Key="{x:Static SystemColors.HighlightTextBrushKey}" Color="#000000"/> </DataGrid.Resources>
29 Views
no comments
<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>
49 Views
no comments
ObservableCollection<string> m_Data; public MainPage() { InitializeComponent(); m_Data = new ObservableCollection<string> { "One", "Two", "Three", "Four" }; MyListBox.ItemsSource = m_Data; }
86 Views
no comments
ObservableCollection<string> m_Data; public MainPage() { InitializeComponent(); m_Data = new ObservableCollection<string> { "One", "Two", "Three", "Four" }; MyListBox.ItemsSource = m_Data; }
63 Views
no comments
/// <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...
154 Views
no comments
<Popup x:Name="popup1" IsHitTestVisible="False" Placement="RelativePoint" PlacementTarget="{Binding ElementName=me}" AllowsTransparency="True"> <Border BorderBrush="{DynamicResource CellBorderBrush}" BorderThickness="2" Background="White"
122 Views
no comments
using System; using System.Diagnostics; using System.Windows; using System.Windows.Media; public partial class MyWPFClass : Window { public MyWPFClass() { InitializeComponent(); PrintLogicalTree(0, this);
185 Views
no comments
<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>
267 Views
no comments
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);
363 Views
no comments
<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>
296 Views
no comments
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 }
837 Views
1 comments
<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>
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();
203 Views
no comments
/* 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
309 Views
no comments
<Canvas> <Line X1="-50000" Y1="10" X2="500" Y2="400" Stroke="Green" /> </Canvas>
332 Views
no comments
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);
885 Views
no comments
Subscribe
Discuss
What's new
What is it
New Snippet
Recent Snippets
My Snippets
Web Code
Search
