This commit is contained in:
PetyaSotirova 2014-01-17 17:04:52 +02:00
Родитель 6d3648c4a3
Коммит 4289e1fd98
69 изменённых файлов: 3047 добавлений и 7 удалений

Просмотреть файл

@ -0,0 +1,134 @@
using System;
using System.Collections.ObjectModel;
namespace CustomContextMenuBehavior
{
public class AllOrders : Collection<Order>
{
public AllOrders()
{
this.Add(new Order { Date = new DateTime(2010, 6, 1), Product = "Printer stand", Quantity = 11, Net = 200.26, Promotion = "1 Free with 10", Advertisement = "Direct mail" });
this.Add(new Order { Date = new DateTime(2010, 6, 1), Product = "Glare filter", Quantity = 6, Net = 77.82, Promotion = "Extra Discount", Advertisement = "Magazine" });
this.Add(new Order { Date = new DateTime(2010, 6, 1), Product = "Mouse pad", Quantity = 15, Net = 100.95, Promotion = "Extra Discount", Advertisement = "Newspaper" });
this.Add(new Order { Date = new DateTime(2010, 6, 1), Product = "Glare filter", Quantity = 11, Net = 149.71, Promotion = "1 Free with 10", Advertisement = "Magazine" });
this.Add(new Order { Date = new DateTime(2010, 6, 2), Product = "Mouse pad", Quantity = 22, Net = 155.40, Promotion = "1 Free with 10", Advertisement = "Magazine" });
this.Add(new Order { Date = new DateTime(2010, 6, 2), Product = "Mouse pad", Quantity = 3, Net = 20.19, Promotion = "Extra Discount", Advertisement = "Newspaper" });
this.Add(new Order { Date = new DateTime(2010, 6, 2), Product = "Copy holder", Quantity = 5, Net = 33.65, Promotion = "Extra Discount", Advertisement = "Direct mail" });
this.Add(new Order { Date = new DateTime(2010, 6, 2), Product = "Printer stand", Quantity = 22, Net = 239.36, Promotion = "1 Free with 10", Advertisement = "Newspaper" });
this.Add(new Order { Date = new DateTime(2010, 6, 2), Product = "Glare filter", Quantity = 10, Net = 129.70, Promotion = "Extra Discount", Advertisement = "Magazine" });
this.Add(new Order { Date = new DateTime(2010, 6, 5), Product = "Mouse pad", Quantity = 22, Net = 155.40, Promotion = "1 Free with 10", Advertisement = "Magazine" });
this.Add(new Order { Date = new DateTime(2010, 6, 5), Product = "Printer stand", Quantity = 8, Net = 82.96, Promotion = "Extra Discount", Advertisement = "Direct mail" });
this.Add(new Order { Date = new DateTime(2010, 6, 5), Product = "Printer stand", Quantity = 22, Net = 239.40, Promotion = "1 Free with 10", Advertisement = "Direct mail" });
this.Add(new Order { Date = new DateTime(2010, 6, 5), Product = "Copy holder", Quantity = 55, Net = 388.50, Promotion = "1 Free with 10", Advertisement = "Magazine" });
this.Add(new Order { Date = new DateTime(2010, 6, 5), Product = "Mouse pad", Quantity = 25, Net = 168.25, Promotion = "Extra Discount", Advertisement = "Newspaper" });
this.Add(new Order { Date = new DateTime(2010, 6, 5), Product = "Glare filter", Quantity = 22, Net = 299.42, Promotion = "1 Free with 10", Advertisement = "Magazine" });
this.Add(new Order { Date = new DateTime(2010, 6, 6), Product = "Mouse pad", Quantity = 33, Net = 256.41, Promotion = "1 Free with 10", Advertisement = "Magazine" });
this.Add(new Order { Date = new DateTime(2010, 6, 6), Product = "Printer stand", Quantity = 11, Net = 119.70, Promotion = "1 Free with 10", Advertisement = "Magazine" });
this.Add(new Order { Date = new DateTime(2010, 6, 6), Product = "Glare filter", Quantity = 22, Net = 329.34, Promotion = "1 Free with 10", Advertisement = "Magazine" });
this.Add(new Order { Date = new DateTime(2010, 6, 6), Product = "Copy holder", Quantity = 20, Net = 134.60, Promotion = "Extra Discount", Advertisement = "Magazine" });
this.Add(new Order { Date = new DateTime(2010, 6, 24), Product = "Printer stand", Quantity = 99, Net = 1185.03, Promotion = "1 Free with 10", Advertisement = "Magazine" });
this.Add(new Order { Date = new DateTime(2010, 6, 24), Product = "Printer stand", Quantity = 55, Net = 658.35, Promotion = "1 Free with 10", Advertisement = "Direct mail" });
this.Add(new Order { Date = new DateTime(2010, 6, 5), Product = "Printer stand", Quantity = 11, Net = 131.67, Promotion = "1 Free with 10", Advertisement = "Newspaper" });
this.Add(new Order { Date = new DateTime(2010, 6, 8), Product = "Printer stand", Quantity = 25, Net = 299.25, Promotion = "Extra Discount", Advertisement = "Magazine" });
this.Add(new Order { Date = new DateTime(2010, 6, 9), Product = "Printer stand", Quantity = 22, Net = 263.34, Promotion = "1 Free with 10", Advertisement = "Newspaper" });
this.Add(new Order { Date = new DateTime(2010, 6, 12), Product = "Printer stand", Quantity = 11, Net = 131.67, Promotion = "1 Free with 10", Advertisement = "Newspaper" });
this.Add(new Order { Date = new DateTime(2010, 6, 13), Product = "Printer stand", Quantity = 22, Net = 263.34, Promotion = "1 Free with 10", Advertisement = "Newspaper" });
this.Add(new Order { Date = new DateTime(2010, 6, 14), Product = "Printer stand", Quantity = 30, Net = 311.10, Promotion = "Extra Discount", Advertisement = "Magazine" });
this.Add(new Order { Date = new DateTime(2010, 6, 15), Product = "Printer stand", Quantity = 15, Net = 155.55, Promotion = "Extra Discount", Advertisement = "Magazine" });
this.Add(new Order { Date = new DateTime(2010, 6, 16), Product = "Printer stand", Quantity = 20, Net = 207.40, Promotion = "Extra Discount", Advertisement = "Magazine" });
this.Add(new Order { Date = new DateTime(2010, 6, 17), Product = "Printer stand", Quantity = 74, Net = 767.38, Promotion = "Extra Discount", Advertisement = "Direct mail" });
this.Add(new Order { Date = new DateTime(2010, 6, 7), Product = "Printer stand", Quantity = 102, Net = 1057.74, Promotion = "Extra Discount", Advertisement = "Newspaper" });
this.Add(new Order { Date = new DateTime(2010, 6, 8), Product = "Glare filter", Quantity = 22, Net = 329.34, Promotion = "1 Free with 10", Advertisement = "Magazine" });
this.Add(new Order { Date = new DateTime(2010, 6, 9), Product = "Glare filter", Quantity = 11, Net = 164.67, Promotion = "1 Free with 10", Advertisement = "Magazine" });
this.Add(new Order { Date = new DateTime(2010, 6, 12), Product = "Glare filter", Quantity = 33, Net = 494.01, Promotion = "1 Free with 10", Advertisement = "Magazine" });
this.Add(new Order { Date = new DateTime(2010, 6, 13), Product = "Glare filter", Quantity = 33, Net = 494.01, Promotion = "1 Free with 10", Advertisement = "Magazine" });
this.Add(new Order { Date = new DateTime(2010, 6, 14), Product = "Glare filter", Quantity = 25, Net = 374.25, Promotion = "Extra Discount", Advertisement = "Magazine" });
this.Add(new Order { Date = new DateTime(2010, 6, 15), Product = "Glare filter", Quantity = 30, Net = 449.10, Promotion = "Extra Discount", Advertisement = "Magazine" });
this.Add(new Order { Date = new DateTime(2010, 6, 16), Product = "Glare filter", Quantity = 30, Net = 449.10, Promotion = "Extra Discount", Advertisement = "Magazine" });
this.Add(new Order { Date = new DateTime(2010, 6, 16), Product = "Glare filter", Quantity = 25, Net = 374.25, Promotion = "Extra Discount", Advertisement = "Magazine" });
this.Add(new Order { Date = new DateTime(2010, 6, 17), Product = "Glare filter", Quantity = 15, Net = 224.55, Promotion = "Extra Discount", Advertisement = "Magazine" });
this.Add(new Order { Date = new DateTime(2010, 6, 20), Product = "Glare filter", Quantity = 99, Net = 1482.03, Promotion = "1 Free with 10", Advertisement = "Direct mail" });
this.Add(new Order { Date = new DateTime(2010, 6, 21), Product = "Glare filter", Quantity = 132, Net = 1976.04, Promotion = "1 Free with 10", Advertisement = "Newspaper" });
this.Add(new Order { Date = new DateTime(2010, 6, 22), Product = "Glare filter", Quantity = 15, Net = 194.55, Promotion = "Extra Discount", Advertisement = "Magazine" });
this.Add(new Order { Date = new DateTime(2010, 6, 23), Product = "Glare filter", Quantity = 69, Net = 894.93, Promotion = "Extra Discount", Advertisement = "Direct mail" });
this.Add(new Order { Date = new DateTime(2010, 6, 24), Product = "Glare filter", Quantity = 120, Net = 1556.40, Promotion = "Extra Discount", Advertisement = "Newspaper" });
this.Add(new Order { Date = new DateTime(2010, 6, 7), Product = "Mouse pad", Quantity = 55, Net = 427.35, Promotion = "1 Free with 10", Advertisement = "Magazine" });
this.Add(new Order { Date = new DateTime(2010, 6, 8), Product = "Mouse pad", Quantity = 44, Net = 341.88, Promotion = "1 Free with 10", Advertisement = "Magazine" });
this.Add(new Order { Date = new DateTime(2010, 6, 9), Product = "Mouse pad", Quantity = 55, Net = 427.35, Promotion = "1 Free with 10", Advertisement = "Magazine" });
this.Add(new Order { Date = new DateTime(2010, 6, 12), Product = "Mouse pad", Quantity = 66, Net = 512.82, Promotion = "1 Free with 10", Advertisement = "Magazine" });
this.Add(new Order { Date = new DateTime(2010, 6, 13), Product = "Mouse pad", Quantity = 50, Net = 336.50, Promotion = "Extra Discount", Advertisement = "Magazine" });
this.Add(new Order { Date = new DateTime(2010, 6, 14), Product = "Mouse pad", Quantity = 45, Net = 302.85, Promotion = "Extra Discount", Advertisement = "Magazine" });
this.Add(new Order { Date = new DateTime(2010, 6, 15), Product = "Mouse pad", Quantity = 75, Net = 504.75, Promotion = "Extra Discount", Advertisement = "Magazine" });
this.Add(new Order { Date = new DateTime(2010, 6, 16), Product = "Mouse pad", Quantity = 50, Net = 336.50, Promotion = "Extra Discount", Advertisement = "Magazine" });
this.Add(new Order { Date = new DateTime(2010, 6, 25), Product = "Mouse pad", Quantity = 77, Net = 598.29, Promotion = "1 Free with 10", Advertisement = "Magazine" });
this.Add(new Order { Date = new DateTime(2010, 6, 26), Product = "Mouse pad", Quantity = 165, Net = 1282.05, Promotion = "1 Free with 10", Advertisement = "Direct mail" });
this.Add(new Order { Date = new DateTime(2010, 6, 17), Product = "Mouse pad", Quantity = 187, Net = 1452.99, Promotion = "1 Free with 10", Advertisement = "Newspaper" });
this.Add(new Order { Date = new DateTime(2010, 6, 18), Product = "Mouse pad", Quantity = 68, Net = 457.64, Promotion = "Extra Discount", Advertisement = "Magazine" });
this.Add(new Order { Date = new DateTime(2010, 6, 19), Product = "Mouse pad", Quantity = 122, Net = 821.06, Promotion = "Extra Discount", Advertisement = "Direct mail" });
this.Add(new Order { Date = new DateTime(2010, 6, 20), Product = "Mouse pad", Quantity = 175, Net = 1177.75, Promotion = "Extra Discount", Advertisement = "Newspaper" });
this.Add(new Order { Date = new DateTime(2010, 6, 7), Product = "Copy holder", Quantity = 25, Net = 168.25, Promotion = "Extra Discount", Advertisement = "Newspaper" });
this.Add(new Order { Date = new DateTime(2010, 6, 8), Product = "Copy holder", Quantity = 30, Net = 201.90, Promotion = "Extra Discount", Advertisement = "Newspaper" });
this.Add(new Order { Date = new DateTime(2010, 6, 9), Product = "Copy holder", Quantity = 15, Net = 100.95, Promotion = "Extra Discount", Advertisement = "Newspaper" });
this.Add(new Order { Date = new DateTime(2010, 6, 12), Product = "Copy holder", Quantity = 20, Net = 134.60, Promotion = "Extra Discount", Advertisement = "Newspaper" });
this.Add(new Order { Date = new DateTime(2010, 6, 13), Product = "Copy holder", Quantity = 11, Net = 85.47, Promotion = "1 Free with 10", Advertisement = "Magazine" });
this.Add(new Order { Date = new DateTime(2010, 6, 14), Product = "Copy holder", Quantity = 22, Net = 170.94, Promotion = "1 Free with 10", Advertisement = "Magazine" });
this.Add(new Order { Date = new DateTime(2010, 6, 15), Product = "Copy holder", Quantity = 22, Net = 170.94, Promotion = "1 Free with 10", Advertisement = "Magazine" });
this.Add(new Order { Date = new DateTime(2010, 6, 16), Product = "Copy holder", Quantity = 33, Net = 256.41, Promotion = "1 Free with 10", Advertisement = "Magazine" });
this.Add(new Order { Date = new DateTime(2010, 6, 21), Product = "Copy holder", Quantity = 22, Net = 170.94, Promotion = "1 Free with 10", Advertisement = "Magazine" });
this.Add(new Order { Date = new DateTime(2010, 6, 22), Product = "Copy holder", Quantity = 66, Net = 512.82, Promotion = "1 Free with 10", Advertisement = "Direct mail" });
this.Add(new Order { Date = new DateTime(2010, 6, 23), Product = "Copy holder", Quantity = 121, Net = 940.17, Promotion = "1 Free with 10", Advertisement = "Newspaper" });
this.Add(new Order { Date = new DateTime(2010, 6, 24), Product = "Copy holder", Quantity = 62, Net = 417.26, Promotion = "Extra Discount", Advertisement = "Magazine" });
this.Add(new Order { Date = new DateTime(2010, 6, 25), Product = "Copy holder", Quantity = 65, Net = 437.45, Promotion = "Extra Discount", Advertisement = "Direct mail" });
this.Add(new Order { Date = new DateTime(2010, 6, 26), Product = "Copy holder", Quantity = 21, Net = 141.33, Promotion = "Extra Discount", Advertisement = "Newspaper" });
this.Add(new Order { Date = new DateTime(2010, 7, 1), Product = "Printer stand", Quantity = 88, Net = 1053.36, Promotion = "1 Free with 10", Advertisement = "Magazine" });
this.Add(new Order { Date = new DateTime(2010, 7, 2), Product = "Printer stand", Quantity = 44, Net = 526.68, Promotion = "1 Free with 10", Advertisement = "Direct mail" });
this.Add(new Order { Date = new DateTime(2010, 7, 3), Product = "Printer stand", Quantity = 77, Net = 921.69, Promotion = "1 Free with 10", Advertisement = "Newspaper" });
this.Add(new Order { Date = new DateTime(2010, 7, 4), Product = "Printer stand", Quantity = 102, Net = 1057.74, Promotion = "Extra Discount", Advertisement = "Magazine" });
this.Add(new Order { Date = new DateTime(2010, 7, 5), Product = "Printer stand", Quantity = 60, Net = 622.20, Promotion = "Extra Discount", Advertisement = "Direct mail" });
this.Add(new Order { Date = new DateTime(2010, 7, 6), Product = "Printer stand", Quantity = 80, Net = 829.60, Promotion = "Extra Discount", Advertisement = "Newspaper" });
this.Add(new Order { Date = new DateTime(2010, 7, 7), Product = "Glare filter", Quantity = 110, Net = 1646.70, Promotion = "1 Free with 10", Advertisement = "Magazine" });
this.Add(new Order { Date = new DateTime(2010, 7, 8), Product = "Glare filter", Quantity = 77, Net = 1152.69, Promotion = "1 Free with 10", Advertisement = "Direct mail" });
this.Add(new Order { Date = new DateTime(2010, 7, 9), Product = "Glare filter", Quantity = 77, Net = 1152.69, Promotion = "1 Free with 10", Advertisement = "Newspaper" });
this.Add(new Order { Date = new DateTime(2010, 7, 10), Product = "Glare filter", Quantity = 124, Net = 1608.28, Promotion = "Extra Discount", Advertisement = "Magazine" });
this.Add(new Order { Date = new DateTime(2010, 7, 11), Product = "Glare filter", Quantity = 65, Net = 843.05, Promotion = "Extra Discount", Advertisement = "Direct mail" });
this.Add(new Order { Date = new DateTime(2010, 7, 12), Product = "Glare filter", Quantity = 130, Net = 1686.10, Promotion = "Extra Discount", Advertisement = "Newspaper" });
this.Add(new Order { Date = new DateTime(2010, 7, 13), Product = "Mouse pad", Quantity = 275, Net = 2136.75, Promotion = "1 Free with 10", Advertisement = "Magazine" });
this.Add(new Order { Date = new DateTime(2010, 7, 14), Product = "Mouse pad", Quantity = 121, Net = 940.17, Promotion = "1 Free with 10", Advertisement = "Direct mail" });
this.Add(new Order { Date = new DateTime(2010, 7, 15), Product = "Mouse pad", Quantity = 176, Net = 1367.52, Promotion = "1 Free with 10", Advertisement = "Newspaper" });
this.Add(new Order { Date = new DateTime(2010, 7, 16), Product = "Mouse pad", Quantity = 274, Net = 1844.02, Promotion = "Extra Discount", Advertisement = "Magazine" });
this.Add(new Order { Date = new DateTime(2010, 7, 17), Product = "Mouse pad", Quantity = 141, Net = 948.93, Promotion = "Extra Discount", Advertisement = "Direct mail" });
this.Add(new Order { Date = new DateTime(2010, 7, 18), Product = "Mouse pad", Quantity = 166, Net = 1117.18, Promotion = "Extra Discount", Advertisement = "Newspaper" });
this.Add(new Order { Date = new DateTime(2010, 7, 19), Product = "Copy holder", Quantity = 99, Net = 769.23, Promotion = "1 Free with 10", Advertisement = "Magazine" });
this.Add(new Order { Date = new DateTime(2010, 7, 20), Product = "Copy holder", Quantity = 55, Net = 427.35, Promotion = "1 Free with 10", Advertisement = "Direct mail" });
this.Add(new Order { Date = new DateTime(2010, 7, 21), Product = "Copy holder", Quantity = 132, Net = 1025.64, Promotion = "1 Free with 10", Advertisement = "Newspaper" });
this.Add(new Order { Date = new DateTime(2010, 7, 22), Product = "Copy holder", Quantity = 75, Net = 504.75, Promotion = "Extra Discount", Advertisement = "Magazine" });
this.Add(new Order { Date = new DateTime(2010, 7, 23), Product = "Copy holder", Quantity = 60, Net = 403.80, Promotion = "Extra Discount", Advertisement = "Direct mail" });
this.Add(new Order { Date = new DateTime(2010, 7, 24), Product = "Copy holder", Quantity = 88, Net = 592.24, Promotion = "Extra Discount", Advertisement = "Newspaper" });
this.Add(new Order { Date = new DateTime(2010, 8, 1), Product = "Printer stand", Quantity = 66, Net = 790.02, Promotion = "1 Free with 10", Advertisement = "Magazine" });
this.Add(new Order { Date = new DateTime(2010, 8, 2), Product = "Printer stand", Quantity = 44, Net = 526.68, Promotion = "1 Free with 10", Advertisement = "Direct mail" });
this.Add(new Order { Date = new DateTime(2010, 8, 3), Product = "Printer stand", Quantity = 33, Net = 395.01, Promotion = "1 Free with 10", Advertisement = "Newspaper" });
this.Add(new Order { Date = new DateTime(2010, 8, 4), Product = "Printer stand", Quantity = 90, Net = 933.30, Promotion = "Extra Discount", Advertisement = "Magazine" });
this.Add(new Order { Date = new DateTime(2010, 8, 5), Product = "Printer stand", Quantity = 20, Net = 207.40, Promotion = "Extra Discount", Advertisement = "Direct mail" });
this.Add(new Order { Date = new DateTime(2010, 8, 6), Product = "Printer stand", Quantity = 80, Net = 829.60, Promotion = "Extra Discount", Advertisement = "Newspaper" });
this.Add(new Order { Date = new DateTime(2010, 8, 7), Product = "Glare filter", Quantity = 88, Net = 1317.36, Promotion = "1 Free with 10", Advertisement = "Magazine" });
this.Add(new Order { Date = new DateTime(2010, 8, 8), Product = "Glare filter", Quantity = 44, Net = 658.68, Promotion = "1 Free with 10", Advertisement = "Direct mail" });
this.Add(new Order { Date = new DateTime(2010, 8, 9), Product = "Glare filter", Quantity = 33, Net = 494.01, Promotion = "1 Free with 10", Advertisement = "Newspaper" });
this.Add(new Order { Date = new DateTime(2010, 8, 10), Product = "Glare filter", Quantity = 87, Net = 1128.39, Promotion = "Extra Discount", Advertisement = "Magazine" });
this.Add(new Order { Date = new DateTime(2010, 8, 11), Product = "Glare filter", Quantity = 48, Net = 622.56, Promotion = "Extra Discount", Advertisement = "Direct mail" });
this.Add(new Order { Date = new DateTime(2010, 8, 12), Product = "Glare filter", Quantity = 95, Net = 1232.15, Promotion = "Extra Discount", Advertisement = "Newspaper" });
this.Add(new Order { Date = new DateTime(2010, 8, 13), Product = "Mouse pad", Quantity = 187, Net = 1452.99, Promotion = "1 Free with 10", Advertisement = "Magazine" });
this.Add(new Order { Date = new DateTime(2010, 8, 14), Product = "Mouse pad", Quantity = 99, Net = 769.23, Promotion = "1 Free with 10", Advertisement = "Direct mail" });
this.Add(new Order { Date = new DateTime(2010, 8, 15), Product = "Mouse pad", Quantity = 121, Net = 940.17, Promotion = "1 Free with 10", Advertisement = "Newspaper" });
this.Add(new Order { Date = new DateTime(2010, 8, 16), Product = "Mouse pad", Quantity = 198, Net = 1332.54, Promotion = "Extra Discount", Advertisement = "Magazine" });
this.Add(new Order { Date = new DateTime(2010, 8, 17), Product = "Mouse pad", Quantity = 104, Net = 699.92, Promotion = "Extra Discount", Advertisement = "Direct mail" });
this.Add(new Order { Date = new DateTime(2010, 8, 18), Product = "Mouse pad", Quantity = 144, Net = 969.12, Promotion = "Extra Discount", Advertisement = "Newspaper" });
this.Add(new Order { Date = new DateTime(2010, 8, 19), Product = "Copy holder", Quantity = 77, Net = 598.29, Promotion = "1 Free with 10", Advertisement = "Magazine" });
this.Add(new Order { Date = new DateTime(2010, 8, 20), Product = "Copy holder", Quantity = 33, Net = 256.41, Promotion = "1 Free with 10", Advertisement = "Direct mail" });
this.Add(new Order { Date = new DateTime(2010, 8, 21), Product = "Copy holder", Quantity = 44, Net = 341.88, Promotion = "1 Free with 10", Advertisement = "Newspaper" });
this.Add(new Order { Date = new DateTime(2010, 8, 22), Product = "Copy holder", Quantity = 57, Net = 383.61, Promotion = "Extra Discount", Advertisement = "Magazine" });
this.Add(new Order { Date = new DateTime(2010, 8, 23), Product = "Copy holder", Quantity = 38, Net = 255.74, Promotion = "Extra Discount", Advertisement = "Direct mail" });
this.Add(new Order { Date = new DateTime(2010, 8, 24), Product = "Copy holder", Quantity = 66, Net = 444.18, Promotion = "Extra Discount", Advertisement = "Newspaper" });
}
}
}

