Skip to content

Instantly share code, notes, and snippets.

using System.Windows;
namespace PageableListBox
{
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
@julesx
julesx / button.xaml
Created April 21, 2015 15:35
button with context menu
<Button Name="MainOptionsButton">
<i:Interaction.Triggers>
<i:EventTrigger EventName="Click">
<ei:ChangePropertyAction TargetObject="{Binding ContextMenu, ElementName=MainOptionsButton}" PropertyName="PlacementTarget" Value="{Binding ElementName=MainOptionsButton, Mode=OneWay}"/>
<ei:ChangePropertyAction TargetObject="{Binding ContextMenu, ElementName=MainOptionsButton}" PropertyName="IsOpen" Value="True"/>
</i:EventTrigger>
</i:Interaction.Triggers>
@julesx
julesx / LoadingWindow.cs
Created April 27, 2015 12:42
Loading method
public LoadingWindow()
{
InitializeComponent();
DataContext = this;
Loaded += LoadingWindow_Loaded;
}
void LoadingWindow_Loaded(object sender, RoutedEventArgs e)
@julesx
julesx / PageParameterData.cs
Created April 29, 2015 19:12
updated PageParameterData
public class PageParameterData<TVm> : AbstractNotifyPropertyChanged
{
private int _currentPage;
private int _pageCount;
private int _pageSize;
private int _totalSize;
private int _startingIndex;
private int _endingIndex;
private readonly Command _cmdPageForward;
private readonly Command _cmdPageToEnd;
<Button Tag="{Binding RelativeSource={RelativeSource AncestorType=Grid}, Path=DataContext}"
CommandParameter="{Binding}"
Command="{Binding RelativeSource={RelativeSource AncestorType=Grid}, Path=DataContext.CmdPlayMeAtBookmark}" Margin="5,0,0,0" Style="{DynamicResource HyperlinkButton}"
Content="{Binding Seconds, Converter={StaticResource SecondsConverter}}">
<Button.ContextMenu>
<ContextMenu Tag="{Binding}" DataContext="{Binding Path=PlacementTarget.(Button.Tag), RelativeSource={RelativeSource Self}}">
<MenuItem Header="Delete" CommandParameter="{Binding RelativeSource={RelativeSource AncestorType=ContextMenu}, Path=PlacementTarget.CommandParameter}" Command="{Binding CmdDeleteBookmark}" />
</ContextMenu>
</Button.ContextMenu>
</Button>
public class RelayCommand : ICommand
{
#region Fields
readonly Action<object> _execute;
readonly Predicate<object> _canExecute;
#endregion // Fields
#region Constructors
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:util="http://schemas.microsoft.com/wix/UtilExtension"
xmlns:netfx="http://schemas.microsoft.com/wix/NetFxExtension">
<Bundle Name="Bootstrapper" Version="1.0.0.0" UpgradeCode="a5cbe250-7fd7-476c-9b44-9d73b92db6c9">
<BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.HyperlinkLicense">
<bal:WixStandardBootstrapperApplication
LicenseUrl=""
xmlns:bal="http://schemas.microsoft.com/wix/BalExtension" />
</BootstrapperApplicationRef>
public static class Masking
{
private static readonly DependencyPropertyKey _maskExpressionPropertyKey = DependencyProperty.RegisterAttachedReadOnly("MaskExpression",
typeof(Regex),
typeof(Masking),
new FrameworkPropertyMetadata());
/// <summary>
/// Identifies the <see cref="Mask"/> dependency property.
/// </summary>
private static long GetNewMessageStatusId(MessageStatus messageStatus)
{
long messageStatusId = 1;
try
{
string tableName = messageStatus == MessageStatus.Delivered ? "message_delivery_lookups" : "message_read_lookups";
using (var dataContext = new MessageConnector())
{
public partial class MainWindow : Window
{
private Session _session;
private Project _project;
public MainWindow()
{
InitializeComponent();
Closing += MainWindow_Closing;