Skip to content

Instantly share code, notes, and snippets.

using System;
using System.ComponentModel;
using System.Linq;
using System.Runtime.Serialization;
namespace d2mSoftware
{
[Serializable]
public class ServerInfoVm : INotifyPropertyChanged, IDataErrorInfo
<ContextMenu Name="MainDropDownMenu" ItemsSource={Binding ServerList}>
<ContextMenu.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding ServerName}" />
</DataTemplate>
</ContextMenu.ItemTemplate>
<MenuItem Header="Settings" Click="OpenSettings">
<MenuItem.Icon>
<TextBlock Text="Hardcoded Value" />
<Window x:Class="WpfApplication4.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<Grid>
<Grid.Resources>
<Style x:Key="HiddenTabItem" TargetType="{x:Type TabItem}">
<!--<Setter Property="Visibility" Value="Visible"/>-->
<Window x:Class="WpfApplication5.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<Window.Resources>
<Storyboard x:Key="animate">
<ObjectAnimationUsingKeyFrames BeginTime="0:0:0" Storyboard.TargetProperty="Visibility">
<DiscreteObjectKeyFrame KeyTime="0">
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
<StackPanel Visibility="Hidden">
<StackPanel.Style>
<Style>
<Style.Triggers>
<MultiDataTrigger>
<Window x:Class="WpfApplication16.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<Window.Resources>
<Style TargetType="ListBox" x:Key="ListStyle" BasedOn="{StaticResource {x:Type ListBox}}">
<Style.Triggers>
<DataTrigger Binding="{Binding RelativeSource={x:Static RelativeSource.Self}, Path=Items.Count}" Value="0">
<Setter Property="Template">
public static Image ResizeImage(Image initImage, int templateWidth, int templateHeight)
{
Image templateImage = null;
try
{
if (initImage.Width <= templateWidth && initImage.Height <= templateHeight)
templateImage = initImage;
else
{
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Style TargetType="{x:Type ScrollViewer}" x:Key="ScrollViewerControlTemplate">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ScrollViewer}">
<Grid x:Name="Grid" Background="{TemplateBinding Background}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
namespace WpfApplication12
{
public partial class MainWindow : INotifyPropertyChanged
{