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 wpf
 <Image Margin="367.056,8,8,0" VerticalAlignment="Top" Name="imgLargePreview" Width="640" Height="480" MaxHeight="480" MaxWidth="640" />
 
 
 
 
Private Sub Button1_Click(sender As System.Object, e As System.Windows.RoutedEventArgs) Handles Button1.Click
        saveImage()
    End Sub
    Sub saveImage()
        Dim encoder = New PngBitmapEncoder()
by DaveCS   May 15, 2012 @ 7:52am
15 Views
no comments
 
'Xaml
 <DataTemplate x:Key="DataTemplateComboDrives">
            <Grid Width="Auto">
                <TextBlock x:Name="textBlockDriveName" Margin="8,8,0,8" TextWrapping="Wrap" Text="{Binding DriveName}" FontWeight="Bold" Foreground="{DynamicResource brushDarkBlueText}" HorizontalAlignment="Left" Width="23"/>
                <TextBlock x:Name="textBlockDriveLable" Margin="26,8,24,8" TextWrapping="Wrap" Text="{Binding DriveLable}" FontWeight="Bold" Foreground="{DynamicResource brushDarkBlueText}" RenderTransformOrigin="1.25,0.501" HorizontalAlignment="Right" Width="Auto"/>
            </Grid>
        </DataTemplate>
        <Style x:Key="ComboBoxItemStyleDrives" TargetType="{x:Type ComboBoxItem}">
            <Setter Property="HorizontalContentAlignment" Value="{Binding HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
            <Setter Property="VerticalContentAlignment" Value="{Binding VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
by DaveCS   April 14, 2012 @ 8:53pm
23 Views
no comments
 
'must have a legitimate email setup with smtp relays set greater than 0 in your godaddy control panel (email accounts) 
Private Sub btnSendMessage_Click(sender As System.Object, e As System.Windows.RoutedEventArgs) Handles btnSendMessage.Click
      CreateTimeoutTestMessage("smtpout.secureserver.net") 'This is standard with most email relays at godaddy
  End Sub
  Public Shared Sub CreateTimeoutTestMessage(server As String)
      Dim [to] As String = "busted@fbi.gov"
      Dim from As String = "billyjoebob@hillbilly.com"
      Dim subject As String = "Catch Me If You Can."
      Dim body As String = "This is the body of the message. Yada Yada Yada"
      Dim message As New MailMessage(from, [to], subject, body)
by DaveCS   April 10, 2012 @ 6:53pm
39 Views
no comments
 
 
 
Dim fullExeNameAndPath As String = System.Reflection.Assembly.GetExecutingAssembly().Location
Dim ExeName As String = System.IO.Path.GetFileNameWithoutExtension(fullExeNameAndPath)
msgbox (ExeName)
by DaveCS   March 26, 2012 @ 8:01pm
35 Views
no comments
 
Dim rootWindow As MainWindow = TryCast(Application.Current.MainWindow, MainWindow)
       rootWindow.TabControl1.SelectedIndex = 4
by DaveCS   March 14, 2012 @ 5:27am
52 Views
no comments
 
Imports System.ComponentModel
 
Public Class MyData
    Implements INotifyPropertyChanged
    ''USAGE in code behind
    'Dim data1 As New MyData(DateTime.Now)
    'Dim binding1 As New Binding("MyDataProperty")
    '    binding1.Source = data1
    '    Me.txtEnterCode.SetBinding(TextBox.TextProperty, binding1)
by DaveCS   March 13, 2012 @ 7:03pm
45 Views
no comments
 
XML
SelectedItem="{Binding TheProperty, PresentationTraceSources.TraceLevel=High}"
by patrick   March 12, 2012 @ 5:46am
38 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
51 Views
no comments
 
C#
public class AppBootstrapper : Bootstrapper<IShell>
    {
        private IKernel mKernel;
        private const string EXTENSION_PATH = "extensions";
 
        static AppBootstrapper()
        {
            //Caliburn.Micro.LogManager.GetLog = type => new NLogLogger(type);
        }
by patrick   February 21, 2012 @ 2:10am
83 Views
no comments
 
C#
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Interactivity;
using System.Windows.Threading;
 
namespace Behaviors
{
    /// <summary>
    /// On ListBoxes using CanContentScroll=True (virtualized), WPF layout changes will make the scrollviewer reset to zero.
by SandRock   October 26, 2011 @ 12:01am
95 Views
no comments
 
C#
public static BitmapImage _ToBitmapImage(this Bitmap bitmap)
{
    var _MemoryStream = new MemoryStream();
    bitmap.Save(_MemoryStream, ImageFormat.Png);
 
    var _BitmapImage = new BitmapImage();
    _BitmapImage.BeginInit();
    _BitmapImage.StreamSource = _MemoryStream;
    _BitmapImage.EndInit();
by Jerry Nixon   August 22, 2011 @ 9:43am
94 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
 
XML
<Style.Triggers>
  <Trigger Property="IsEnabled" Value="false">
    <Setter Property="Background" Value="#EEEEEE" />
  </Trigger>
 
  <MultiTrigger>
    <MultiTrigger.Conditions>
      <Condition Property="HasItems" Value="false" />
      <Condition Property="Width" Value="Auto" />
    </MultiTrigger.Conditions>
by Athens Springer   June 28, 2011 @ 3:29pm
194 Views
no comments
 
C#
// DRAG
 
private void List_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
    // Store the mouse position
    startPoint = e.GetPosition(null);
}
 
private void List_MouseMove(object sender, MouseEventArgs e)
{
by Athens Springer   June 28, 2011 @ 7:14am
Tags: WPF, Drag/Drop
447 Views
no comments
 
C#
public class DelegateCommand : ICommand
{
    private readonly Predicate<object> _canExecute;
    private readonly Action<object> _execute;
 
    public event EventHandler CanExecuteChanged;
 
    public DelegateCommand(Action<object> execute) 
                   : this(execute, null)
    {
by Athens Springer   June 28, 2011 @ 7:09am
Tags: C#, WPF, MVVM
204 Views
no comments
 
C#
public class Button : ButtonBase
{
// The dependency property
public static readonly DependencyProperty IsDefaultProperty;
static Button()
{
// Register the property
Button.IsDefaultProperty = DependencyProperty.Register(“IsDefault”,
typeof(bool), typeof(Button),
new FrameworkPropertyMetadata(false,
by Vijay Sharma   April 22, 2011 @ 3:12am
134 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
186 Views
no comments
 
XML
<Page
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
  <DockPanel LastChildFill="True">
      <Slider Name="MyZoomSlider" Minimum=".5" Maximum="20" Value="1" DockPanel.Dock="Top" />
      <TextBlock Margin="5,5,0,5" DockPanel.Dock="Top" Text="{Binding ElementName=MyZoomSlider, Path=Value, StringFormat='Current Zoom: \{0:0.0\}%'}"/>
      <ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto">
          <Rectangle Fill="Blue" Height="100" Width="100" Margin="10" HorizontalAlignment="Left" VerticalAlignment="Top">
              <Rectangle.LayoutTransform>
                  <ScaleTransform 
by Jerry Nixon   February 14, 2011 @ 11:15am
Tags: WPF, Zoom
317 Views
1 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