Просмотреть файл

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
</configuration>

Просмотреть файл

@ -0,0 +1,8 @@
<Application x:Class="CustomContextMenuBehavior.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
StartupUri="MainWindow.xaml">
<Application.Resources>
</Application.Resources>
</Application>

Просмотреть файл

@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
namespace CustomContextMenuBehavior
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
}
}

Просмотреть файл

@ -0,0 +1,8 @@
<Application xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="CustomContextMenuBehavior.App"
>
<Application.Resources>
</Application.Resources>
</Application>

Просмотреть файл

@ -0,0 +1,68 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
namespace CustomContextMenuBehavior
{
public partial class App : Application
{
public App()
{
this.Startup += this.Application_Startup;
this.Exit += this.Application_Exit;
this.UnhandledException += this.Application_UnhandledException;
InitializeComponent();
}
private void Application_Startup(object sender, StartupEventArgs e)
{
this.RootVisual = new MainPage();
}
private void Application_Exit(object sender, EventArgs e)
{
}
private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
{
// If the app is running outside of the debugger then report the exception using
// the browser's exception mechanism. On IE this will display it a yellow alert
// icon in the status bar and Firefox will display a script error.
if (!System.Diagnostics.Debugger.IsAttached)
{
// NOTE: This will allow the application to continue running after an exception has been thrown
// but not handled.
// For production applications this error handling should be replaced with something that will
// report the error to the website and stop the application.
e.Handled = true;
Deployment.Current.Dispatcher.BeginInvoke(delegate { ReportErrorToDOM(e); });
}
}
private void ReportErrorToDOM(ApplicationUnhandledExceptionEventArgs e)
{
try
{
string errorMsg = e.ExceptionObject.Message + e.ExceptionObject.StackTrace;
errorMsg = errorMsg.Replace('"', '\'').Replace("\r\n", @"\n");
System.Windows.Browser.HtmlPage.Window.Eval("throw new Error(\"Unhandled Error in Silverlight Application " + errorMsg + "\");");
}
catch (Exception)
{
}
}
}
}

