v19.4.0.48
|
@ -88,4 +88,4 @@ Syncfusion has no liability for any damage or consequence that may arise by the
|
|||
|
||||
* To renew the subscription, click [here](https://www.syncfusion.com/sales/products?utm_source=github&utm_medium=listing) or contact our sales team at <salessupport@syncfusion.com>.
|
||||
|
||||
<p>Copyright © 2001-2021 Syncfusion, Inc. Updated on 2021-12-23 at precisely 23:37:10 EST.</p>
|
||||
<p>Copyright © 2001-2022 Syncfusion, Inc. Updated on 2022-02-01 at precisely 19:06:27 EST.</p>
|
||||
|
|
После Ширина: | Высота: | Размер: 41 KiB |
После Ширина: | Высота: | Размер: 4.2 KiB |
После Ширина: | Высота: | Размер: 44 KiB |
После Ширина: | Высота: | Размер: 42 KiB |
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<SampleSource>
|
||||
<Source>SyncfusionOfflineCube</Source>
|
||||
<Version>SQL2005</Version>
|
||||
<FilePath />
|
||||
<ServerName />
|
||||
<DatabaseName />
|
||||
</SampleSource>
|
После Ширина: | Высота: | Размер: 40 KiB |
После Ширина: | Высота: | Размер: 31 KiB |
После Ширина: | Высота: | Размер: 56 KiB |
После Ширина: | Высота: | Размер: 41 KiB |
После Ширина: | Высота: | Размер: 48 KiB |
После Ширина: | Высота: | Размер: 46 KiB |
После Ширина: | Высота: | Размер: 48 KiB |
После Ширина: | Высота: | Размер: 41 KiB |
После Ширина: | Высота: | Размер: 46 KiB |
После Ширина: | Высота: | Размер: 32 KiB |
После Ширина: | Высота: | Размер: 32 KiB |
После Ширина: | Высота: | Размер: 31 KiB |
После Ширина: | Высота: | Размер: 32 KiB |
После Ширина: | Высота: | Размер: 33 KiB |
После Ширина: | Высота: | Размер: 26 KiB |
После Ширина: | Высота: | Размер: 42 KiB |
После Ширина: | Высота: | Размер: 42 KiB |
После Ширина: | Высота: | Размер: 40 KiB |
После Ширина: | Высота: | Размер: 31 KiB |
После Ширина: | Высота: | Размер: 46 KiB |
После Ширина: | Высота: | Размер: 50 KiB |
После Ширина: | Высота: | Размер: 43 KiB |
После Ширина: | Высота: | Размер: 34 KiB |
После Ширина: | Высота: | Размер: 26 KiB |
После Ширина: | Высота: | Размер: 22 KiB |
После Ширина: | Высота: | Размер: 34 KiB |
После Ширина: | Высота: | Размер: 98 KiB |
|
@ -0,0 +1,240 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ArrayOfOlapReport>
|
||||
<OlapReport>
|
||||
<CategoricalElements>
|
||||
<List>
|
||||
<Item>
|
||||
<ElementValue d6p1:type="MeasureElements" xmlns:d6p1="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<Elements>
|
||||
<MeasureElement>
|
||||
<Name>Internet Sales Amount</Name>
|
||||
<UniqueName>[MEASURES].[Internet Sales Amount]</UniqueName>
|
||||
</MeasureElement>
|
||||
</Elements>
|
||||
</ElementValue>
|
||||
</Item>
|
||||
<Item>
|
||||
<ElementValue d6p1:type="DimensionElement" xmlns:d6p1="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<Name>Customer</Name>
|
||||
<Hierarchy>
|
||||
<Name>Customer Geography</Name>
|
||||
<LevelElements>
|
||||
<LevelElement>
|
||||
<Name>Country</Name>
|
||||
<MemberElements />
|
||||
<IncludeAvailableMembers>false</IncludeAvailableMembers>
|
||||
</LevelElement>
|
||||
</LevelElements>
|
||||
</Hierarchy>
|
||||
<HierarchyName>Customer Geography</HierarchyName>
|
||||
</ElementValue>
|
||||
</Item>
|
||||
</List>
|
||||
<IsFilterOrSortOn>false</IsFilterOrSortOn>
|
||||
</CategoricalElements>
|
||||
<EngineVersion>Version3</EngineVersion>
|
||||
<ChartSettings>
|
||||
<AreaBackground />
|
||||
<BorderColor>#000000</BorderColor>
|
||||
<DataPointValue>false</DataPointValue>
|
||||
<ChartBackground>#FFFFFF</ChartBackground>
|
||||
<ChartColorPalette>Default</ChartColorPalette>
|
||||
<ChartDockLegendPosition>Top</ChartDockLegendPosition>
|
||||
<ChartType>Column</ChartType>
|
||||
<GradientAngle>0</GradientAngle>
|
||||
<InteriorBackground>#FFFFFF</InteriorBackground>
|
||||
<IsCircleSymbol>false</IsCircleSymbol>
|
||||
<IsLabelTemplate1>false</IsLabelTemplate1>
|
||||
<IsLabelTemplate2>false</IsLabelTemplate2>
|
||||
<IsLabelTemplate3>false</IsLabelTemplate3>
|
||||
<IsRectangleSymbol>false</IsRectangleSymbol>
|
||||
<IsSeriesName>false</IsSeriesName>
|
||||
<IsTriangleSymbol>false</IsTriangleSymbol>
|
||||
<IsXValues>false</IsXValues>
|
||||
<IsYValues>false</IsYValues>
|
||||
<LabelsVisibility>false</LabelsVisibility>
|
||||
<LegendCheckBoxVisibility>false</LegendCheckBoxVisibility>
|
||||
<LegendVisibility>true</LegendVisibility>
|
||||
<ExpanderVisibility>false</ExpanderVisibility>
|
||||
<StrokeThickness>0</StrokeThickness>
|
||||
<SymbolsVisibility>false</SymbolsVisibility>
|
||||
<TemplateVisibility>false</TemplateVisibility>
|
||||
<XAxisFontFace>Segoe UI</XAxisFontFace>
|
||||
<XAxisForeGround>#1E90FF</XAxisForeGround>
|
||||
<XLabelFontWeight>Normal</XLabelFontWeight>
|
||||
<YAxisFontFace>Segoe UI</YAxisFontFace>
|
||||
<YAxisForeGround>#1E90FF</YAxisForeGround>
|
||||
<YLabelFontWeight>Normal</YLabelFontWeight>
|
||||
</ChartSettings>
|
||||
<CurrentCubeName>Adventure Works</CurrentCubeName>
|
||||
<FilterElements>
|
||||
<List />
|
||||
<IsFilterOrSortOn>false</IsFilterOrSortOn>
|
||||
</FilterElements>
|
||||
<Name>Basic Template</Name>
|
||||
<SeriesElements>
|
||||
<List>
|
||||
<Item>
|
||||
<Axis>Series</Axis>
|
||||
<ElementValue d6p1:type="DimensionElement" xmlns:d6p1="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<Name>Date</Name>
|
||||
<Hierarchy>
|
||||
<Name>Fiscal</Name>
|
||||
<LevelElements>
|
||||
<LevelElement>
|
||||
<Name>Fiscal Year</Name>
|
||||
<MemberElements />
|
||||
<IncludeAvailableMembers>false</IncludeAvailableMembers>
|
||||
</LevelElement>
|
||||
</LevelElements>
|
||||
</Hierarchy>
|
||||
<HierarchyName>Fiscal</HierarchyName>
|
||||
</ElementValue>
|
||||
</Item>
|
||||
</List>
|
||||
<IsFilterOrSortOn>false</IsFilterOrSortOn>
|
||||
</SeriesElements>
|
||||
<ShowEmptyColumnData>false</ShowEmptyColumnData>
|
||||
<ShowEmptyRowData>false</ShowEmptyRowData>
|
||||
<ShowExpanders>true</ShowExpanders>
|
||||
<SlicerElements>
|
||||
<List />
|
||||
<IsFilterOrSortOn>false</IsFilterOrSortOn>
|
||||
</SlicerElements>
|
||||
<TogglePivot>false</TogglePivot>
|
||||
</OlapReport>
|
||||
<OlapReport>
|
||||
<CategoricalElements>
|
||||
<List>
|
||||
<Item>
|
||||
<ElementValue d6p1:type="MeasureElements" xmlns:d6p1="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<Elements>
|
||||
<MeasureElement>
|
||||
<Name>Internet Sales Amount</Name>
|
||||
<UniqueName>[MEASURES].[Internet Sales Amount]</UniqueName>
|
||||
</MeasureElement>
|
||||
</Elements>
|
||||
</ElementValue>
|
||||
</Item>
|
||||
<Item>
|
||||
<ElementValue d6p1:type="DimensionElement" xmlns:d6p1="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<Name>Customer</Name>
|
||||
<Hierarchy>
|
||||
<Name>Customer Geography</Name>
|
||||
<LevelElements>
|
||||
<LevelElement>
|
||||
<Name>Country</Name>
|
||||
<MemberElements />
|
||||
<IncludeAvailableMembers>false</IncludeAvailableMembers>
|
||||
</LevelElement>
|
||||
</LevelElements>
|
||||
</Hierarchy>
|
||||
<HierarchyName>Customer Geography</HierarchyName>
|
||||
</ElementValue>
|
||||
</Item>
|
||||
</List>
|
||||
<IsFilterOrSortOn>false</IsFilterOrSortOn>
|
||||
</CategoricalElements>
|
||||
<EngineVersion>Version3</EngineVersion>
|
||||
<ChartSettings>
|
||||
<AreaBackground />
|
||||
<BorderColor>#000000</BorderColor>
|
||||
<DataPointValue>false</DataPointValue>
|
||||
<ChartBackground>#FFFFFF</ChartBackground>
|
||||
<ChartColorPalette>Default</ChartColorPalette>
|
||||
<ChartDockLegendPosition>Top</ChartDockLegendPosition>
|
||||
<ChartType>Column</ChartType>
|
||||
<GradientAngle>0</GradientAngle>
|
||||
<InteriorBackground>#FFFFFF</InteriorBackground>
|
||||
<IsCircleSymbol>false</IsCircleSymbol>
|
||||
<IsLabelTemplate1>false</IsLabelTemplate1>
|
||||
<IsLabelTemplate2>false</IsLabelTemplate2>
|
||||
<IsLabelTemplate3>false</IsLabelTemplate3>
|
||||
<IsRectangleSymbol>false</IsRectangleSymbol>
|
||||
<IsSeriesName>false</IsSeriesName>
|
||||
<IsTriangleSymbol>false</IsTriangleSymbol>
|
||||
<IsXValues>false</IsXValues>
|
||||
<IsYValues>false</IsYValues>
|
||||
<LabelsVisibility>false</LabelsVisibility>
|
||||
<LegendCheckBoxVisibility>false</LegendCheckBoxVisibility>
|
||||
<LegendVisibility>true</LegendVisibility>
|
||||
<ExpanderVisibility>false</ExpanderVisibility>
|
||||
<StrokeThickness>0</StrokeThickness>
|
||||
<SymbolsVisibility>false</SymbolsVisibility>
|
||||
<TemplateVisibility>false</TemplateVisibility>
|
||||
<XAxisFontFace>Segoe UI</XAxisFontFace>
|
||||
<XAxisForeGround>#1E90FF</XAxisForeGround>
|
||||
<XLabelFontWeight>Normal</XLabelFontWeight>
|
||||
<YAxisFontFace>Segoe UI</YAxisFontFace>
|
||||
<YAxisForeGround>#1E90FF</YAxisForeGround>
|
||||
<YLabelFontWeight>Normal</YLabelFontWeight>
|
||||
</ChartSettings>
|
||||
<CurrentCubeName>Adventure Works</CurrentCubeName>
|
||||
<FilterElements>
|
||||
<List />
|
||||
<IsFilterOrSortOn>false</IsFilterOrSortOn>
|
||||
</FilterElements>
|
||||
<Name>Filtered Dimension</Name>
|
||||
<SeriesElements>
|
||||
<List>
|
||||
<Item>
|
||||
<Axis>Series</Axis>
|
||||
<ElementValue d6p1:type="DimensionElement" xmlns:d6p1="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<Name>Date</Name>
|
||||
<Hierarchy>
|
||||
<Name>Fiscal</Name>
|
||||
<LevelElements>
|
||||
<LevelElement>
|
||||
<Name>Fiscal Year</Name>
|
||||
<MemberElements />
|
||||
<IncludeAvailableMembers>false</IncludeAvailableMembers>
|
||||
</LevelElement>
|
||||
</LevelElements>
|
||||
</Hierarchy>
|
||||
<HierarchyName>Fiscal</HierarchyName>
|
||||
</ElementValue>
|
||||
<ExcludedElementValue d6p1:type="DimensionElement" xmlns:d6p1="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<Name>Date</Name>
|
||||
<Hierarchy>
|
||||
<Name>Fiscal</Name>
|
||||
<LevelElements>
|
||||
<LevelElement>
|
||||
<Name>Fiscal Year</Name>
|
||||
<MemberElements>
|
||||
<MemberElement>
|
||||
<Name>FY 2004</Name>
|
||||
<ChildMemberElements />
|
||||
<DimensionName />
|
||||
<Level>0</Level>
|
||||
<IsParentLevel>true</IsParentLevel>
|
||||
<UniqueName>[Date].[Fiscal].[Fiscal Year].[FY 2004]</UniqueName>
|
||||
</MemberElement>
|
||||
<MemberElement>
|
||||
<Name>FY 2005</Name>
|
||||
<ChildMemberElements />
|
||||
<DimensionName />
|
||||
<Level>0</Level>
|
||||
<IsParentLevel>true</IsParentLevel>
|
||||
<UniqueName>[Date].[Fiscal].[Fiscal Year].[FY 2005]</UniqueName>
|
||||
</MemberElement>
|
||||
</MemberElements>
|
||||
<IncludeAvailableMembers>true</IncludeAvailableMembers>
|
||||
</LevelElement>
|
||||
</LevelElements>
|
||||
</Hierarchy>
|
||||
<HierarchyName>Fiscal</HierarchyName>
|
||||
</ExcludedElementValue>
|
||||
</Item>
|
||||
</List>
|
||||
<IsFilterOrSortOn>false</IsFilterOrSortOn>
|
||||
</SeriesElements>
|
||||
<ShowEmptyColumnData>false</ShowEmptyColumnData>
|
||||
<ShowEmptyRowData>false</ShowEmptyRowData>
|
||||
<ShowExpanders>true</ShowExpanders>
|
||||
<SlicerElements>
|
||||
<List />
|
||||
<IsFilterOrSortOn>false</IsFilterOrSortOn>
|
||||
</SlicerElements>
|
||||
<TogglePivot>false</TogglePivot>
|
||||
</OlapReport>
|
||||
</ArrayOfOlapReport>
|
После Ширина: | Высота: | Размер: 70 KiB |
После Ширина: | Высота: | Размер: 67 KiB |
После Ширина: | Высота: | Размер: 71 KiB |
После Ширина: | Высота: | Размер: 61 KiB |
После Ширина: | Высота: | Размер: 60 KiB |
После Ширина: | Высота: | Размер: 65 KiB |
После Ширина: | Высота: | Размер: 68 KiB |
После Ширина: | Высота: | Размер: 70 KiB |
После Ширина: | Высота: | Размер: 69 KiB |
После Ширина: | Высота: | Размер: 66 KiB |
После Ширина: | Высота: | Размер: 64 KiB |
После Ширина: | Высота: | Размер: 72 KiB |
После Ширина: | Высота: | Размер: 79 KiB |
После Ширина: | Высота: | Размер: 65 KiB |
После Ширина: | Высота: | Размер: 72 KiB |
После Ширина: | Высота: | Размер: 73 KiB |
После Ширина: | Высота: | Размер: 58 KiB |
После Ширина: | Высота: | Размер: 67 KiB |
После Ширина: | Высота: | Размер: 68 KiB |
После Ширина: | Высота: | Размер: 53 KiB |
После Ширина: | Высота: | Размер: 57 KiB |
После Ширина: | Высота: | Размер: 65 KiB |
После Ширина: | Высота: | Размер: 60 KiB |
После Ширина: | Высота: | Размер: 66 KiB |
После Ширина: | Высота: | Размер: 45 KiB |
После Ширина: | Высота: | Размер: 16 KiB |
После Ширина: | Высота: | Размер: 50 KiB |
После Ширина: | Высота: | Размер: 54 KiB |
После Ширина: | Высота: | Размер: 70 KiB |
После Ширина: | Высота: | Размер: 62 KiB |
После Ширина: | Высота: | Размер: 61 KiB |
После Ширина: | Высота: | Размер: 67 KiB |
После Ширина: | Высота: | Размер: 49 KiB |
После Ширина: | Высота: | Размер: 75 KiB |
После Ширина: | Высота: | Размер: 73 KiB |
После Ширина: | Высота: | Размер: 68 KiB |
После Ширина: | Высота: | Размер: 68 KiB |
После Ширина: | Высота: | Размер: 87 KiB |
После Ширина: | Высота: | Размер: 31 KiB |
После Ширина: | Высота: | Размер: 234 B |
После Ширина: | Высота: | Размер: 232 B |
После Ширина: | Высота: | Размер: 232 B |
После Ширина: | Высота: | Размер: 306 B |
После Ширина: | Высота: | Размер: 1.0 KiB |
После Ширина: | Высота: | Размер: 1.3 KiB |
После Ширина: | Высота: | Размер: 721 B |
После Ширина: | Высота: | Размер: 3.3 KiB |
После Ширина: | Высота: | Размер: 1.1 KiB |
После Ширина: | Высота: | Размер: 643 B |
|
@ -0,0 +1,106 @@
|
|||
#region Copyright Syncfusion Inc. 2001-2022.
|
||||
// Copyright Syncfusion Inc. 2001-2022. All rights reserved.
|
||||
// Use of this code is subject to the terms of our license.
|
||||
// A copy of the current license can be obtained at any time by e-mailing
|
||||
// licensing@syncfusion.com. Any infringement will be prosecuted under
|
||||
// applicable laws.
|
||||
#endregion
|
||||
using Microsoft.Xaml.Behaviors;
|
||||
using Syncfusion.SfSkinManager;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace syncfusion.demoscommon.wpf
|
||||
{
|
||||
public static class DemoLaucherExtension
|
||||
{
|
||||
public static T LauchDemo<T>(DemoBrowserViewModel viewmodel, DemoInfo demoInfo) where T : DependencyObject
|
||||
{
|
||||
T demo;
|
||||
var constructorInfo = demoInfo.DemoViewType.GetConstructors().FirstOrDefault(cinfo => cinfo.IsPublic && cinfo.GetParameters().Length == 1 && cinfo.GetParameters()[0].Name == "themename");
|
||||
if (demoInfo.ThemeMode != ThemeMode.None && constructorInfo != null)
|
||||
{
|
||||
demo = Activator.CreateInstance(demoInfo.DemoViewType,
|
||||
demoInfo.ThemeMode == ThemeMode.Inherit ? viewmodel.SelectedThemeName : DemoBrowserViewModel.DefaultThemeName) as T;
|
||||
}
|
||||
else
|
||||
{
|
||||
demo = Activator.CreateInstance(demoInfo.DemoViewType) as T;
|
||||
if (demoInfo.ThemeMode == ThemeMode.Inherit)
|
||||
{
|
||||
SfSkinManager.SetTheme(demo, new Theme() { ThemeName = viewmodel.SelectedThemeName });
|
||||
}
|
||||
else if (demoInfo.ThemeMode == ThemeMode.Default)
|
||||
{
|
||||
SfSkinManager.SetTheme(demo, new Theme() { ThemeName = DemoBrowserViewModel.DefaultThemeName });
|
||||
}
|
||||
}
|
||||
return demo;
|
||||
}
|
||||
}
|
||||
|
||||
public class LaunchDemoAction : TriggerAction<Button>
|
||||
{
|
||||
protected override void Invoke(object parameter)
|
||||
{
|
||||
if (this.AssociatedObject == null)
|
||||
return;
|
||||
|
||||
var viewmodel = this.AssociatedObject.DataContext as DemoBrowserViewModel;
|
||||
if (viewmodel == null)
|
||||
return;
|
||||
|
||||
if ((viewmodel.SelectedProduct != null && viewmodel.SelectedProduct.DemoLauchMode == DemoLauchMode.Window)
|
||||
|| (viewmodel.SelectedSample != null && viewmodel.SelectedSample.DemoLauchMode == DemoLauchMode.Window))
|
||||
{
|
||||
try
|
||||
{
|
||||
if (viewmodel.SelectedSample.ShowBusyIndicator)
|
||||
{
|
||||
viewmodel.IsProductDemoBusy = true;
|
||||
}
|
||||
var window = DemoLaucherExtension.LauchDemo<Window>(viewmodel, viewmodel.SelectedSample);
|
||||
DemosNavigationService.MainWindow.Dispatcher.BeginInvoke(new Action(() =>
|
||||
{
|
||||
viewmodel.IsProductDemoBusy = false;
|
||||
}),
|
||||
System.Windows.Threading.DispatcherPriority.ApplicationIdle);
|
||||
|
||||
if (window != null)
|
||||
{
|
||||
window.Title = viewmodel.SelectedSample.Title;
|
||||
window.Owner = DemosNavigationService.MainWindow;
|
||||
window.WindowStartupLocation = WindowStartupLocation.CenterScreen;
|
||||
window.Closed += Window_Closed;
|
||||
window.ShowDialog();
|
||||
}
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
viewmodel.IsProductDemoBusy = false;
|
||||
ErrorWindow.Show(exception.Message + "\n" + exception.StackTrace);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void Window_Closed(object sender, EventArgs e)
|
||||
{
|
||||
(sender as Window).Closed -= Window_Closed;
|
||||
(sender as Window).Owner = null;
|
||||
if (this.AssociatedObject != null)
|
||||
return;
|
||||
|
||||
var viewmodel = this.AssociatedObject.DataContext as DemoBrowserViewModel;
|
||||
if (viewmodel == null)
|
||||
return;
|
||||
|
||||
viewmodel.SelectedProduct = null;
|
||||
viewmodel.SelectedSample = null;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,84 @@
|
|||
#region Copyright Syncfusion Inc. 2001-2022.
|
||||
// Copyright Syncfusion Inc. 2001-2022. All rights reserved.
|
||||
// Use of this code is subject to the terms of our license.
|
||||
// A copy of the current license can be obtained at any time by e-mailing
|
||||
// licensing@syncfusion.com. Any infringement will be prosecuted under
|
||||
// applicable laws.
|
||||
#endregion
|
||||
using Microsoft.Xaml.Behaviors;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace syncfusion.demoscommon.wpf
|
||||
{
|
||||
|
||||
public class LaunchShowcaseDemoAction : TriggerAction<ListView>
|
||||
{
|
||||
protected override void Invoke(object parameter)
|
||||
{
|
||||
if (this.AssociatedObject == null)
|
||||
return;
|
||||
|
||||
var viewmodel = this.AssociatedObject.DataContext as DemoBrowserViewModel;
|
||||
if (viewmodel == null)
|
||||
return;
|
||||
if (AssociatedObject != null && AssociatedObject.SelectedItem is DemoInfo && viewmodel != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
DemoInfo demo = AssociatedObject.SelectedItem as DemoInfo;
|
||||
if (demo.ShowBusyIndicator)
|
||||
{
|
||||
viewmodel.IsShowCaseDemoBusy = true;
|
||||
}
|
||||
var window = Activator.CreateInstance(demo.DemoViewType) as Window;
|
||||
viewmodel.SelectedShowcaseSample = demo;
|
||||
AssociatedObject.SelectedItem = null;
|
||||
|
||||
DemosNavigationService.MainWindow.Dispatcher.BeginInvoke(new Action(() =>
|
||||
{
|
||||
viewmodel.IsShowCaseDemoBusy = false;
|
||||
}),
|
||||
System.Windows.Threading.DispatcherPriority.ApplicationIdle);
|
||||
|
||||
if (window != null)
|
||||
{
|
||||
window.Owner = DemosNavigationService.MainWindow;
|
||||
window.WindowStartupLocation = WindowStartupLocation.CenterScreen;
|
||||
window.Closed += Window_Closed;
|
||||
window.ShowDialog();
|
||||
}
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
viewmodel.IsShowCaseDemoBusy = false;
|
||||
if (viewmodel != null)
|
||||
{
|
||||
if (viewmodel.SelectedProduct != null && viewmodel.SelectedSample != null)
|
||||
{
|
||||
ErrorLogging.LogError("Product Sample\\" + viewmodel.SelectedProduct.Product + "\\" + viewmodel.SelectedSample.SampleName + "@@" + exception.Message + "\n" + exception.StackTrace + "\n" + exception.Source);
|
||||
}
|
||||
else if (viewmodel.SelectedShowcaseSample != null)
|
||||
{
|
||||
ErrorLogging.LogError("Product ShowCase\\" + viewmodel.SelectedShowcaseSample.SampleName + "\\" + viewmodel.SelectedShowcaseSample.SampleName + "@@" + exception.Message + "\n" + exception.StackTrace + "\n" + exception.Source);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when the window is about to close.
|
||||
/// </summary>
|
||||
private void Window_Closed(object sender, EventArgs e)
|
||||
{
|
||||
(sender as Window).Closed -= Window_Closed;
|
||||
(sender as Window).Owner = null;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
#region Copyright Syncfusion Inc. 2001-2022.
|
||||
// Copyright Syncfusion Inc. 2001-2022. All rights reserved.
|
||||
// Use of this code is subject to the terms of our license.
|
||||
// A copy of the current license can be obtained at any time by e-mailing
|
||||
// licensing@syncfusion.com. Any infringement will be prosecuted under
|
||||
// applicable laws.
|
||||
#endregion
|
||||
using Microsoft.Xaml.Behaviors;
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace syncfusion.demoscommon.wpf
|
||||
{
|
||||
public class NavigateHomePageAction : TriggerAction<Button>
|
||||
{
|
||||
protected override void Invoke(object parameter)
|
||||
{
|
||||
if (DemosNavigationService.RootNavigationService.CanGoBack)
|
||||
{
|
||||
DemosNavigationService.RootNavigationService.GoBack();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,121 @@
|
|||
#region Copyright Syncfusion Inc. 2001-2022.
|
||||
// Copyright Syncfusion Inc. 2001-2022. All rights reserved.
|
||||
// Use of this code is subject to the terms of our license.
|
||||
// A copy of the current license can be obtained at any time by e-mailing
|
||||
// licensing@syncfusion.com. Any infringement will be prosecuted under
|
||||
// applicable laws.
|
||||
#endregion
|
||||
using Microsoft.Xaml.Behaviors;
|
||||
using Syncfusion.SfSkinManager;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace syncfusion.demoscommon.wpf
|
||||
{
|
||||
public class OpenSourceCodeAction : TriggerAction<Button>
|
||||
{
|
||||
protected override void Invoke(object parameter)
|
||||
{
|
||||
if (this.AssociatedObject == null)
|
||||
return;
|
||||
|
||||
var viewmodel = this.AssociatedObject.DataContext as DemoBrowserViewModel;
|
||||
if (AssociatedObject.DataContext is DemoBrowserViewModel)
|
||||
{
|
||||
if (viewmodel != null && viewmodel.SelectedSample != null && viewmodel.SelectedSample.DemoViewType != null)
|
||||
{
|
||||
var assembly = viewmodel.SelectedSample.DemoViewType.Assembly;
|
||||
OpenSourceCode(assembly, AssociatedObject.Name);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (AssociatedObject.TemplatedParent != null)
|
||||
{
|
||||
OpenSourceCode(AssociatedObject.TemplatedParent.GetType().Assembly, AssociatedObject.Name);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
private void OpenSourceCode(Assembly assembly, string buttonName)
|
||||
{
|
||||
string[] projectpath = assembly.FullName.Split(',');
|
||||
var folder = projectpath[0].Split('.')[1].Replace("demos", "");
|
||||
string frameworkVersion = "";
|
||||
string project = "";
|
||||
string root = "";
|
||||
if (buttonName == "openvisualstudio")
|
||||
{
|
||||
frameworkVersion = new System.Runtime.Versioning.FrameworkName(AppDomain.CurrentDomain.SetupInformation.TargetFrameworkName).Version.ToString();
|
||||
frameworkVersion = frameworkVersion.ToString().Replace(".", string.Empty);
|
||||
project = projectpath[0] + "_" + frameworkVersion + ".sln";
|
||||
root = System.IO.Path.GetFullPath(System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"..\\..\\" + folder + "\\" + project));
|
||||
}
|
||||
else if (buttonName == "opengithub")
|
||||
{
|
||||
root = "https://github.com/syncfusion/wpf-demos/tree/master/" + folder;
|
||||
}
|
||||
|
||||
if (!File.Exists(root) && buttonName == "openvisualstudio")
|
||||
{
|
||||
return;
|
||||
}
|
||||
try
|
||||
{
|
||||
var process = new ProcessStartInfo
|
||||
{
|
||||
FileName = root,
|
||||
UseShellExecute = true
|
||||
};
|
||||
Process.Start(process);
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
if (Application.Current.Windows[0].DataContext != null)
|
||||
{
|
||||
var viewModel = Application.Current.Windows[0].DataContext as DemoBrowserViewModel;
|
||||
if (viewModel.SelectedProduct != null && viewModel.SelectedSample != null)
|
||||
{
|
||||
ErrorLogging.LogError("Product Sample\\" + viewModel.SelectedProduct.Product + "\\" + viewModel.SelectedSample.SampleName + "@@" + "Requested directory not found." + exception.Message + "\n" + exception.StackTrace + "\n" + exception.Source);
|
||||
}
|
||||
else if (viewModel.SelectedShowcaseSample != null)
|
||||
{
|
||||
ErrorLogging.LogError("Product ShowCase\\" + viewModel.SelectedShowcaseSample.SampleName + "\\" + viewModel.SelectedShowcaseSample.SampleName + "@@" + "Requested directory not found." + exception.Message + "\n" + exception.StackTrace + "\n" + exception.Source);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class OpenSourceLoadedAction : TriggerAction<Button>
|
||||
{
|
||||
|
||||
|
||||
protected override void Invoke(object parameter)
|
||||
{
|
||||
if (this.AssociatedObject == null)
|
||||
return;
|
||||
if (DemoBrowserViewModel.IsStoreApp && AssociatedObject.Name == "opengithub")
|
||||
{
|
||||
AssociatedObject.Visibility = Visibility.Visible;
|
||||
}
|
||||
else if (!DemoBrowserViewModel.IsStoreApp && AssociatedObject.Name == "openvisualstudio")
|
||||
{
|
||||
string frameworkVersion = new System.Runtime.Versioning.FrameworkName(AppDomain.CurrentDomain.SetupInformation.TargetFrameworkName).Version.ToString();
|
||||
frameworkVersion = frameworkVersion.ToString().Replace(".", string.Empty);
|
||||
if (AppDomain.CurrentDomain.BaseDirectory.Contains("Binaries_" + frameworkVersion))
|
||||
{
|
||||
AssociatedObject.Visibility = Visibility.Visible;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,210 @@
|
|||
#region Copyright Syncfusion Inc. 2001-2022.
|
||||
// Copyright Syncfusion Inc. 2001-2022. All rights reserved.
|
||||
// Use of this code is subject to the terms of our license.
|
||||
// A copy of the current license can be obtained at any time by e-mailing
|
||||
// licensing@syncfusion.com. Any infringement will be prosecuted under
|
||||
// applicable laws.
|
||||
#endregion
|
||||
using Microsoft.Xaml.Behaviors;
|
||||
using Syncfusion.SfSkinManager;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace syncfusion.demoscommon.wpf
|
||||
{
|
||||
public class ProductsListBehavior : Behavior<ProductsListView>
|
||||
{
|
||||
/// <summary>
|
||||
/// Maintains view model refference
|
||||
/// </summary>
|
||||
private DemoBrowserViewModel sampleBrowserViewModel;
|
||||
|
||||
/// <summary>
|
||||
/// Maintains scroll viewer refference
|
||||
/// </summary>
|
||||
private ScrollViewer scrollViewer;
|
||||
|
||||
/// <summary>
|
||||
/// Called after the behavior is attached to an AssociatedObject.
|
||||
/// </summary>
|
||||
protected override void OnAttached()
|
||||
{
|
||||
AssociatedObject.Loaded += new System.Windows.RoutedEventHandler(AssociatedObject_Loaded);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the Loaded event of the AssociatedObject control.
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="System.Windows.RoutedEventArgs"/> instance containing the event data.</param>
|
||||
void AssociatedObject_Loaded(object sender, System.Windows.RoutedEventArgs e)
|
||||
{
|
||||
sampleBrowserViewModel = AssociatedObject.DataContext as DemoBrowserViewModel;
|
||||
AssociatedObject.LinkedInlink.RequestNavigate += LinkedInlink_RequestNavigate;
|
||||
AssociatedObject.youtubelink.RequestNavigate += LinkedInlink_RequestNavigate;
|
||||
AssociatedObject.twitterlink.RequestNavigate += LinkedInlink_RequestNavigate;
|
||||
AssociatedObject.facebooklink.RequestNavigate += LinkedInlink_RequestNavigate;
|
||||
AssociatedObject.Documentation.RequestNavigate += LinkedInlink_RequestNavigate;
|
||||
AssociatedObject.ShowAllShowcase.Click += ShowAllShowcase_Click;
|
||||
AssociatedObject.github.RequestNavigate += LinkedInlink_RequestNavigate;
|
||||
AssociatedObject.NavigateForward.Click += NavigateForward_Click;
|
||||
AssociatedObject.NavigateBackward.Click += NavigateBackward_Click;
|
||||
AssociatedObject.ShowcaseList.PreviewMouseWheel += ShowcaseList_PreviewMouseWheel;
|
||||
scrollViewer = Syncfusion.Windows.Shared.VisualUtils.FindDescendant(AssociatedObject.ShowcaseList, typeof(ScrollViewer)) as ScrollViewer;
|
||||
if (scrollViewer != null)
|
||||
{
|
||||
scrollViewer.ScrollChanged += ScrollViewer_ScrollChanged;
|
||||
var totalWidth = AssociatedObject.ShowcaseList.Items.Count * 308;
|
||||
if (totalWidth <= scrollViewer.ViewportWidth)
|
||||
{
|
||||
AssociatedObject.NavigateForward.IsEnabled = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when click Show all showcase demos button.
|
||||
/// </summary>
|
||||
private void ShowAllShowcase_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (sampleBrowserViewModel != null)
|
||||
{
|
||||
DemosNavigationService.RootNavigationService.Navigate(new ShowcaseDemos() { DataContext = sampleBrowserViewModel });
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when the mouse wheel of show case demos
|
||||
/// </summary>
|
||||
private void ShowcaseList_PreviewMouseWheel(object sender, System.Windows.Input.MouseWheelEventArgs e)
|
||||
{
|
||||
if (scrollViewer != null)
|
||||
{
|
||||
if (e.Delta > 0)
|
||||
scrollViewer.LineLeft();
|
||||
|
||||
else if (e.Delta < 0)
|
||||
scrollViewer.LineRight();
|
||||
}
|
||||
e.Handled = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when the previous Showcase Demos button is pressed.
|
||||
/// </summary>
|
||||
private void NavigateBackward_Click(object sender, System.Windows.RoutedEventArgs e)
|
||||
{
|
||||
if (scrollViewer != null)
|
||||
{
|
||||
Animate(scrollViewer, -Math.Floor(scrollViewer.ViewportWidth / 2));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when changes are detected to the scroll position, extent, or viewport size.
|
||||
/// </summary>
|
||||
private void ScrollViewer_ScrollChanged(object sender, ScrollChangedEventArgs e)
|
||||
{
|
||||
var target = sender as ScrollViewer;
|
||||
|
||||
if ((e.HorizontalOffset + e.ViewportWidth) == e.ExtentWidth)
|
||||
{
|
||||
AssociatedObject.NavigateForward.IsEnabled = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
AssociatedObject.NavigateForward.IsEnabled = true;
|
||||
}
|
||||
if (target.HorizontalOffset > 0)
|
||||
{
|
||||
AssociatedObject.NavigateBackward.IsEnabled = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
AssociatedObject.NavigateBackward.IsEnabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when the next Showcase Demos button is pressed.
|
||||
/// </summary>
|
||||
private void NavigateForward_Click(object sender, System.Windows.RoutedEventArgs e)
|
||||
{
|
||||
if (scrollViewer != null)
|
||||
{
|
||||
Animate(scrollViewer, Math.Floor(scrollViewer.ViewportWidth / 2));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Helps to perform showcase demo scrolling animation
|
||||
/// </summary>
|
||||
private void Animate(ScrollViewer target, double speed)
|
||||
{
|
||||
double startOffset = target.HorizontalOffset;
|
||||
double animationTime = 2;
|
||||
Stopwatch startTime = new Stopwatch();
|
||||
startTime.Start();
|
||||
EventHandler renderHandler = null;
|
||||
renderHandler = (sender, args) =>
|
||||
{
|
||||
double elapsed = startTime.Elapsed.TotalSeconds;
|
||||
|
||||
if (elapsed >= animationTime)
|
||||
{
|
||||
CompositionTarget.Rendering -= renderHandler;
|
||||
startTime.Stop();
|
||||
}
|
||||
|
||||
target.ScrollToHorizontalOffset(startOffset + (elapsed * speed));
|
||||
};
|
||||
CompositionTarget.Rendering += renderHandler;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when navigation events are requested.
|
||||
/// </summary>
|
||||
private void LinkedInlink_RequestNavigate(object sender, System.Windows.Navigation.RequestNavigateEventArgs e)
|
||||
{
|
||||
var process = new ProcessStartInfo
|
||||
{
|
||||
FileName = e.Uri.AbsoluteUri,
|
||||
UseShellExecute = true
|
||||
};
|
||||
Process.Start(process);
|
||||
e.Handled = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called when the behavior is being detached from its AssociatedObject, but before it has actually occurred.
|
||||
/// </summary>
|
||||
protected override void OnDetaching()
|
||||
{
|
||||
AssociatedObject.Loaded -= new System.Windows.RoutedEventHandler(AssociatedObject_Loaded);
|
||||
AssociatedObject.LinkedInlink.RequestNavigate -= LinkedInlink_RequestNavigate;
|
||||
AssociatedObject.youtubelink.RequestNavigate -= LinkedInlink_RequestNavigate;
|
||||
AssociatedObject.twitterlink.RequestNavigate -= LinkedInlink_RequestNavigate;
|
||||
AssociatedObject.facebooklink.RequestNavigate -= LinkedInlink_RequestNavigate;
|
||||
AssociatedObject.Documentation.RequestNavigate -= LinkedInlink_RequestNavigate;
|
||||
AssociatedObject.github.RequestNavigate -= LinkedInlink_RequestNavigate;
|
||||
AssociatedObject.NavigateForward.Click -= NavigateForward_Click;
|
||||
AssociatedObject.NavigateBackward.Click -= NavigateBackward_Click;
|
||||
AssociatedObject.ShowcaseList.PreviewMouseWheel -= ShowcaseList_PreviewMouseWheel;
|
||||
AssociatedObject.ShowAllShowcase.Click -= ShowAllShowcase_Click;
|
||||
scrollViewer.ScrollChanged -= ScrollViewer_ScrollChanged;
|
||||
if(scrollViewer != null)
|
||||
{
|
||||
scrollViewer = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,56 @@
|
|||
#region Copyright Syncfusion Inc. 2001-2022.
|
||||
// Copyright Syncfusion Inc. 2001-2022. All rights reserved.
|
||||
// Use of this code is subject to the terms of our license.
|
||||
// A copy of the current license can be obtained at any time by e-mailing
|
||||
// licensing@syncfusion.com. Any infringement will be prosecuted under
|
||||
// applicable laws.
|
||||
#endregion
|
||||
using Microsoft.Xaml.Behaviors;
|
||||
using Syncfusion.SfSkinManager;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace syncfusion.demoscommon.wpf
|
||||
{
|
||||
public class ScrollToSelectedItemAction : Behavior<ListView>
|
||||
{
|
||||
/// <summary>
|
||||
/// Called after the behavior is attached to an AssociatedObject.
|
||||
/// </summary>
|
||||
protected override void OnAttached()
|
||||
{
|
||||
base.OnAttached();
|
||||
this.AssociatedObject.SelectionChanged += AssociatedObject_SelectionChanged;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when the selection of product demos
|
||||
/// </summary>
|
||||
void AssociatedObject_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
if (sender is ListView)
|
||||
{
|
||||
ListView demolist = (sender as ListView);
|
||||
if (demolist.SelectedItem != null)
|
||||
{
|
||||
demolist.ScrollIntoView(demolist.SelectedItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called when the behavior is being detached from its AssociatedObject, but before it has actually occurred.
|
||||
/// </summary>
|
||||
protected override void OnDetaching()
|
||||
{
|
||||
base.OnDetaching();
|
||||
this.AssociatedObject.SelectionChanged -= AssociatedObject_SelectionChanged;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
#region Copyright Syncfusion Inc. 2001-2022.
|
||||
// Copyright Syncfusion Inc. 2001-2022. All rights reserved.
|
||||
// Use of this code is subject to the terms of our license.
|
||||
// A copy of the current license can be obtained at any time by e-mailing
|
||||
// licensing@syncfusion.com. Any infringement will be prosecuted under
|
||||
// applicable laws.
|
||||
#endregion
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace syncfusion.demoscommon.wpf
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Value converter that applies NOT operator to a <see cref="bool"/> value.
|
||||
/// </summary>
|
||||
public class BoolNegationConverter : IValueConverter
|
||||
{
|
||||
/// <summary>
|
||||
/// Convert a boolean value to its negation.
|
||||
/// </summary>
|
||||
/// <param name="value">The <see cref="bool"/> value to negate.</param>
|
||||
/// <param name="targetType">The type of the target property, as a type reference.</param>
|
||||
/// <param name="parameter">Optional parameter. Not used.</param>
|
||||
/// <param name="language">The language of the conversion. Not used</param>
|
||||
/// <returns>The value to be passed to the target dependency property.</returns>
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
return !(value is bool && (bool)value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Convert back a boolean value to its negation.
|
||||
/// </summary>
|
||||
/// <param name="value">The <see cref="bool"/> value to negate.</param>
|
||||
/// <param name="targetType">The type of the target property, as a type reference.</param>
|
||||
/// <param name="parameter">Optional parameter. Not used.</param>
|
||||
/// <param name="language">The language of the conversion. Not used</param>
|
||||
/// <returns>The value to be passed to the target dependency property.</returns>
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
return !(value is bool && (bool)value);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,145 @@
|
|||
#region Copyright Syncfusion Inc. 2001-2022.
|
||||
// Copyright Syncfusion Inc. 2001-2022. All rights reserved.
|
||||
// Use of this code is subject to the terms of our license.
|
||||
// A copy of the current license can be obtained at any time by e-mailing
|
||||
// licensing@syncfusion.com. Any infringement will be prosecuted under
|
||||
// applicable laws.
|
||||
#endregion
|
||||
using Syncfusion.Windows.Shared;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.ComponentModel;
|
||||
using System.Globalization;
|
||||
using System.Windows;
|
||||
using System.Windows.Data;
|
||||
using System.Collections.Generic;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace syncfusion.demoscommon.wpf
|
||||
{
|
||||
/// <summary>
|
||||
/// This class converts a boolean value into an other object.
|
||||
/// Can be used to convert true/false to visibility, a couple of colors, couple of images, etc.
|
||||
/// </summary>
|
||||
public class BoolToObjectConverter : DependencyObject, IValueConverter
|
||||
{
|
||||
/// <summary>
|
||||
/// Identifies the <see cref="TrueValue"/> property.
|
||||
/// </summary>
|
||||
public static readonly DependencyProperty TrueValueProperty =
|
||||
DependencyProperty.Register(nameof(TrueValue), typeof(object), typeof(BoolToObjectConverter), new PropertyMetadata(null));
|
||||
|
||||
/// <summary>
|
||||
/// Identifies the <see cref="FalseValue"/> property.
|
||||
/// </summary>
|
||||
public static readonly DependencyProperty FalseValueProperty =
|
||||
DependencyProperty.Register(nameof(FalseValue), typeof(object), typeof(BoolToObjectConverter), new PropertyMetadata(null));
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the value to be returned when the boolean is true
|
||||
/// </summary>
|
||||
public object TrueValue
|
||||
{
|
||||
get { return GetValue(TrueValueProperty); }
|
||||
set { SetValue(TrueValueProperty, value); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the value to be returned when the boolean is false
|
||||
/// </summary>
|
||||
public object FalseValue
|
||||
{
|
||||
get { return GetValue(FalseValueProperty); }
|
||||
set { SetValue(FalseValueProperty, value); }
|
||||
}
|
||||
|
||||
public bool CanConvertToTargetType
|
||||
{
|
||||
get { return (bool)GetValue(CanConvertToTargetTypeProperty); }
|
||||
set { SetValue(CanConvertToTargetTypeProperty, value); }
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty CanConvertToTargetTypeProperty =
|
||||
DependencyProperty.Register("CanConvertToTargetType", typeof(bool), typeof(BoolToObjectConverter), new PropertyMetadata(true));
|
||||
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
bool boolValue = value is bool && (bool)value;
|
||||
|
||||
if (TypeConverterHelper.ChanngeTypeToBool(parameter))
|
||||
{
|
||||
boolValue = !boolValue;
|
||||
}
|
||||
|
||||
if (CanConvertToTargetType)
|
||||
return TypeConverterHelper.ChangeType(boolValue ? TrueValue : FalseValue, targetType);
|
||||
else
|
||||
return boolValue? TrueValue : FalseValue;
|
||||
}
|
||||
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
bool result = Equals(value, TypeConverterHelper.ChangeType(TrueValue, value.GetType()));
|
||||
|
||||
if (TypeConverterHelper.ChanngeTypeToBool(parameter))
|
||||
{
|
||||
result = !result;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
internal static class TypeConverterHelper
|
||||
{
|
||||
internal static bool ChanngeTypeToBool(object parameter)
|
||||
{
|
||||
var parsed = false;
|
||||
if (parameter != null && bool.TryParse(parameter.ToString(), out parsed))
|
||||
{
|
||||
return parsed;
|
||||
}
|
||||
|
||||
return parsed;
|
||||
}
|
||||
|
||||
public static object ChangeType(object value, Type type)
|
||||
{
|
||||
return ChangeType(value, type, null);
|
||||
}
|
||||
|
||||
public static object ChangeType(object value, Type type, IFormatProvider provider)
|
||||
{
|
||||
if (type == null)
|
||||
return value;
|
||||
|
||||
if (value == null)
|
||||
return null;
|
||||
|
||||
if (type.FullName.Contains("System.Collections.Generic.IComparer`1[[Syncfusion.Data.Group"))
|
||||
{
|
||||
return value;
|
||||
}
|
||||
|
||||
if (type == typeof(ImageSource))
|
||||
{
|
||||
return value;
|
||||
}
|
||||
|
||||
TypeConverter typeConverter = TypeDescriptor.GetConverter(value.GetType());
|
||||
if (typeConverter != null && typeConverter.CanConvertTo(type))
|
||||
return typeConverter.ConvertTo(value, type);
|
||||
|
||||
if (value is DBNull)
|
||||
return DBNull.Value;
|
||||
|
||||
|
||||
if (type.IsEnum)
|
||||
{
|
||||
return Enum.Parse(type, Convert.ToString(value));
|
||||
}
|
||||
return Convert.ChangeType(value, type, provider);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
#region Copyright Syncfusion Inc. 2001-2022.
|
||||
// Copyright Syncfusion Inc. 2001-2022. All rights reserved.
|
||||
// Use of this code is subject to the terms of our license.
|
||||
// A copy of the current license can be obtained at any time by e-mailing
|
||||
// licensing@syncfusion.com. Any infringement will be prosecuted under
|
||||
// applicable laws.
|
||||
#endregion
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace syncfusion.demoscommon.wpf
|
||||
{
|
||||
/// <summary>
|
||||
/// Convert between boolean and visibility
|
||||
/// </summary>
|
||||
public sealed class BooleanToVisibilityConverter : BoolToObjectConverter
|
||||
{
|
||||
public BooleanToVisibilityConverter()
|
||||
{
|
||||
TrueValue = Visibility.Visible;
|
||||
FalseValue = Visibility.Collapsed;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
#region Copyright Syncfusion Inc. 2001-2022.
|
||||
// Copyright Syncfusion Inc. 2001-2022. All rights reserved.
|
||||
// Use of this code is subject to the terms of our license.
|
||||
// A copy of the current license can be obtained at any time by e-mailing
|
||||
// licensing@syncfusion.com. Any infringement will be prosecuted under
|
||||
// applicable laws.
|
||||
#endregion
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
|
||||
namespace syncfusion.demoscommon.wpf
|
||||
{
|
||||
/// <summary>
|
||||
/// This class converts a collection size to visibility.
|
||||
/// </summary>
|
||||
public class CollectionVisibilityConverter : EmptyCollectionToObjectConverter
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="CollectionVisibilityConverter"/> class.
|
||||
/// </summary>
|
||||
public CollectionVisibilityConverter()
|
||||
{
|
||||
NotEmptyValue = Visibility.Visible;
|
||||
EmptyValue = Visibility.Collapsed;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
#region Copyright Syncfusion Inc. 2001-2022.
|
||||
// Copyright Syncfusion Inc. 2001-2022. All rights reserved.
|
||||
// Use of this code is subject to the terms of our license.
|
||||
// A copy of the current license can be obtained at any time by e-mailing
|
||||
// licensing@syncfusion.com. Any infringement will be prosecuted under
|
||||
// applicable laws.
|
||||
#endregion
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace syncfusion.demoscommon.wpf
|
||||
{
|
||||
/// <summary>
|
||||
/// This class converts a collection size into an other object.
|
||||
/// Can be used to convert to bind a visibility, a color or an image to the size of the collection.
|
||||
/// </summary>
|
||||
public class EmptyCollectionToObjectConverter : EmptyObjectToObjectConverter
|
||||
{
|
||||
/// <summary>
|
||||
/// Checks collection for emptiness.
|
||||
/// </summary>
|
||||
/// <param name="value">Value to be checked.</param>
|
||||
/// <returns>True if value is an empty collection or does not implement IEnumerable, false otherwise.</returns>
|
||||
protected override bool CheckValueIsEmpty(object value)
|
||||
{
|
||||
bool isEmpty = true;
|
||||
var collection = value as IEnumerable;
|
||||
if (collection != null)
|
||||
{
|
||||
var enumerator = collection.GetEnumerator();
|
||||
isEmpty = !enumerator.MoveNext();
|
||||
}
|
||||
|
||||
return isEmpty;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,93 @@
|
|||
#region Copyright Syncfusion Inc. 2001-2022.
|
||||
// Copyright Syncfusion Inc. 2001-2022. All rights reserved.
|
||||
// Use of this code is subject to the terms of our license.
|
||||
// A copy of the current license can be obtained at any time by e-mailing
|
||||
// licensing@syncfusion.com. Any infringement will be prosecuted under
|
||||
// applicable laws.
|
||||
#endregion
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace syncfusion.demoscommon.wpf
|
||||
{
|
||||
/// <summary>
|
||||
/// This class converts an object value into a an object (if the value is null returns the false value).
|
||||
/// Can be used to bind a visibility, a color or an image to the value of an object.
|
||||
/// </summary>
|
||||
public class EmptyObjectToObjectConverter : DependencyObject, IValueConverter
|
||||
{
|
||||
/// <summary>
|
||||
/// Identifies the <see cref="NotEmptyValue"/> property.
|
||||
/// </summary>
|
||||
public static readonly DependencyProperty NotEmptyValueProperty =
|
||||
DependencyProperty.Register(nameof(NotEmptyValue), typeof(object), typeof(EmptyObjectToObjectConverter), new PropertyMetadata(null));
|
||||
|
||||
/// <summary>
|
||||
/// Identifies the <see cref="EmptyValue"/> property.
|
||||
/// </summary>
|
||||
public static readonly DependencyProperty EmptyValueProperty =
|
||||
DependencyProperty.Register(nameof(EmptyValue), typeof(object), typeof(EmptyObjectToObjectConverter), new PropertyMetadata(null));
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the value to be returned when the object is neither null nor empty
|
||||
/// </summary>
|
||||
public object NotEmptyValue
|
||||
{
|
||||
get { return GetValue(NotEmptyValueProperty); }
|
||||
set { SetValue(NotEmptyValueProperty, value); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the value to be returned when the object is either null or empty
|
||||
/// </summary>
|
||||
public object EmptyValue
|
||||
{
|
||||
get { return GetValue(EmptyValueProperty); }
|
||||
set { SetValue(EmptyValueProperty, value); }
|
||||
}
|
||||
|
||||
public bool CanConvertToTargetType
|
||||
{
|
||||
get { return (bool)GetValue(CanConvertToTargetTypeProperty); }
|
||||
set { SetValue(CanConvertToTargetTypeProperty, value); }
|
||||
}
|
||||
|
||||
// Using a DependencyProperty as the backing store for CanConvertToTargetType. This enables animation, styling, binding, etc...
|
||||
public static readonly DependencyProperty CanConvertToTargetTypeProperty =
|
||||
DependencyProperty.Register("CanConvertToTargetType", typeof(bool), typeof(EmptyObjectToObjectConverter), new PropertyMetadata(true));
|
||||
|
||||
|
||||
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
var isEmpty = CheckValueIsEmpty(value);
|
||||
|
||||
if (TypeConverterHelper.ChanngeTypeToBool(parameter))
|
||||
{
|
||||
isEmpty = !isEmpty;
|
||||
}
|
||||
|
||||
if (CanConvertToTargetType)
|
||||
return TypeConverterHelper.ChangeType(isEmpty ? EmptyValue : NotEmptyValue, targetType);
|
||||
else
|
||||
return isEmpty ? EmptyValue : NotEmptyValue;
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks value for emptiness.
|
||||
/// </summary>
|
||||
/// <param name="value">Value to be checked.</param>
|
||||
/// <returns>True if value is null, false otherwise.</returns>
|
||||
protected virtual bool CheckValueIsEmpty(object value)
|
||||
{
|
||||
return value == null;
|
||||
}
|
||||
}
|
||||
}
|