Просмотреть файл

@ -0,0 +1,40 @@
using System;
using System.Windows;
using System.Windows.Controls;
using Telerik.Pivot.Core;
using Telerik.Windows.Controls;
namespace CustomContextMenuBehavior
{
public class CellTemplateSelector : DataTemplateSelector
{
public DataTemplate LowerValueTemplate { get; set; }
public DataTemplate HigherValueTemplate { get; set; }
public double LimitValue { get; set; }
public string PropertyName { get; set; }
public override DataTemplate SelectTemplate(object item, DependencyObject container)
{
var cellAggregate = item as CellAggregateValue;
if (cellAggregate != null)
{
var description = cellAggregate.Description as PropertyAggregateDescription;
if (description.PropertyName == this.PropertyName && cellAggregate.RowGroup.Type == GroupType.BottomLevel && cellAggregate.ColumnGroup.Type == GroupType.BottomLevel)
{
if (Convert.ToDouble(cellAggregate.Value) >= this.LimitValue)
{
return this.HigherValueTemplate;
}
else
{
return this.LowerValueTemplate;
}
}
}
return base.SelectTemplate(item, container);
}
}
}

Просмотреть файл

@ -0,0 +1,39 @@
<telerik:RadWindow x:Class="CustomContextMenuBehavior.CellTemplateSettingsWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
mc:Ignorable="d"
Header="Cell Color Settings"
WindowStartupLocation="CenterScreen"
d:DesignHeight="300" d:DesignWidth="300">
<Grid x:Name="LayoutRoot" Background="#FFD9F1F9">
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Row="2" Grid.Column="0" Margin="10" Text="Lower Values Color:" FontWeight="Light" FontFamily="Verdana" FontStyle="Italic" FontSize="13" HorizontalAlignment="Left" VerticalAlignment="Center" />
<telerik:RadColorPicker x:Name="LowerValueColorPicker" Grid.Row="2" Grid.Column="1" Margin="10" HeaderPaletteVisibility="Collapsed" SelectedColor="Red" HorizontalAlignment="Right" VerticalAlignment="Center" />
<TextBlock Grid.Row="1" Grid.Column="0" Margin="10" Text="Limit Value:" FontWeight="Light" FontFamily="Verdana" FontStyle="Italic" FontSize="13" VerticalAlignment="Center" />
<telerik:RadNumericUpDown x:Name="Numeric" Value="500" Grid.Row="1" Grid.Column="1" Margin="10" UpdateValueEvent="PropertyChanged" TabIndex="0" Minimum="100" Maximum="5000" LargeChange="500" SmallChange="100" HorizontalAlignment="Right" Width="100" />
<TextBlock Grid.Row="0" Margin="10" Grid.Column="0" Text="Higher Values Color:" FontWeight="Light" VerticalAlignment="Center" FontFamily="Verdana" FontStyle="Italic" FontSize="13" />
<telerik:RadColorPicker x:Name="HigherValueColorPicker" Grid.Row="0" Margin="10" Grid.Column="1" HeaderPaletteVisibility="Collapsed" SelectedColor="Green" HorizontalAlignment="Right" />
<Border x:Name="HorizontalRule" Grid.Row="3" Grid.ColumnSpan="2" BorderThickness="0 0 0 1" Height="2" Background="Gray" VerticalAlignment="Top"/>
<StackPanel x:Name="DialogButtons" Grid.Row="4" Grid.ColumnSpan="2" Orientation="Horizontal" HorizontalAlignment="Right">
<telerik:RadButton x:Name="OK" Click="OK_Click" Content="OK" telerik:RadWindow.ResponseButton="Accept" MinWidth="70" IsTabStop="True" TabIndex="1" HorizontalAlignment="Right" Margin="0 10 8 8" />
<telerik:RadButton x:Name="Cancel" Click="Cancel_Click" Content="Cancel" telerik:RadWindow.ResponseButton="Cancel" MinWidth="70" IsTabStop="True" TabIndex="2" HorizontalAlignment="Right" Margin="0 10 8 8"/>
</StackPanel>
</Grid>
</telerik:RadWindow>

Просмотреть файл

@ -0,0 +1,36 @@
using System.Windows;
using Telerik.Windows.Controls;
namespace CustomContextMenuBehavior
{
/// <summary>
/// Interaction logic for CellTemplateSettingsWindow.xaml
/// </summary>
public partial class CellTemplateSettingsWindow : RadWindow
{
private bool dialogResult;
public CellTemplateSettingsWindow()
{
InitializeComponent();
}
protected override void OnClosed(WindowClosedEventArgs args)
{
var newArgs = new WindowClosedEventArgs { DialogResult = this.dialogResult, PromptResult = this.Numeric.Value.ToString() };
base.OnClosed(newArgs);
}
private void OK_Click(object sender, RoutedEventArgs e)
{
this.dialogResult = true;
this.Close();
}
private void Cancel_Click(object sender, RoutedEventArgs e)
{
this.dialogResult = false;
this.Close();
}
}
}

Просмотреть файл

@ -0,0 +1,167 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.50727</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{3971312C-623A-49D8-AF47-4073BA32507E}</ProjectGuid>
<ProjectTypeGuids>{A1591282-1198-4647-A2B1-27E5FF5F6F3B};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>CustomContextMenuBehavior</RootNamespace>
<AssemblyName>CustomContextMenuBehavior</AssemblyName>
<TargetFrameworkIdentifier>Silverlight</TargetFrameworkIdentifier>
<TargetFrameworkVersion>v5.0</TargetFrameworkVersion>
<SilverlightVersion>$(TargetFrameworkVersion)</SilverlightVersion>
<SilverlightApplication>true</SilverlightApplication>
<SupportedCultures>
</SupportedCultures>
<XapOutputs>true</XapOutputs>
<GenerateSilverlightManifest>true</GenerateSilverlightManifest>
<XapFilename>CustomContextMenuBehavior.xap</XapFilename>
<SilverlightManifestTemplate>Properties\AppManifest.xml</SilverlightManifestTemplate>
<SilverlightAppEntry>CustomContextMenuBehavior.App</SilverlightAppEntry>
<TestPageFileName>CustomContextMenuBehaviorTestPage.html</TestPageFileName>
<CreateTestPage>true</CreateTestPage>
<ValidateXaml>true</ValidateXaml>
<EnableOutOfBrowser>false</EnableOutOfBrowser>
<OutOfBrowserSettingsFile>Properties\OutOfBrowserSettings.xml</OutOfBrowserSettingsFile>
<UsePlatformExtensions>false</UsePlatformExtensions>
<ThrowErrorsInValidation>true</ThrowErrorsInValidation>
<LinkedServerProject>
</LinkedServerProject>
</PropertyGroup>
<!-- This property group is only here to support building this project using the
MSBuild 3.5 toolset. In order to work correctly with this older toolset, it needs
to set the TargetFrameworkVersion to v3.5 -->
<PropertyGroup Condition="'$(MSBuildToolsVersion)' == '3.5'">
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>Bin\Debug</OutputPath>
<DefineConstants>DEBUG;TRACE;SILVERLIGHT</DefineConstants>
<NoStdLib>true</NoStdLib>
<NoConfig>true</NoConfig>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>Bin\Release</OutputPath>
<DefineConstants>TRACE;SILVERLIGHT</DefineConstants>
<NoStdLib>true</NoStdLib>
<NoConfig>true</NoConfig>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="mscorlib" />
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.Windows" />
<Reference Include="system" />
<Reference Include="System.Core">
<HintPath>$(TargetFrameworkDirectory)System.Core.dll</HintPath>
</Reference>
<Reference Include="System.Net" />
<Reference Include="System.Xml" />
<Reference Include="System.Windows.Browser" />
<Reference Include="Telerik.Pivot.Core, Version=2013.3.1204.1050, Culture=neutral, PublicKeyToken=5803cfa389c90ce7, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>$(TELERIKSLDIR)\Binaries\Silverlight\Telerik.Pivot.Core.dll</HintPath>
</Reference>
<Reference Include="Telerik.Windows.Controls, Version=2013.3.1204.1050, Culture=neutral, PublicKeyToken=5803cfa389c90ce7, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>$(TELERIKSLDIR)\Binaries\Silverlight\Telerik.Windows.Controls.dll</HintPath>
</Reference>
<Reference Include="Telerik.Windows.Controls.Input, Version=2013.3.1204.1050, Culture=neutral, PublicKeyToken=5803cfa389c90ce7, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>$(TELERIKSLDIR)\Binaries\Silverlight\Telerik.Windows.Controls.Input.dll</HintPath>
</Reference>
<Reference Include="Telerik.Windows.Controls.Navigation, Version=2013.3.1204.1050, Culture=neutral, PublicKeyToken=5803cfa389c90ce7, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>$(TELERIKSLDIR)\Binaries\Silverlight\Telerik.Windows.Controls.Navigation.dll</HintPath>
</Reference>
<Reference Include="Telerik.Windows.Controls.Pivot, Version=2013.3.1204.1050, Culture=neutral, PublicKeyToken=5803cfa389c90ce7, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>$(TELERIKSLDIR)\Binaries\Silverlight\Telerik.Windows.Controls.Pivot.dll</HintPath>
</Reference>
<Reference Include="Telerik.Windows.Controls.PivotFieldList, Version=2013.3.1204.1050, Culture=neutral, PublicKeyToken=5803cfa389c90ce7, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>$(TELERIKSLDIR)\Binaries\Silverlight\Telerik.Windows.Controls.PivotFieldList.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="AllOrders.cs" />
<Compile Include="App_SL.xaml.cs">
<DependentUpon>App_SL.xaml</DependentUpon>
</Compile>
<Compile Include="CellTemplateSelector.cs" />
<Compile Include="CellTemplateSettingsWindow.xaml.cs">
<DependentUpon>CellTemplateSettingsWindow.xaml</DependentUpon>
</Compile>
<Compile Include="Example.xaml.cs">
<DependentUpon>Example.xaml</DependentUpon>
</Compile>
<Compile Include="MainPage.xaml.cs">
<DependentUpon>MainPage.xaml</DependentUpon>
</Compile>
<Compile Include="MyCustomContextMenuBehavior.cs" />
<Compile Include="Order.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="StepSettingsWindow.xaml.cs">
<DependentUpon>StepSettingsWindow.xaml</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<Page Include="App_SL.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="CellTemplateSettingsWindow.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Example.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="MainPage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="StepSettingsWindow.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
</ItemGroup>
<ItemGroup>
<None Include="Properties\AppManifest.xml" />
</ItemGroup>
<ItemGroup>
<Content Include="Readme.txt" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Silverlight\$(SilverlightVersion)\Microsoft.Silverlight.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
<ProjectExtensions>
<VisualStudio>
<FlavorProperties GUID="{A1591282-1198-4647-A2B1-27E5FF5F6F3B}">
<SilverlightProjectProperties />
</FlavorProperties>
</VisualStudio>
</ProjectExtensions>
</Project>

Просмотреть файл

@ -0,0 +1,168 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{08485209-7167-4FC5-AA2B-1B5826D7745C}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>CustomContextMenuBehavior</RootNamespace>
<AssemblyName>CustomContextMenuBehavior</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<StartupObject>
</StartupObject>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Xaml">
<RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
<Reference Include="Telerik.Pivot.Core, Version=2013.3.1204.45, Culture=neutral, PublicKeyToken=5803cfa389c90ce7, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>$(TELERIKWPFDIR)\Binaries\WPF40\Telerik.Pivot.Core.dll</HintPath>
</Reference>
<Reference Include="Telerik.Windows.Controls, Version=2013.3.1204.45, Culture=neutral, PublicKeyToken=5803cfa389c90ce7, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>$(TELERIKWPFDIR)\Binaries\WPF40\Telerik.Windows.Controls.dll</HintPath>
</Reference>
<Reference Include="Telerik.Windows.Controls.Input, Version=2013.3.1204.45, Culture=neutral, PublicKeyToken=5803cfa389c90ce7, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>$(TELERIKWPFDIR)\Binaries\WPF40\Telerik.Windows.Controls.Input.dll</HintPath>
</Reference>
<Reference Include="Telerik.Windows.Controls.Navigation, Version=2013.3.1204.45, Culture=neutral, PublicKeyToken=5803cfa389c90ce7, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>$(TELERIKWPFDIR)\Binaries\WPF40\Telerik.Windows.Controls.Navigation.dll</HintPath>
</Reference>
<Reference Include="Telerik.Windows.Controls.Pivot, Version=2013.3.1204.45, Culture=neutral, PublicKeyToken=5803cfa389c90ce7, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>$(TELERIKWPFDIR)\Binaries\WPF40\Telerik.Windows.Controls.Pivot.dll</HintPath>
</Reference>
<Reference Include="Telerik.Windows.Controls.PivotFieldList, Version=2013.3.1204.45, Culture=neutral, PublicKeyToken=5803cfa389c90ce7, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>$(TELERIKWPFDIR)\Binaries\WPF40\Telerik.Windows.Controls.PivotFieldList.dll</HintPath>
</Reference>
<Reference Include="Telerik.Windows.Data, Version=2013.3.1204.45, Culture=neutral, PublicKeyToken=5803cfa389c90ce7, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>$(TELERIKWPFDIR)\Binaries\WPF40\Telerik.Windows.Data.dll</HintPath>
</Reference>
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
</ItemGroup>
<ItemGroup>
<ApplicationDefinition Include="App.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Compile Include="StepSettingsWindow.xaml.cs">
<DependentUpon>StepSettingsWindow.xaml</DependentUpon>
</Compile>
<Page Include="CellTemplateSettingsWindow.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Example.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="MainWindow.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Compile Include="AllOrders.cs" />
<Compile Include="App.xaml.cs">
<DependentUpon>App.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="CellTemplateSelector.cs" />
<Compile Include="CellTemplateSettingsWindow.xaml.cs">
<DependentUpon>CellTemplateSettingsWindow.xaml</DependentUpon>
</Compile>
<Compile Include="MyCustomContextMenuBehavior.cs" />
<Compile Include="Example.xaml.cs">
<DependentUpon>Example.xaml</DependentUpon>
</Compile>
<Compile Include="MainWindow.xaml.cs">
<DependentUpon>MainWindow.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Page Include="StepSettingsWindow.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
<ItemGroup>
<Compile Include="Order.cs" />
<Compile Include="Properties\AssemblyInfo.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<AppDesigner Include="Properties\" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<Resource Include="Readme.txt" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

Просмотреть файл

@ -0,0 +1,43 @@
<UserControl x:Class="CustomContextMenuBehavior.Example"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:pivot="http://schemas.telerik.com/2008/xaml/presentation/pivot"
xmlns:local="clr-namespace:CustomContextMenuBehavior"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300">
<UserControl.Resources>
<pivot:LocalDataSourceProvider x:Key="LocalDataProvider">
<pivot:LocalDataSourceProvider.ItemsSource>
<local:AllOrders />
</pivot:LocalDataSourceProvider.ItemsSource>
<pivot:LocalDataSourceProvider.RowGroupDescriptions>
<pivot:PropertyGroupDescription PropertyName="Product" />
<pivot:DateTimeGroupDescription PropertyName="Date" Step="Month" />
<pivot:DoubleGroupDescription PropertyName="Quantity" Step="300" />
</pivot:LocalDataSourceProvider.RowGroupDescriptions>
<pivot:LocalDataSourceProvider.ColumnGroupDescriptions>
<pivot:PropertyGroupDescription PropertyName="Advertisement" />
<pivot:PropertyGroupDescription PropertyName="Promotion" />
</pivot:LocalDataSourceProvider.ColumnGroupDescriptions>
<pivot:LocalDataSourceProvider.AggregateDescriptions>
<pivot:PropertyAggregateDescription PropertyName="Net" />
<pivot:PropertyAggregateDescription PropertyName="Quantity"/>
</pivot:LocalDataSourceProvider.AggregateDescriptions>
</pivot:LocalDataSourceProvider>
</UserControl.Resources>
<Grid x:Name="LayoutRoot">
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="300" />
</Grid.ColumnDefinitions>
<pivot:RadPivotGrid x:Name="radPivotGrid" DataProvider="{StaticResource LocalDataProvider}" Grid.Row="0" Grid.Column="0" />
<pivot:RadPivotFieldList x:Name="radPivotFieldList" DataProvider="{StaticResource LocalDataProvider}" Grid.Row="0" Grid.Column="1" />
<TextBlock Grid.Row="1" Grid.ColumnSpan="2" Text="{Binding ReadMe}" Padding="10" FontStyle="Italic" />
</Grid>
</UserControl>

Просмотреть файл

@ -0,0 +1,33 @@
using System.Windows.Controls;
using Telerik.Windows.Controls.FieldList;
namespace CustomContextMenuBehavior
{
/// <summary>
/// Interaction logic for Example.xaml
/// </summary>
public partial class Example : UserControl
{
public string ReadMe { get; set; }
public Example()
{
InitializeComponent();
this.ReadMe = GetText();
this.DataContext = this;
var customContextMenuBehavior = new MyCustomContextMenuBehavior();
customContextMenuBehavior.Pivot = this.radPivotGrid;
FieldListContextMenuBehavior.SetBehavior(this.radPivotFieldList, customContextMenuBehavior);
}
private string GetText()
{
return @"This example demonstrates how to implement a custom ContextMenuBehavior, which will allow you to modify the ContextMenus in RadPivotFieldList.
The following scenarios are covered in the example:
- The Label Filter of the PropertyGroupDescription items is removed
- There is option added to change the step of the DoubleGroupDescription items
- There is option added to color the cells of the AggregateDescription items depending on some condition";
}
}
}

Просмотреть файл

@ -0,0 +1,13 @@
<UserControl x:Class="CustomContextMenuBehavior.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:CustomContextMenuBehavior"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="400">
<Grid x:Name="LayoutRoot" Background="White">
<local:Example />
</Grid>
</UserControl>

Просмотреть файл

@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
namespace CustomContextMenuBehavior
{
public partial class MainPage : UserControl
{
public MainPage()
{
InitializeComponent();
}
}
}

Просмотреть файл

@ -0,0 +1,10 @@
<Window x:Class="CustomContextMenuBehavior.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:CustomContextMenuBehavior"
WindowState="Maximized"
Title="MainWindow" Height="350" Width="525">
<Grid>
<local:Example />
</Grid>
</Window>

Просмотреть файл

@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace CustomContextMenuBehavior
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
}
}

Просмотреть файл

@ -0,0 +1,142 @@
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Input;
using System.Windows.Markup;
using System.Windows.Media;
using Telerik.Pivot.Core;
using Telerik.Windows.Controls;
using Telerik.Windows.Controls.FieldList;
namespace CustomContextMenuBehavior
{
public class MyCustomContextMenuBehavior : FieldListContextMenuBehavior
{
private bool isCellTemplateSelectorSet;
public MyCustomContextMenuBehavior()
: base()
{
this.RemoveColorsCommand = new DelegateCommand(OnRemoveColoringExecute, canExecute => this.isCellTemplateSelectorSet);
}
public RadPivotGrid Pivot { get; set; }
public ICommand RemoveColorsCommand { get; set; }
protected override RadContextMenu CreateContextMenu(object dataContext)
{
var contextMenu = base.CreateContextMenu(dataContext);
if (dataContext is Telerik.Pivot.Core.PropertyGroupDescription)
{
var itemToRemove = contextMenu.Items.Cast<RadMenuItem>().FirstOrDefault(i => (i as RadMenuItem).Header != null && (i as RadMenuItem).Header.Equals("Label Filter"));
if (itemToRemove != null)
{
contextMenu.Items.Remove(itemToRemove);
}
}
if (dataContext is DoubleGroupDescription)
{
contextMenu.Items.Add(new RadMenuSeparatorItem());
contextMenu.Items.Add(new RadMenuItem { Header = "Change the Step", Command = new DelegateCommand(OnChangeStepExecute), CommandParameter = dataContext });
}
if (dataContext is AggregateDescriptionBase)
{
contextMenu.Items.Add(new RadMenuSeparatorItem());
contextMenu.Items.Add(new RadMenuItem { Header = "Color Cells", Command = new DelegateCommand(OnColorCellsExecute), CommandParameter = dataContext });
contextMenu.Items.Add(new RadMenuItem { Header = "Remove Coloring", Command = this.RemoveColorsCommand });
}
return contextMenu;
}
private void OnColorCellsExecute(object obj)
{
var cellTemplateSettingsWindow = new CellTemplateSettingsWindow();
cellTemplateSettingsWindow.Closed += (s, e) =>
{
if (e.DialogResult == true)
{
var selector = new CellTemplateSelector();
selector.LowerValueTemplate = this.CreateDataTemplate(cellTemplateSettingsWindow.LowerValueColorPicker.SelectedColor);
selector.HigherValueTemplate = this.CreateDataTemplate(cellTemplateSettingsWindow.HigherValueColorPicker.SelectedColor);
var groupDesc = obj as PropertyAggregateDescription;
selector.PropertyName = groupDesc.PropertyName;
selector.LimitValue = double.Parse(e.PromptResult);
this.Pivot.CellTemplateSelector = null;
this.Pivot.CellTemplateSelector = selector;
this.isCellTemplateSelectorSet = true;
(this.RemoveColorsCommand as DelegateCommand).InvalidateCanExecute();
}
};
cellTemplateSettingsWindow.ShowDialog();
}
private void OnRemoveColoringExecute(object obj)
{
this.Pivot.CellTemplateSelector = null;
this.isCellTemplateSelectorSet = false;
(this.RemoveColorsCommand as DelegateCommand).InvalidateCanExecute();
}
private void OnChangeStepExecute(object obj)
{
var groupDesc = obj as DoubleGroupDescription;
var settingsWindow = new StepSettingsWindow(groupDesc.Step);
settingsWindow.Closed += (s, e) =>
{
if (e.DialogResult == true)
{
groupDesc.Step = int.Parse(e.PromptResult);
if (!this.Pivot.DataProvider.DeferUpdates)
{
this.Pivot.DataProvider.Refresh();
}
}
};
settingsWindow.ShowDialog();
}
private DataTemplate CreateDataTemplate(Color color)
{
#if SILVERLIGHT
return (DataTemplate)XamlReader.Load(
@"<DataTemplate xmlns=""http://schemas.microsoft.com/client/2007"">
<Border BorderThickness=""1 1 0 0"" BorderBrush=""LightGray"" Background=""" + color.ToString() + @""">
<TextBlock Text=""{Binding Data, Mode=OneWay}"" Margin=""4"" VerticalAlignment=""Center"" HorizontalAlignment=""Right""/>
</Border>
</DataTemplate>"
);
#else
FrameworkElementFactory border = new FrameworkElementFactory(typeof(Border));
border.SetValue(Border.BorderThicknessProperty, new Thickness(1, 1, 0, 0));
border.SetValue(Border.BorderBrushProperty, Brushes.LightGray);
border.SetValue(Border.BackgroundProperty, new SolidColorBrush(color));
DataTemplate dataTemplate = new DataTemplate();
dataTemplate.VisualTree = border;
FrameworkElementFactory textBlock = new FrameworkElementFactory(typeof(TextBlock));
textBlock.SetBinding(TextBlock.TextProperty, new Binding("Data"));
textBlock.SetValue(TextBlock.MarginProperty, new Thickness(2));
textBlock.SetValue(TextBlock.VerticalAlignmentProperty, VerticalAlignment.Center);
textBlock.SetValue(TextBlock.HorizontalAlignmentProperty, HorizontalAlignment.Right);
border.AppendChild(textBlock);
dataTemplate.Seal();
return dataTemplate;
#endif
}
}
}

Просмотреть файл

@ -0,0 +1,123 @@
using System;
using System.ComponentModel;
namespace CustomContextMenuBehavior
{
public class Order : INotifyPropertyChanged
{
private DateTime date;
private string product;
private int quantity;
private double net;
private string promotion;
private string advertisement;
public DateTime Date
{
get
{
return this.date;
}
set
{
if (this.date != value)
{
this.date = value;
OnPropertyChanged("Date");
}
}
}
public string Product
{
get
{
return this.product;
}
set
{
if (this.product != value)
{
this.product = value;
OnPropertyChanged("Product");
}
}
}
public int Quantity
{
get
{
return this.quantity;
}
set
{
if (this.quantity != value)
{
this.quantity = value;
OnPropertyChanged("Quantity");
}
}
}
public double Net
{
get
{
return this.net;
}
set
{
if (this.net != value)
{
this.net = value;
OnPropertyChanged("Net");
}
}
}
public string Promotion
{
get
{
return this.promotion;
}
set
{
if (this.promotion != value)
{
this.promotion = value;
OnPropertyChanged("Promotion");
}
}
}
public string Advertisement
{
get
{
return this.advertisement;
}
set
{
if (this.advertisement != value)
{
this.advertisement = value;
OnPropertyChanged("Advertisement");
}
}
}
public event PropertyChangedEventHandler PropertyChanged;
protected void OnPropertyChanged(string name)
{
PropertyChangedEventHandler handler = PropertyChanged;
if (handler != null)
{
handler(this, new PropertyChangedEventArgs(name));
}
}
}
}

Просмотреть файл

@ -0,0 +1,6 @@
<Deployment xmlns="http://schemas.microsoft.com/client/2007/deployment"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
>
<Deployment.Parts>
</Deployment.Parts>
</Deployment>

Просмотреть файл

@ -0,0 +1,35 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("CustomContextMenuBehavior")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CustomContextMenuBehavior")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("3971312c-623a-49d8-af47-4073ba32507e")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

71
PivotGrid/CustomContextMenuBehavior/Properties/Resources.Designer.cs сгенерированный Normal file
Просмотреть файл

@ -0,0 +1,71 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.18408
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace CustomContextMenuBehavior.Properties
{
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources
{
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources()
{
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager
{
get
{
if ((resourceMan == null))
{
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("CustomContextMenuBehavior.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture
{
get
{
return resourceCulture;
}
set
{
resourceCulture = value;
}
}
}
}

Просмотреть файл

@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

30
PivotGrid/CustomContextMenuBehavior/Properties/Settings.Designer.cs сгенерированный Normal file
Просмотреть файл

@ -0,0 +1,30 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.18408
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace CustomContextMenuBehavior.Properties
{
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
{
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default
{
get
{
return defaultInstance;
}
}
}
}

Просмотреть файл

@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>

Просмотреть файл

@ -0,0 +1,6 @@
#Custom ContextMenuBehavior#
This example demonstrates how to implement a custom ContextMenuBehavior, which will allow you to modify the ContextMenus in RadPivotFieldList.
The following scenarios are covered in the example:
- The Label Filter of the PropertyGroupDescription items is removed
- There is option added to change the step of the DoubleGroupDescription items
- There is option added to color the cells of the AggregateDescription items depending on some condition

Просмотреть файл

@ -0,0 +1,31 @@
<telerik:RadWindow x:Class="CustomContextMenuBehavior.StepSettingsWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300"
WindowStartupLocation="CenterScreen"
Header="Description Step Settings"
Width="350">
<Grid x:Name="LayoutRoot" Background="#FFD9F1F9">
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<StackPanel Grid.Row="0" Grid.Column="1" Margin="10">
<TextBlock Margin="0 0 0 10" Text="Please select the desired Step (100-5000):" FontWeight="Light" FontFamily="Verdana" FontStyle="Italic" FontSize="13" />
<telerik:RadNumericUpDown x:Name="Numeric" UpdateValueEvent="PropertyChanged" TabIndex="0" Minimum="100" Maximum="5000" IsInteger="True" LargeChange="500" SmallChange="100" />
</StackPanel>
<Border x:Name="HorizontalRule" Grid.Row="1" Grid.ColumnSpan="2" BorderThickness="0 0 0 1" Height="2" Background="Gray" VerticalAlignment="Top"/>
<StackPanel x:Name="DialogButtons" Grid.Row="2" Grid.ColumnSpan="2" Orientation="Horizontal" HorizontalAlignment="Right">
<telerik:RadButton x:Name="OK" Click="OK_Click" Content="OK" telerik:RadWindow.ResponseButton="Accept" MinWidth="70" IsTabStop="True" TabIndex="1" HorizontalAlignment="Right" Margin="0 10 8 8" />
<telerik:RadButton x:Name="Cancel" Click="Cancel_Click" Content="Cancel" telerik:RadWindow.ResponseButton="Cancel" MinWidth="70" IsTabStop="True" TabIndex="2" HorizontalAlignment="Right" Margin="0 10 8 8"/>
</StackPanel>
</Grid>
</telerik:RadWindow>

Просмотреть файл

@ -0,0 +1,35 @@
using System.Windows;
using Telerik.Windows.Controls;
namespace CustomContextMenuBehavior
{
public partial class StepSettingsWindow : RadWindow
{
private bool dialogResult;
internal double Step { get; set; }
public StepSettingsWindow(double step)
{
InitializeComponent();
this.Numeric.Value = step;
}
protected override void OnClosed(WindowClosedEventArgs args)
{
var newArgs = new WindowClosedEventArgs { DialogResult = this.dialogResult, PromptResult = this.Numeric.Value.ToString() };
base.OnClosed(newArgs);
}
private void OK_Click(object sender, RoutedEventArgs e)
{
this.dialogResult = true;
this.Close();
}
private void Cancel_Click(object sender, RoutedEventArgs e)
{
this.dialogResult = false;
this.Close();
}
}
}

Просмотреть файл

@ -1,6 +1,8 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
# Visual Studio 2013
VisualStudioVersion = 12.0.21005.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LocalDataSourcePersistence_SL", "Persistence\LocalDataSourceProvider\LocalDataSourcePersistence_SL.csproj", "{1D330BF9-D365-4CC0-9A10-98874BB98404}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XmlaPersistence_SL", "Persistence\XmlaPersistence\XmlaPersistence_SL.csproj", "{0A3C6B7E-63FA-443C-B530-97606E31878A}"
@ -29,6 +31,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LocalDataSourceCalculatedFi
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LocalDataSourceCalculatedItems_SL", "CalculatedItems\LocalDataSourceCalculatedItems\LocalDataSourceCalculatedItems_SL.csproj", "{6422C1C3-28CA-4560-85E8-DE77B5A2301C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CustomContextMenuBehavior_SL", "CustomContextMenuBehavior\CustomContextMenuBehavior_SL.csproj", "{3971312C-623A-49D8-AF47-4073BA32507E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -92,6 +96,10 @@ Global
{6422C1C3-28CA-4560-85E8-DE77B5A2301C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6422C1C3-28CA-4560-85E8-DE77B5A2301C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6422C1C3-28CA-4560-85E8-DE77B5A2301C}.Release|Any CPU.Build.0 = Release|Any CPU
{3971312C-623A-49D8-AF47-4073BA32507E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3971312C-623A-49D8-AF47-4073BA32507E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3971312C-623A-49D8-AF47-4073BA32507E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3971312C-623A-49D8-AF47-4073BA32507E}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

Просмотреть файл

@ -39,6 +39,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QueryableCalculatedFields_W
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QueryableCalculatedItems_WPF", "CalculatedItems\QueryableCalculatedItems\QueryableCalculatedItems_WPF.csproj", "{F2FFB684-83F5-4591-9082-920DC64FEA0B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CustomContextMenuBehavior_WPF", "CustomContextMenuBehavior\CustomContextMenuBehavior_WPF.csproj", "{08485209-7167-4FC5-AA2B-1B5826D7745C}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -118,6 +120,10 @@ Global
{F2FFB684-83F5-4591-9082-920DC64FEA0B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F2FFB684-83F5-4591-9082-920DC64FEA0B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F2FFB684-83F5-4591-9082-920DC64FEA0B}.Release|Any CPU.Build.0 = Release|Any CPU
{08485209-7167-4FC5-AA2B-1B5826D7745C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{08485209-7167-4FC5-AA2B-1B5826D7745C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{08485209-7167-4FC5-AA2B-1B5826D7745C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{08485209-7167-4FC5-AA2B-1B5826D7745C}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

Просмотреть файл

@ -35,6 +35,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ChangeRibbonUIDataContext_S
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DataBinding_SL", "DataBinding\DataBinding_SL.csproj", "{CF815898-F41C-4AEC-BE07-C6124A0B867A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SimulateWatermark_SL", "SimulateWatermark\SimulateWatermark_SL.csproj", "{BE866F9D-1763-460D-B3F8-56652B9308BD}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -110,6 +112,10 @@ Global
{CF815898-F41C-4AEC-BE07-C6124A0B867A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CF815898-F41C-4AEC-BE07-C6124A0B867A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CF815898-F41C-4AEC-BE07-C6124A0B867A}.Release|Any CPU.Build.0 = Release|Any CPU
{BE866F9D-1763-460D-B3F8-56652B9308BD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BE866F9D-1763-460D-B3F8-56652B9308BD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BE866F9D-1763-460D-B3F8-56652B9308BD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BE866F9D-1763-460D-B3F8-56652B9308BD}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

Просмотреть файл

@ -41,6 +41,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ThreadSafeDocumentConversio
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DataBinding_WPF", "DataBinding\DataBinding_WPF.csproj", "{F3A661C5-6BFC-497A-BFA2-ECA2ECDEAB1C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SimulateWatermark_WPF", "SimulateWatermark\SimulateWatermark_WPF.csproj", "{0A2CE792-9EA5-4CC8-930D-2A7B87315FBA}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -252,6 +254,16 @@ Global
{F3A661C5-6BFC-497A-BFA2-ECA2ECDEAB1C}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{F3A661C5-6BFC-497A-BFA2-ECA2ECDEAB1C}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{F3A661C5-6BFC-497A-BFA2-ECA2ECDEAB1C}.Release|x86.ActiveCfg = Release|Any CPU
{0A2CE792-9EA5-4CC8-930D-2A7B87315FBA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0A2CE792-9EA5-4CC8-930D-2A7B87315FBA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0A2CE792-9EA5-4CC8-930D-2A7B87315FBA}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{0A2CE792-9EA5-4CC8-930D-2A7B87315FBA}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{0A2CE792-9EA5-4CC8-930D-2A7B87315FBA}.Debug|x86.ActiveCfg = Debug|Any CPU
{0A2CE792-9EA5-4CC8-930D-2A7B87315FBA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0A2CE792-9EA5-4CC8-930D-2A7B87315FBA}.Release|Any CPU.Build.0 = Release|Any CPU
{0A2CE792-9EA5-4CC8-930D-2A7B87315FBA}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{0A2CE792-9EA5-4CC8-930D-2A7B87315FBA}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{0A2CE792-9EA5-4CC8-930D-2A7B87315FBA}.Release|x86.ActiveCfg = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

Просмотреть файл

@ -0,0 +1,8 @@
<Application x:Class="SimulateWatermark.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
StartupUri="MainWindow.xaml">
<Application.Resources>
</Application.Resources>
</Application>

Просмотреть файл

@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Windows;
namespace SimulateWatermark
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
}
}

Просмотреть файл

@ -0,0 +1,8 @@
<Application xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="SimulateWatermark.App"
>
<Application.Resources>
</Application.Resources>
</Application>

Просмотреть файл

@ -0,0 +1,68 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
namespace SimulateWatermark
{
public partial class App : Application
{
public App()
{
this.Startup += this.Application_Startup;
this.Exit += this.Application_Exit;
this.UnhandledException += this.Application_UnhandledException;
InitializeComponent();
}
private void Application_Startup(object sender, StartupEventArgs e)
{
this.RootVisual = new MainPage();
}
private void Application_Exit(object sender, EventArgs e)
{
}
private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
{
// If the app is running outside of the debugger then report the exception using
// the browser's exception mechanism. On IE this will display it a yellow alert
// icon in the status bar and Firefox will display a script error.
if (!System.Diagnostics.Debugger.IsAttached)
{
// NOTE: This will allow the application to continue running after an exception has been thrown
// but not handled.
// For production applications this error handling should be replaced with something that will
// report the error to the website and stop the application.
e.Handled = true;
Deployment.Current.Dispatcher.BeginInvoke(delegate { ReportErrorToDOM(e); });
}
}
private void ReportErrorToDOM(ApplicationUnhandledExceptionEventArgs e)
{
try
{
string errorMsg = e.ExceptionObject.Message + e.ExceptionObject.StackTrace;
errorMsg = errorMsg.Replace('"', '\'').Replace("\r\n", @"\n");
System.Windows.Browser.HtmlPage.Window.Eval("throw new Error(\"Unhandled Error in Silverlight Application " + errorMsg + "\");");
}
catch (Exception)
{
}
}
}
}

Просмотреть файл

@ -0,0 +1,14 @@
<UserControl x:Class="SimulateWatermark.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:SimulateWatermark"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="400">
<StackPanel>
<Button Content="Steal focus" Width="100"/>
<local:WatermarkRadRichTextBox WatermarkText="Description..." WatermarkForeground="Gray" Width="380" Height="150" />
</StackPanel>
</UserControl>

Просмотреть файл

@ -0,0 +1,14 @@
using System;
using System.Linq;
using System.Windows.Controls;
namespace SimulateWatermark
{
public partial class MainPage : UserControl
{
public MainPage()
{
InitializeComponent();
}
}
}

Просмотреть файл

@ -0,0 +1,10 @@
<Window x:Class="SimulateWatermark.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:SimulateWatermark"
Title="MainWindow" Height="350" Width="525">
<StackPanel>
<Button Content="Steal focus" Width="100"/>
<local:WatermarkRadRichTextBox WatermarkText="Description..." WatermarkForeground="Gray" Width="380" Height="150" />
</StackPanel>
</Window>

Просмотреть файл

@ -0,0 +1,27 @@
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;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace SimulateWatermark
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
}
}

Просмотреть файл

@ -0,0 +1,6 @@
<Deployment xmlns="http://schemas.microsoft.com/client/2007/deployment"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
>
<Deployment.Parts>
</Deployment.Parts>
</Deployment>

Просмотреть файл

@ -0,0 +1,35 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("SimulateWatermark")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SimulateWatermark")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("be866f9d-1763-460d-b3f8-56652b9308bd")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

Просмотреть файл

@ -0,0 +1 @@
This example demonstrates how you can strip the rich-text formatting options of RadRichTextBox and place text in it when the control is empty (similar to RadWatermarkTextBox).

Просмотреть файл

@ -0,0 +1,136 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.50727</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{BE866F9D-1763-460D-B3F8-56652B9308BD}</ProjectGuid>
<ProjectTypeGuids>{A1591282-1198-4647-A2B1-27E5FF5F6F3B};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>SimulateWatermark</RootNamespace>
<AssemblyName>SimulateWatermark</AssemblyName>
<TargetFrameworkIdentifier>Silverlight</TargetFrameworkIdentifier>
<TargetFrameworkVersion>v5.0</TargetFrameworkVersion>
<SilverlightVersion>$(TargetFrameworkVersion)</SilverlightVersion>
<SilverlightApplication>true</SilverlightApplication>
<SupportedCultures>
</SupportedCultures>
<XapOutputs>true</XapOutputs>
<GenerateSilverlightManifest>true</GenerateSilverlightManifest>
<XapFilename>SimulateWatermark.xap</XapFilename>
<SilverlightManifestTemplate>Properties\AppManifest.xml</SilverlightManifestTemplate>
<SilverlightAppEntry>SimulateWatermark.App</SilverlightAppEntry>
<TestPageFileName>SimulateWatermarkTestPage.html</TestPageFileName>
<CreateTestPage>true</CreateTestPage>
<ValidateXaml>true</ValidateXaml>
<EnableOutOfBrowser>false</EnableOutOfBrowser>
<OutOfBrowserSettingsFile>Properties\OutOfBrowserSettings.xml</OutOfBrowserSettingsFile>
<UsePlatformExtensions>false</UsePlatformExtensions>
<ThrowErrorsInValidation>true</ThrowErrorsInValidation>
<LinkedServerProject>
</LinkedServerProject>
</PropertyGroup>
<!-- This property group is only here to support building this project using the
MSBuild 3.5 toolset. In order to work correctly with this older toolset, it needs
to set the TargetFrameworkVersion to v3.5 -->
<PropertyGroup Condition="'$(MSBuildToolsVersion)' == '3.5'">
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>Bin\Debug</OutputPath>
<DefineConstants>DEBUG;TRACE;SILVERLIGHT</DefineConstants>
<NoStdLib>true</NoStdLib>
<NoConfig>true</NoConfig>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>Bin\Release</OutputPath>
<DefineConstants>TRACE;SILVERLIGHT</DefineConstants>
<NoStdLib>true</NoStdLib>
<NoConfig>true</NoConfig>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="mscorlib" />
<Reference Include="System.Windows" />
<Reference Include="system" />
<Reference Include="System.Core">
<HintPath>$(TargetFrameworkDirectory)System.Core.dll</HintPath>
</Reference>
<Reference Include="System.Net" />
<Reference Include="System.Xml" />
<Reference Include="System.Windows.Browser" />
<Reference Include="Telerik.Windows.Controls">
<HintPath>$(TELERIKSLDIR)\Binaries\Silverlight\Telerik.Windows.Controls.dll</HintPath>
</Reference>
<Reference Include="Telerik.Windows.Data">
<HintPath>$(TELERIKSLDIR)\Binaries\Silverlight\Telerik.Windows.Data.dll</HintPath>
</Reference>
<Reference Include="Telerik.Windows.Documents">
<HintPath>$(TELERIKSLDIR)\Binaries\Silverlight\Telerik.Windows.Documents.dll</HintPath>
</Reference>
<Reference Include="Telerik.Windows.Documents.Core">
<HintPath>$(TELERIKSLDIR)\Binaries\Silverlight\Telerik.Windows.Documents.Core.dll</HintPath>
</Reference>
<Reference Include="Telerik.Windows.Documents.Flow">
<HintPath>$(TELERIKSLDIR)\Binaries\Silverlight\Telerik.Windows.Documents.Flow.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="App_SL.xaml.cs">
<DependentUpon>App_SL.xaml</DependentUpon>
</Compile>
<Compile Include="MainPage.xaml.cs">
<DependentUpon>MainPage.xaml</DependentUpon>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="WatermarkRadRichTextBox.xaml.cs">
<DependentUpon>WatermarkRadRichTextBox.xaml</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<ApplicationDefinition Include="App_SL.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</ApplicationDefinition>
<Page Include="MainPage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="WatermarkRadRichTextBox.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
<ItemGroup>
<None Include="Properties\AppManifest.xml" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Silverlight\$(SilverlightVersion)\Microsoft.Silverlight.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
<ProjectExtensions>
<VisualStudio>
<FlavorProperties GUID="{A1591282-1198-4647-A2B1-27E5FF5F6F3B}">
<SilverlightProjectProperties />
</FlavorProperties>
</VisualStudio>
</ProjectExtensions>
</Project>

Просмотреть файл

@ -0,0 +1,109 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{0A2CE792-9EA5-4CC8-930D-2A7B87315FBA}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>SimulateWatermark</RootNamespace>
<AssemblyName>SimulateWatermark</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Xaml">
<RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
<Reference Include="Telerik.Windows.Controls">
<HintPath>$(TELERIKWPFDIR)\Binaries\WPF40\Telerik.Windows.Controls.dll</HintPath>
</Reference>
<Reference Include="Telerik.Windows.Data">
<HintPath>$(TELERIKWPFDIR)\Binaries\WPF40\Telerik.Windows.Data.dll</HintPath>
</Reference>
<Reference Include="Telerik.Windows.Documents">
<HintPath>$(TELERIKWPFDIR)\Binaries\WPF40\Telerik.Windows.Documents.dll</HintPath>
</Reference>
<Reference Include="Telerik.Windows.Documents.Core">
<HintPath>$(TELERIKWPFDIR)\Binaries\WPF40\Telerik.Windows.Documents.Core.dll</HintPath>
</Reference>
<Reference Include="Telerik.Windows.Documents.Flow">
<HintPath>$(TELERIKWPFDIR)\Binaries\WPF40\Telerik.Windows.Documents.Flow.dll</HintPath>
</Reference>
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
</ItemGroup>
<ItemGroup>
<ApplicationDefinition Include="App.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Compile Include="WatermarkRadRichTextBox.xaml.cs">
<DependentUpon>WatermarkRadRichTextBox.xaml</DependentUpon>
</Compile>
<Page Include="MainWindow.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Compile Include="App.xaml.cs">
<DependentUpon>App.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="MainWindow.xaml.cs">
<DependentUpon>MainWindow.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Page Include="WatermarkRadRichTextBox.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs">
<SubType>Code</SubType>
</Compile>
<AppDesigner Include="Properties\" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

Просмотреть файл

@ -0,0 +1,21 @@
<UserControl x:Class="SimulateWatermark.WatermarkRadRichTextBox"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="400"
x:Name="thisWatermarkRadRichTextBox" >
<Grid x:Name="LayoutRoot" Background="White">
<Grid>
<telerik:RadRichTextBox x:Name="radRichTextBox" AcceptsReturn="False"
IsSelectionMiniToolBarEnabled="False" IsContextMenuEnabled="False" IsSpellCheckingEnabled="False"
DocumentInheritsDefaultStyleSettings="True" />
<TextBlock x:Name="watermarkTextBlock" Margin="5 5 0 0" IsHitTestVisible="False" FontStyle="Italic"
Text="{Binding WatermarkText, ElementName=thisWatermarkRadRichTextBox}"
Foreground="{Binding WatermarkForeground, ElementName=thisWatermarkRadRichTextBox}" />
</Grid>
</Grid>
</UserControl>

Просмотреть файл

@ -0,0 +1,202 @@
using System;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media;
using Telerik.Windows.Controls;
using Telerik.Windows.Documents;
using Telerik.Windows.Documents.FormatProviders.Txt;
using Telerik.Windows.Documents.RichTextBoxCommands;
namespace SimulateWatermark
{
public partial class WatermarkRadRichTextBox : UserControl
{
#region Fields
private readonly TxtFormatProvider provider;
private bool setTextSilentlyEnabled;
#endregion
#region Properties
public static readonly DependencyProperty TextProperty =
DependencyProperty.Register("Text", typeof(string), typeof(WatermarkRadRichTextBox), new PropertyMetadata(OnTextChanged));
public string Text
{
get { return (string)GetValue(TextProperty); }
set { SetValue(TextProperty, value); }
}
public static readonly DependencyProperty WatermarkTextProperty =
DependencyProperty.Register("WatermarkText", typeof(string), typeof(WatermarkRadRichTextBox), null);
public string WatermarkText
{
get { return (string)GetValue(WatermarkTextProperty); }
set { SetValue(WatermarkTextProperty, value); }
}
public static readonly DependencyProperty WatermarkForegroundProperty =
DependencyProperty.Register("WatermarkForeground", typeof(Brush), typeof(WatermarkRadRichTextBox), null);
public Brush WatermarkForeground
{
get { return (Brush)GetValue(WatermarkForegroundProperty); }
set { SetValue(WatermarkForegroundProperty, value); }
}
#endregion
#region Constructors
public WatermarkRadRichTextBox()
{
InitializeComponent();
this.AttachToEvents();
this.FillInputBindingsCollection();
this.provider = new TxtFormatProvider();
}
#endregion
#region Methods
private void AttachToEvents()
{
this.radRichTextBox.GotFocus += this.OnGotFocus;
this.radRichTextBox.LostFocus += this.OnLostFocus;
this.radRichTextBox.DocumentContentChanged += this.OnDocumentContentChanged;
}
private void FillInputBindingsCollection()
{
#if WPF
this.radRichTextBox.RegisteredApplicationCommands.Clear();
this.radRichTextBox.RegisteredApplicationCommands.Add(ApplicationCommands.Cut);
this.radRichTextBox.RegisteredApplicationCommands.Add(ApplicationCommands.Copy);
this.radRichTextBox.RegisteredApplicationCommands.Add(ApplicationCommands.Paste);
this.radRichTextBox.RegisteredApplicationCommands.Add(ApplicationCommands.SelectAll);
this.radRichTextBox.RegisteredApplicationCommands.Add(ApplicationCommands.Undo);
this.radRichTextBox.RegisteredApplicationCommands.Add(ApplicationCommands.Redo);
#endif
RadRichTextBox.DefaultInputBindings.Clear();
#if SILVERLIGHT
this.RegisterCommand(RichTextBoxCommands.Cut, Key.X, ModifierKeys.Control);
this.RegisterCommand(RichTextBoxCommands.Copy, Key.C, ModifierKeys.Control);
this.RegisterCommand(RichTextBoxCommands.Paste, Key.V, ModifierKeys.Control);
this.RegisterCommand(RichTextBoxCommands.SelectAll, Key.A, ModifierKeys.Control);
this.RegisterCommand(RichTextBoxCommands.Undo, Key.Z, ModifierKeys.Control);
this.RegisterCommand(RichTextBoxCommands.Redo, Key.Y, ModifierKeys.Control);
#endif
this.RegisterCommand(RichTextBoxCommands.InsertText, Key.Tab, ModifierKeys.Control, "\t");
this.RegisterCommand(RichTextBoxCommands.Delete, Key.Delete, ModifierKeys.None, false);
this.RegisterCommand(RichTextBoxCommands.Delete, Key.Back, ModifierKeys.None, true);
this.RegisterCommand(RichTextBoxCommands.Delete, Key.Back, ModifierKeys.Shift, true);
this.RegisterCommandOrShift(RichTextBoxCommands.MoveCaret, Key.Left, ModifierKeys.None, MoveCaretDirections.Previous);
this.RegisterCommandOrShift(RichTextBoxCommands.MoveCaret, Key.Left, ModifierKeys.Control, MoveCaretDirections.PreviousWord);
this.RegisterCommandOrShift(RichTextBoxCommands.MoveCaret, Key.Right, ModifierKeys.None, MoveCaretDirections.Next);
this.RegisterCommandOrShift(RichTextBoxCommands.MoveCaret, Key.Right, ModifierKeys.Control, MoveCaretDirections.NextWord);
this.RegisterCommandOrShift(RichTextBoxCommands.MoveCaret, Key.Up, ModifierKeys.None, MoveCaretDirections.Up);
this.RegisterCommandOrShift(RichTextBoxCommands.MoveCaret, Key.Down, ModifierKeys.None, MoveCaretDirections.Down);
this.RegisterCommandOrShift(RichTextBoxCommands.MoveCaret, Key.Up, ModifierKeys.Control, MoveCaretDirections.ParagraphStart);
this.RegisterCommandOrShift(RichTextBoxCommands.MoveCaret, Key.Down, ModifierKeys.Control, MoveCaretDirections.ParagraphEnd);
this.RegisterCommandOrShift(RichTextBoxCommands.MoveCaret, Key.Home, ModifierKeys.None, MoveCaretDirections.Home);
this.RegisterCommandOrShift(RichTextBoxCommands.MoveCaret, Key.Home, ModifierKeys.Control, MoveCaretDirections.DocumentStart);
this.RegisterCommandOrShift(RichTextBoxCommands.MoveCaret, Key.End, ModifierKeys.None, MoveCaretDirections.End);
this.RegisterCommandOrShift(RichTextBoxCommands.MoveCaret, Key.End, ModifierKeys.Control, MoveCaretDirections.DocumentEnd);
this.RegisterCommandOrShift(RichTextBoxCommands.MoveCaret, Key.PageUp, ModifierKeys.None, MoveCaretDirections.PageUp);
this.RegisterCommandOrShift(RichTextBoxCommands.MoveCaret, Key.PageDown, ModifierKeys.None, MoveCaretDirections.PageDown);
}
private void ShowWatermark()
{
this.watermarkTextBlock.Visibility = Visibility.Visible;
}
private void HideWatermark()
{
this.watermarkTextBlock.Visibility = Visibility.Collapsed;
}
private bool IsTextEmpty(RadRichTextBox rrtb)
{
return string.IsNullOrEmpty(this.GetText(rrtb));
}
private string GetText(RadRichTextBox rrtb)
{
return this.provider.Export(rrtb.Document);
}
private void SetText(RadRichTextBox rrtb, string newText)
{
rrtb.Document = this.provider.Import(newText);
if (!string.IsNullOrEmpty(newText))
{
this.HideWatermark();
}
}
private static void OnTextChanged(DependencyObject dObj, DependencyPropertyChangedEventArgs args)
{
WatermarkRadRichTextBox watermarkRrtb = dObj as WatermarkRadRichTextBox;
if (args.NewValue != null && !watermarkRrtb.setTextSilentlyEnabled)
{
string newTextValue = args.NewValue.ToString();
watermarkRrtb.SetText(watermarkRrtb.radRichTextBox, newTextValue);
}
}
public void RegisterCommand(RoutedCommand command, Key key, ModifierKeys modifierKeys = ModifierKeys.None, object commandParameter = null)
{
RadRichTextBox.RegisterCommand(command, key, modifierKeys, commandParameter);
}
private void RegisterCommandOrShift(RoutedCommand command, Key key, ModifierKeys modifierKeys = ModifierKeys.None, object commandParameter = null)
{
RadRichTextBox.RegisterCommand(command, key, modifierKeys, commandParameter);
RadRichTextBox.RegisterCommand(command, key, modifierKeys | ModifierKeys.Shift, commandParameter);
}
#endregion
#region Event Handlers
private void OnGotFocus(object sender, RoutedEventArgs e)
{
this.HideWatermark();
}
private void OnLostFocus(object sender, RoutedEventArgs e)
{
if (this.IsTextEmpty(this.radRichTextBox))
{
this.ShowWatermark();
}
}
private void OnDocumentContentChanged(object sender, EventArgs e)
{
RadRichTextBox radRichTextBox = sender as RadRichTextBox;
this.setTextSilentlyEnabled = true;
this.Text = this.GetText(radRichTextBox);
this.setTextSilentlyEnabled = false;
}
#endregion
}
}

Просмотреть файл

@ -0,0 +1,7 @@
<Application x:Class="ResourcesPaging.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
StartupUri="MainWindow.xaml">
<Application.Resources>
</Application.Resources>
</Application>

Просмотреть файл

@ -0,0 +1,11 @@
using System.Windows;
namespace ResourcesPaging
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
}
}

Просмотреть файл

@ -0,0 +1,8 @@
<Application xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="ResourcesPaging.App"
>
<Application.Resources>
</Application.Resources>
</Application>

Просмотреть файл

@ -0,0 +1,68 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
namespace ResourcesPaging
{
public partial class App : Application
{
public App()
{
this.Startup += this.Application_Startup;
this.Exit += this.Application_Exit;
this.UnhandledException += this.Application_UnhandledException;
InitializeComponent();
}
private void Application_Startup(object sender, StartupEventArgs e)
{
this.RootVisual = new MainPage();
}
private void Application_Exit(object sender, EventArgs e)
{
}
private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
{
// If the app is running outside of the debugger then report the exception using
// the browser's exception mechanism. On IE this will display it a yellow alert
// icon in the status bar and Firefox will display a script error.
if (!System.Diagnostics.Debugger.IsAttached)
{
// NOTE: This will allow the application to continue running after an exception has been thrown
// but not handled.
// For production applications this error handling should be replaced with something that will
// report the error to the website and stop the application.
e.Handled = true;
Deployment.Current.Dispatcher.BeginInvoke(delegate { ReportErrorToDOM(e); });
}
}
private void ReportErrorToDOM(ApplicationUnhandledExceptionEventArgs e)
{
try
{
string errorMsg = e.ExceptionObject.Message + e.ExceptionObject.StackTrace;
errorMsg = errorMsg.Replace('"', '\'').Replace("\r\n", @"\n");
System.Windows.Browser.HtmlPage.Window.Eval("throw new Error(\"Unhandled Error in Silverlight Application " + errorMsg + "\");");
}
catch (Exception)
{
}
}
}
}

Просмотреть файл

@ -0,0 +1,41 @@
<UserControl x:Class="ResourcesPaging.Example"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
xmlns:local="clr-namespace:ResourcesPaging"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="60" />
<RowDefinition />
</Grid.RowDefinitions>
<telerik:RadScheduleView AppointmentsSource="{Binding Appointments}"
ResourceTypesSource="{Binding ResourceTypes}"
Grid.Row="1">
<telerik:RadScheduleView.ViewDefinitions>
<telerik:DayViewDefinition />
</telerik:RadScheduleView.ViewDefinitions>
<telerik:RadScheduleView.GroupDescriptionsSource>
<telerik:GroupDescriptionCollection>
<telerik:ResourceGroupDescription ResourceType="Room" />
</telerik:GroupDescriptionCollection>
</telerik:RadScheduleView.GroupDescriptionsSource>
</telerik:RadScheduleView>
<StackPanel Orientation="Horizontal" VerticalAlignment="Center">
<telerik:RadComboBox SelectedValue="{Binding ResourcesPerPage, Mode=TwoWay}">
<telerik:RadComboBox.Items>
<sys:Int32>5</sys:Int32>
<sys:Int32>10</sys:Int32>
<sys:Int32>20</sys:Int32>
<sys:Int32>30</sys:Int32>
</telerik:RadComboBox.Items>
</telerik:RadComboBox>
<telerik:RadButton Width="70" Content="Prev" Command="{Binding PreviousResources}"/>
<telerik:RadButton Width="70" Content="Next" Command="{Binding NextResources}" />
</StackPanel>
</Grid>
</UserControl>

Просмотреть файл

@ -0,0 +1,28 @@
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;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace ResourcesPaging
{
/// <summary>
/// Interaction logic for Example.xaml
/// </summary>
public partial class Example : UserControl
{
public Example()
{
InitializeComponent();
this.DataContext = new ViewModel();
}
}
}

Просмотреть файл

@ -0,0 +1,12 @@
<UserControl x:Class="ResourcesPaging.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:ResourcesPaging"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="400">
<Grid x:Name="LayoutRoot" Background="White">
<local:Example />
</Grid>
</UserControl>

Просмотреть файл

@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
namespace ResourcesPaging
{
public partial class MainPage : UserControl
{
public MainPage()
{
InitializeComponent();
}
}
}

Просмотреть файл

@ -0,0 +1,9 @@
<Window x:Class="ResourcesPaging.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:ResourcesPaging"
Title="MainWindow" Height="600" Width="800">
<Grid x:Name="LayoutRoot" >
<local:Example />
</Grid>
</Window>

Просмотреть файл

@ -0,0 +1,15 @@
using System.Windows;
namespace ResourcesPaging
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
}
}

Просмотреть файл

@ -0,0 +1,6 @@
<Deployment xmlns="http://schemas.microsoft.com/client/2007/deployment"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
>
<Deployment.Parts>
</Deployment.Parts>
</Deployment>

Просмотреть файл

@ -0,0 +1,35 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("ResourcesPaging")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ResourcesPaging")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("7c78a993-a823-4115-a47d-cf83a6e9612a")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

63
ScheduleView/ResourcesPaging/Properties/Resources.Designer.cs сгенерированный Normal file
Просмотреть файл

@ -0,0 +1,63 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.18052
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace ResourcesPaging.Properties {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ResourcesPaging.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
}
}

Просмотреть файл

@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

26
ScheduleView/ResourcesPaging/Properties/Settings.Designer.cs сгенерированный Normal file
Просмотреть файл

@ -0,0 +1,26 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.18052
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace ResourcesPaging.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default {
get {
return defaultInstance;
}
}
}
}

Просмотреть файл

@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>

Просмотреть файл

@ -0,0 +1 @@
This example demonstrates how to implement resources paging in RadScheduleView in the cases when there are too many resources.

Просмотреть файл

@ -0,0 +1,137 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.50727</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{7C78A993-A823-4115-A47D-CF83A6E9612A}</ProjectGuid>
<ProjectTypeGuids>{A1591282-1198-4647-A2B1-27E5FF5F6F3B};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ResourcesPaging</RootNamespace>
<AssemblyName>ResourcesPaging</AssemblyName>
<TargetFrameworkIdentifier>Silverlight</TargetFrameworkIdentifier>
<TargetFrameworkVersion>v5.0</TargetFrameworkVersion>
<SilverlightVersion>$(TargetFrameworkVersion)</SilverlightVersion>
<SilverlightApplication>true</SilverlightApplication>
<SupportedCultures>
</SupportedCultures>
<XapOutputs>true</XapOutputs>
<GenerateSilverlightManifest>true</GenerateSilverlightManifest>
<XapFilename>ResourcesPaging.xap</XapFilename>
<SilverlightManifestTemplate>Properties\AppManifest.xml</SilverlightManifestTemplate>
<SilverlightAppEntry>ResourcesPaging.App</SilverlightAppEntry>
<TestPageFileName>ResourcesPaging_SLTestPage.html</TestPageFileName>
<CreateTestPage>true</CreateTestPage>
<ValidateXaml>true</ValidateXaml>
<EnableOutOfBrowser>false</EnableOutOfBrowser>
<OutOfBrowserSettingsFile>Properties\OutOfBrowserSettings.xml</OutOfBrowserSettingsFile>
<UsePlatformExtensions>false</UsePlatformExtensions>
<ThrowErrorsInValidation>true</ThrowErrorsInValidation>
<LinkedServerProject>
</LinkedServerProject>
</PropertyGroup>
<!-- This property group is only here to support building this project using the
MSBuild 3.5 toolset. In order to work correctly with this older toolset, it needs
to set the TargetFrameworkVersion to v3.5 -->
<PropertyGroup Condition="'$(MSBuildToolsVersion)' == '3.5'">
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>Bin\Debug</OutputPath>
<DefineConstants>DEBUG;TRACE;SILVERLIGHT</DefineConstants>
<NoStdLib>true</NoStdLib>
<NoConfig>true</NoConfig>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>Bin\Release</OutputPath>
<DefineConstants>TRACE;SILVERLIGHT</DefineConstants>
<NoStdLib>true</NoStdLib>
<NoConfig>true</NoConfig>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="mscorlib" />
<Reference Include="System.Windows" />
<Reference Include="system" />
<Reference Include="System.Core">
<HintPath>$(TargetFrameworkDirectory)System.Core.dll</HintPath>
</Reference>
<Reference Include="System.Net" />
<Reference Include="System.Xml" />
<Reference Include="System.Windows.Browser" />
<Reference Include="Telerik.Windows.Controls">
<HintPath>$(TELERIKSLDIR)\Binaries\Silverlight\Telerik.Windows.Controls.dll</HintPath>
</Reference>
<Reference Include="Telerik.Windows.Controls.Input">
<HintPath>$(TELERIKSLDIR)\Binaries\Silverlight\Telerik.Windows.Controls.Input.dll</HintPath>
</Reference>
<Reference Include="Telerik.Windows.Controls.Navigation">
<HintPath>$(TELERIKSLDIR)\Binaries\Silverlight\Telerik.Windows.Controls.Navigation.dll</HintPath>
</Reference>
<Reference Include="Telerik.Windows.Controls.ScheduleView">
<HintPath>$(TELERIKSLDIR)\Binaries\Silverlight\Telerik.Windows.Controls.ScheduleView.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="App_SL.xaml.cs">
<DependentUpon>App_SL.xaml</DependentUpon>
</Compile>
<Compile Include="Example.xaml.cs">
<DependentUpon>Example.xaml</DependentUpon>
</Compile>
<Compile Include="MainPage.xaml.cs">
<DependentUpon>MainPage.xaml</DependentUpon>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ViewModel.cs" />
</ItemGroup>
<ItemGroup>
<ApplicationDefinition Include="App_SL.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</ApplicationDefinition>
<Page Include="Example.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="MainPage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
<ItemGroup>
<None Include="Properties\AppManifest.xml" />
</ItemGroup>
<ItemGroup>
<Content Include="Readme.txt" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Silverlight\$(SilverlightVersion)\Microsoft.Silverlight.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
<ProjectExtensions>
<VisualStudio>
<FlavorProperties GUID="{A1591282-1198-4647-A2B1-27E5FF5F6F3B}">
<SilverlightProjectProperties />
</FlavorProperties>
</VisualStudio>
</ProjectExtensions>
</Project>

Просмотреть файл

@ -0,0 +1,136 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{73FD6AA9-B1C4-4B80-94C4-E11BA309314D}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ResourcesPaging</RootNamespace>
<AssemblyName>ResourcePaging</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Xaml">
<RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
<Reference Include="Telerik.Windows.Controls, Version=2013.3.1315.1050, Culture=neutral, PublicKeyToken=5803cfa389c90ce7, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>$(TELERIKWPFDIR)\Binaries\WPF40\Telerik.Windows.Controls.dll</HintPath>
</Reference>
<Reference Include="Telerik.Windows.Controls.Input, Version=2013.3.1315.1050, Culture=neutral, PublicKeyToken=5803cfa389c90ce7, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>$(TELERIKWPFDIR)\Binaries\WPF40\Telerik.Windows.Controls.Input.dll</HintPath>
</Reference>
<Reference Include="Telerik.Windows.Controls.Navigation, Version=2013.3.1315.1050, Culture=neutral, PublicKeyToken=5803cfa389c90ce7, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>$(TELERIKWPFDIR)\Binaries\WPF40\Telerik.Windows.Controls.Navigation.dll</HintPath>
</Reference>
<Reference Include="Telerik.Windows.Controls.ScheduleView, Version=2013.3.1315.1050, Culture=neutral, PublicKeyToken=5803cfa389c90ce7, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>$(TELERIKWPFDIR)\Binaries\WPF40\Telerik.Windows.Controls.ScheduleView.dll</HintPath>
</Reference>
<Reference Include="Telerik.Windows.Data">
<HintPath>$(TELERIKWPFDIR)\Binaries\WPF40\Telerik.Windows.Data.dll</HintPath>
</Reference>
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
</ItemGroup>
<ItemGroup>
<Compile Include="App.xaml.cs">
<DependentUpon>App.xaml</DependentUpon>
</Compile>
<Compile Include="Example.xaml.cs">
<DependentUpon>Example.xaml</DependentUpon>
</Compile>
<Compile Include="ViewModel.cs" />
<ApplicationDefinition Include="App.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Page Include="Example.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="MainWindow.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Compile Include="MainWindow.xaml.cs">
<DependentUpon>MainWindow.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<AppDesigner Include="Properties\" />
</ItemGroup>
<ItemGroup>
<Resource Include="Readme.txt" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

Просмотреть файл

@ -0,0 +1,127 @@
using System.Collections.Generic;
using System.Linq;
using Telerik.Windows.Controls;
using System.Windows.Input;
using System.Collections.ObjectModel;
using Telerik.Windows.Controls.ScheduleView;
namespace ResourcesPaging
{
public class ViewModel : ViewModelBase
{
private IEnumerable<IResource> resources;
private IEnumerable<IResourceType> resourceTypes;
private int resourcesIndex;
private int resourcesPerPage;
public ViewModel()
{
this.resources = GenerateResources();
this.Appointments = new ObservableCollection<Appointment>();
IResourceType resourceType = new ResourceType("Room");
resourceType.Resources.AddRange(this.resources);
this.resourceTypes = resourceType.ToEnumerable().ToList();
this.PreviousResources = new DelegateCommand(GetPreviousResources);
this.NextResources = new DelegateCommand(GetNextResources);
this.resourcesIndex = 0;
this.ResourcesPerPage = 10;
}
public ObservableCollection<Appointment> Appointments
{
get;
set;
}
public IEnumerable<IResource> Resources
{
get
{
return this.resources;
}
}
public IEnumerable<IResourceType> ResourceTypes
{
get
{
return this.GetResources();
}
}
public int ResourcesPerPage
{
get
{
return this.resourcesPerPage;
}
set
{
this.resourcesPerPage = value;
OnPropertyChanged("ResourceTypes");
}
}
public ICommand PreviousResources { get; private set; }
public ICommand NextResources { get; private set; }
private IEnumerable<IResource> GenerateResources()
{
var resources = new List<IResource>();
for (int index = 1; index < 100; index++)
{
resources.Add(new Resource("Room " + index, "Room"));
}
return resources;
}
private IEnumerable<IResourceType> GetResources()
{
if (this.resourcesIndex < 0) this.resourcesIndex = 0;
int startIndex = this.resourcesIndex;
int endIndex = startIndex + this.ResourcesPerPage;
if (endIndex > this.resourceTypes.First().Resources.Count)
{
endIndex = this.resourceTypes.First().Resources.Count;
}
List<Resource> resources = new List<Resource>();
for (int i = startIndex; i < endIndex; i++)
{
var resource = (Resource)this.resourceTypes.First().Resources[i];
resources.Add(resource);
}
IResourceType resourceType = new ResourceType("Room");
resourceType.Resources.AddRange(resources);
IEnumerable<IResourceType> result = resourceType.ToEnumerable();
return result;
}
private void GetNextResources(object param)
{
int resourcesCount = this.resourceTypes.First().Resources.Count;
if((resourcesIndex + this.ResourcesPerPage) < resourcesCount)
{
resourcesIndex= resourcesIndex + this.ResourcesPerPage;
OnPropertyChanged("ResourceTypes");
}
}
private void GetPreviousResources(object param)
{
int resourcesCount = this.resourceTypes.First().Resources.Count;
if (this.resourcesIndex > 0)
{
resourcesIndex = resourcesIndex - this.ResourcesPerPage;
OnPropertyChanged("ResourceTypes");
}
}
}
}

Просмотреть файл

@ -1,8 +1,6 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.21005.1
MinimumVisualStudioVersion = 10.0.40219.1
# Visual Studio 2012
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MonthTickProvider_SL", "MonthTickProvider\MonthTickProvider_SL.csproj", "{4A6D4329-1DC7-4818-9F8D-E381A6CE555A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AppointmentColorBasedOnResource_SL", "AppointmentColorBasedOnResource\AppointmentColorBasedOnResource_SL.csproj", "{8DEDF061-6376-4999-8D9D-3FF43AB2CE0C}"
@ -27,6 +25,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RemoveDeleteButton_SL", "Re
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CustomDragDropBehavior_SL", "CustomDragDropBehavior\CustomDragDropBehavior_SL.csproj", "{BCF6A668-C2DD-41EB-AAAE-92F31771548C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ResourcesPaging_SL", "ResourcesPaging\ResourcesPaging_SL.csproj", "{7C78A993-A823-4115-A47D-CF83A6E9612A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -82,6 +82,10 @@ Global
{BCF6A668-C2DD-41EB-AAAE-92F31771548C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BCF6A668-C2DD-41EB-AAAE-92F31771548C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BCF6A668-C2DD-41EB-AAAE-92F31771548C}.Release|Any CPU.Build.0 = Release|Any CPU
{7C78A993-A823-4115-A47D-CF83A6E9612A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7C78A993-A823-4115-A47D-CF83A6E9612A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7C78A993-A823-4115-A47D-CF83A6E9612A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7C78A993-A823-4115-A47D-CF83A6E9612A}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

Просмотреть файл

@ -1,8 +1,6 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.21005.1
MinimumVisualStudioVersion = 10.0.40219.1
# Visual Studio 2012
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MonthTickProvider_WPF", "MonthTickProvider\MonthTickProvider_WPF.csproj", "{428E7461-E755-42A5-9728-F2F448EAE181}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AppointmentColorBasedOnResource_WPF", "AppointmentColorBasedOnResource\AppointmentColorBasedOnResource_WPF.csproj", "{94FF10A8-07CD-4A1B-BA19-55CEA285C555}"
@ -27,6 +25,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RemoveDeleteButton_WPF", "R
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CustomDragDropBehavior_WPF", "CustomDragDropBehavior\CustomDragDropBehavior_WPF.csproj", "{635A284E-6436-4B35-A6D5-B2F6CF80F335}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ResourcesPaging_WPF", "ResourcesPaging\ResourcesPaging_WPF.csproj", "{73FD6AA9-B1C4-4B80-94C4-E11BA309314D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -158,6 +158,16 @@ Global
{635A284E-6436-4B35-A6D5-B2F6CF80F335}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{635A284E-6436-4B35-A6D5-B2F6CF80F335}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{635A284E-6436-4B35-A6D5-B2F6CF80F335}.Release|x86.ActiveCfg = Release|Any CPU
{73FD6AA9-B1C4-4B80-94C4-E11BA309314D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{73FD6AA9-B1C4-4B80-94C4-E11BA309314D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{73FD6AA9-B1C4-4B80-94C4-E11BA309314D}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{73FD6AA9-B1C4-4B80-94C4-E11BA309314D}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{73FD6AA9-B1C4-4B80-94C4-E11BA309314D}.Debug|x86.ActiveCfg = Debug|Any CPU
{73FD6AA9-B1C4-4B80-94C4-E11BA309314D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{73FD6AA9-B1C4-4B80-94C4-E11BA309314D}.Release|Any CPU.Build.0 = Release|Any CPU
{73FD6AA9-B1C4-4B80-94C4-E11BA309314D}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{73FD6AA9-B1C4-4B80-94C4-E11BA309314D}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{73FD6AA9-B1C4-4B80-94C4-E11BA309314D}.Release|x86.ActiveCfg = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE