Merge pull request #229 from telerik/development

Development
This commit is contained in:
Atanas Popatanasov 2018-01-17 16:32:10 +02:00 коммит произвёл GitHub
Родитель 437868d87c 20b42e4a45
Коммит fc34afa30b
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
45 изменённых файлов: 712 добавлений и 228 удалений

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

@ -1,2 +1,2 @@
SET MSBUILD=%WINDIR%\microsoft.net\framework\v4.0.30319\MSBuild.exe
%MSBUILD% BuildNuget.UWP.proj /property:Version=1.0.0.7
%MSBUILD% BuildNuget.UWP.proj /property:Version=1.0.0.8

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

@ -15,7 +15,7 @@
<Target Name="PrepareNugetProperties">
<PropertyGroup>
<Version Condition= " '$(Version)' == '' ">1.0.0.7</Version>
<Version Condition= " '$(Version)' == '' ">1.0.0.8</Version>
<FullPathDeployDirectory>$([System.IO.Path]::GetFullPath('$(DeployDirectory)'))</FullPathDeployDirectory>
<BinariesSubDir>$(BinariesTargetDirectory)</BinariesSubDir>

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

@ -135,10 +135,12 @@ namespace Telerik.UI.Xaml.Controls.Data
Binding rangeB = new Binding();
rangeB.Path = new PropertyPath("Range.Min");
rangeB.FallbackValue = double.MinValue;
this.SetBinding(NumericEditor.MinimumProperty, rangeB);
rangeB = new Binding();
rangeB.Path = new PropertyPath("Range.Max");
rangeB.FallbackValue = double.MaxValue;
this.SetBinding(NumericEditor.MaximumProperty, rangeB);
}
}

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

@ -271,8 +271,8 @@
<Style TargetType="local:NumericEditor">
<Setter Property="ButtonsBackground" Value="{ThemeResource TelerikNumericBoxSpinButtonBackgroundBrush}"/>
<Setter Property="ButtonsPointerOverBackgroundBrush" Value="{ThemeResource TelerikNumericBoxSpinButtonPointerOverBackgroundBrush}"/>
<Setter Property="Minimum" Value="0"/>
<Setter Property="Maximum" Value="100"/>
<Setter Property="Minimum" Value="-2147483648"/>
<Setter Property="Maximum" Value="2147483648"/>
<Setter Property="FontFamily" Value="{StaticResource ContentControlThemeFontFamily}"/>
<Setter Property="FontSize" Value="{StaticResource ControlContentThemeFontSize}" />
<Setter Property="MinWidth" Value="180"/>
@ -1024,4 +1024,4 @@
<!-- ListView end -->
</ResourceDictionary>
</ResourceDictionary>

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

@ -464,7 +464,8 @@ namespace Telerik.UI.Xaml.Controls.Grid
internal void Update(UpdateFlags flags)
{
if ((flags & UpdateFlags.AffectsContent) == UpdateFlags.AffectsContent)
if ((flags & UpdateFlags.AffectsContent) == UpdateFlags.AffectsContent
|| (flags & UpdateFlags.AffectsColumnHeader) == UpdateFlags.AffectsColumnHeader)
{
this.FullyRecycle();
}

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

@ -712,9 +712,11 @@
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="2"/>
</Grid.ColumnDefinitions>
<Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" >
<localPrimitives:DataGridFlyoutPanel VerticalAlignment="{TemplateBinding VerticalAlignment}" x:Name="PART_HeadersContainer" Margin="{TemplateBinding Padding}" />
</Border>
<ScrollViewer ScrollViewer.VerticalScrollBarVisibility="Auto">
<Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" >
<localPrimitives:DataGridFlyoutPanel VerticalAlignment="{TemplateBinding VerticalAlignment}" x:Name="PART_HeadersContainer" Margin="{TemplateBinding Padding}" />
</Border>
</ScrollViewer>
<Canvas x:Name="PART_AdornerHost" IsHitTestVisible="False"/>
<Rectangle Fill="{ThemeResource TelerikGridShadowBrush}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Grid.Column="1"/>
</Grid>
@ -817,19 +819,20 @@
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Border Grid.Column="1" Grid.Row="0" x:Name="BorderElement" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}">
<Grid >
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition/>
</Grid.RowDefinitions>
<localPrimitives:FlyoutHeaderControl Style="{TemplateBinding HeaderStyle}"/>
<Image x:Name="PART_CloseButton" Source="{ThemeResource TelerikGridColumnChooserClose}" Height="42" Width="42" HorizontalAlignment="Right" VerticalAlignment="Top" Grid.RowSpan="2"/>
<Image x:Name="CloseMouseOverButton" IsHitTestVisible="False" Source="{ThemeResource TelerikGridColumnChooserCloseMouseOver}" Visibility="Collapsed" Height="42" Width="42" Grid.RowSpan="2" HorizontalAlignment="Right" VerticalAlignment="Top" />
<localPrimitives:DataGridFlyoutPanel VerticalAlignment="{TemplateBinding VerticalAlignment}" Margin="{TemplateBinding Padding}" Grid.Row="1" x:Name="PART_HeadersContainer"/>
<Image x:Name="CloseMouseOverButton" IsHitTestVisible="False" Source="{ThemeResource TelerikGridColumnChooserCloseMouseOver}" Visibility="Collapsed" Height="42" Width="42" Grid.RowSpan="2" HorizontalAlignment="Right" VerticalAlignment="Top" />
<ScrollViewer Grid.Row="1" ScrollViewer.VerticalScrollBarVisibility="Auto">
<localPrimitives:DataGridFlyoutPanel VerticalAlignment="{TemplateBinding VerticalAlignment}" Margin="{TemplateBinding Padding}" x:Name="PART_HeadersContainer"/>
</ScrollViewer>
</Grid>
</Border>
<Canvas x:Name="PART_AdornerHost" IsHitTestVisible="False"/>
<Rectangle x:Name="ShadowElement" Fill="{ThemeResource TelerikGridShadowBrush}" />
</Grid>
</ControlTemplate>

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

@ -101,9 +101,37 @@ namespace Telerik.UI.Xaml.Controls.Grid
}
}
internal abstract object GetEditorType(object item);
/// <summary>
/// Gets the type of the editor that is visualized when entering in edit mode.
/// </summary>
/// <returns>The type of the editor.</returns>
public abstract object GetEditorType(object item);
internal abstract object GetContainerType(object rowItem);
/// <summary>
/// Creates an instance of the control visualized when the column is not edited.
/// </summary>
/// <returns>An instance of the control.</returns>
public abstract object CreateContainer(object rowItem);
/// <summary>
/// Gets the type of the control visualized when the cell is not currently edited.
/// </summary>
/// <returns>The type of the control.</returns>
public abstract object GetContainerType(object rowItem);
/// <summary>
/// Prepares the control visualized by the cell when it is not edited.
/// </summary>
/// <param name="container">The container visualizing the cell data when it is not edited.</param>
public abstract void PrepareCell(object container, object value, object item);
/// <summary>
/// Clears the bindings, data etc. of the control visualized by the cell when it is not edited.
/// </summary>
/// <param name="container">The container visualizing the cell data when it is not edited.</param>
public virtual void ClearCell(object container)
{
}
internal void PrepareCellDecoration(GridCellModel cell)
{
@ -127,10 +155,14 @@ namespace Telerik.UI.Xaml.Controls.Grid
}
}
internal abstract void PrepareCell(GridCellModel cell);
internal virtual void ClearCell(GridCellModel cell)
internal void PrepareCell(GridCellModel cell)
{
this.PrepareCell(cell.Container, cell.Value, cell.ParentRow.ItemInfo.Item);
}
internal void ClearCell(GridCellModel cell)
{
this.ClearCell(cell.Container);
}
internal virtual RadSize MeasureCell(GridCellModel cell, double availableWidth)
@ -324,8 +356,6 @@ namespace Telerik.UI.Xaml.Controls.Grid
return layoutSlot;
}
internal abstract object CreateContainer(object rowItem);
internal abstract object CreateEditorContainer(object rowItem, object containerType);
internal abstract void PrepareEditorContainer(GridCellEditorModel editor);
@ -359,14 +389,14 @@ namespace Telerik.UI.Xaml.Controls.Grid
{
var definition = d as DataGridColumn;
definition.cellDecorationStyleCache = e.NewValue as Style;
definition.OnProperyChange(UpdateFlags.AffectsContent);
definition.OnPropertyChange(UpdateFlags.AffectsContent);
}
private static void OnCellDecorationStyleSelectorChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var definition = d as DataGridColumn;
definition.cellDecorationStyleSelectorCache = e.NewValue as StyleSelector;
definition.OnProperyChange(UpdateFlags.AffectsContent);
definition.OnPropertyChange(UpdateFlags.AffectsContent);
}
private Style ComposeCellDecorationStyle(GridCellModel cell)

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

@ -553,7 +553,7 @@ namespace Telerik.UI.Xaml.Controls.Grid
return null;
}
internal void OnProperyChange(UpdateFlags flags)
internal void OnPropertyChange(UpdateFlags flags)
{
if (this.Model != null)
{
@ -708,6 +708,7 @@ namespace Telerik.UI.Xaml.Controls.Grid
}
column.isUserHeader = column.headerCache != null;
column.OnPropertyChange(UpdateFlags.AffectsColumnHeader);
}
private static void OnWidthChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
@ -715,7 +716,7 @@ namespace Telerik.UI.Xaml.Controls.Grid
var column = d as DataGridColumn;
column.widthCache = (double)e.NewValue;
column.OnProperyChange(UpdateFlags.AllButData);
column.OnPropertyChange(UpdateFlags.AllButData);
}
private static void OnSizeModeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
@ -728,14 +729,14 @@ namespace Telerik.UI.Xaml.Controls.Grid
column.AutoWidth = 0;
}
column.OnProperyChange(UpdateFlags.AllButData);
column.OnPropertyChange(UpdateFlags.AllButData);
}
private static void OnHeaderStyleChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var definition = d as DataGridColumn;
definition.headerStyleCache = e.NewValue as Style;
definition.OnProperyChange(UpdateFlags.AllButData);
definition.OnPropertyChange(UpdateFlags.AllButData);
}
private static void OnCanUserFilterChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
@ -743,7 +744,7 @@ namespace Telerik.UI.Xaml.Controls.Grid
var column = d as DataGridColumn;
// TODO: possible optimization
column.OnProperyChange(UpdateFlags.AllButData);
column.OnPropertyChange(UpdateFlags.AllButData);
}
private static void OnCanUserSortChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)

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

@ -163,34 +163,29 @@ namespace Telerik.UI.Xaml.Controls.Grid
return instance;
}
internal override object GetEditorType(object item)
/// <summary>
/// Gets the type of the editor for the DataGridTemplateColumn that is visualized when entering in edit mode.
/// </summary>
/// <returns>The type of the editor.</returns>
public override object GetEditorType(object item)
{
return this.ComposeCellContentTemplate(item) ?? EmptyDataTemplate;
}
internal override object GetContainerType(object rowItem)
/// <summary>
/// Gets the type of the control visualized when the template column is not currently edited.
/// </summary>
/// <returns>The type of the control.</returns>
public override object GetContainerType(object rowItem)
{
return this.ComposeCellContentTemplate(rowItem) ?? EmptyDataTemplate;
}
internal override void PrepareCell(GridCellModel cell)
{
InvalidateCellUI(cell.Container);
FrameworkElement container = cell.Container as FrameworkElement;
if (container != null)
{
//// Force clear Selector.SelectedItem value when it is bound and data does not have value for selected item.
////Clear dataContext to force bindings and fix issue with ExpandoObjects.
//// if (container is Selector)
container.DataContext = null;
container.DataContext = cell.Value;
}
}
internal override object CreateContainer(object rowItem)
/// <summary>
/// Creates an instance of a FrameworkElement visualized when the column is not edited.
/// </summary>
/// <returns>An instance of the control.</returns>
public override object CreateContainer(object rowItem)
{
var template = this.ComposeCellContentTemplate(rowItem);
if (template == null)
@ -207,6 +202,23 @@ namespace Telerik.UI.Xaml.Controls.Grid
return container;
}
public override void PrepareCell(object container, object value, object item)
{
InvalidateCellUI(container);
FrameworkElement cellContainer = container as FrameworkElement;
if (cellContainer != null)
{
//// Force clear Selector.SelectedItem value when it is bound and data does not have value for selected item.
////Clear dataContext to force bindings and fix issue with ExpandoObjects.
//// if (container is Selector)
cellContainer.DataContext = null;
cellContainer.DataContext = value;
}
}
internal override object CreateEditorContainer(object rowItem, object containerType)
{
var contrainer = this.CreateContainer(rowItem) as FrameworkElement;
@ -321,7 +333,7 @@ namespace Telerik.UI.Xaml.Controls.Grid
var definition = d as DataGridTemplateColumn;
definition.cellContentTemplateCache = e.NewValue as DataTemplate;
definition.OnProperyChange(UpdateFlags.AffectsContent);
definition.OnPropertyChange(UpdateFlags.AffectsContent);
}
private static void OnCellContentTemplateSelectorChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
@ -329,7 +341,7 @@ namespace Telerik.UI.Xaml.Controls.Grid
DataGridTemplateColumn definition = d as DataGridTemplateColumn;
definition.cellContentTemplateSelectorCache = e.NewValue as DataTemplateSelector;
definition.OnProperyChange(UpdateFlags.AffectsContent);
definition.OnPropertyChange(UpdateFlags.AffectsContent);
}
private static void OnSortDescriptorChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)

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

@ -64,26 +64,57 @@ namespace Telerik.UI.Xaml.Controls.Grid
get { return this.PropertyInfoInitialized && this.PropertyInfo.DataType == DataGridBooleanColumn.booleanType && this.CanUserEdit; }
}
internal override object GetEditorType(object item)
/// <summary>
/// Gets the type of the editor for the DataGridBooleanColumn that is visualized when entering in edit mode.
/// </summary>
/// <returns>The type of the editor.</returns>
public override object GetEditorType(object item)
{
return this.CanEdit ? DataGridBooleanColumn.checkBoxType : DataGridBooleanColumn.TextBlockType;
}
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Globalization", "CA1303:Do not pass literals as localized parameters", MessageId = "Windows.UI.Xaml.Controls.TextBlock.put_Text(System.String)")]
internal override void PrepareCell(GridCellModel cell)
/// <summary>
/// Creates an instance of a Checkbox used by the column when entering edit mode.
/// </summary>
/// <returns>An instance of the editor.</returns>
public override FrameworkElement CreateEditorContentVisual()
{
base.PrepareCell(cell);
return new CheckBox();
}
var textBlock = cell.Container as TextBlock;
/// <summary>
/// Clears all bindings and content set to the CheckBox visualized when entering edit mode.
/// </summary>
/// <param name="editorContent">The editor itself.</param>
public override void ClearEditorContentVisual(FrameworkElement editorContent)
{
editorContent.ClearValue(CheckBox.IsCheckedProperty);
}
/// <summary>
/// Prepares all bindings and content set to the CheckBox visualized when entering edit mode.
/// </summary>
/// <param name="editorContent">The editor itself.</param>
public override void PrepareEditorContentVisual(FrameworkElement editorContent, Binding binding)
{
editorContent.SetBinding(CheckBox.IsCheckedProperty, binding);
}
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Globalization", "CA1303:Do not pass literals as localized parameters", MessageId = "Windows.UI.Xaml.Controls.TextBlock.put_Text(System.String)")]
public override void PrepareCell(object container, object value, object item)
{
base.PrepareCell(container, value, item);
var textBlock = container as TextBlock;
if (textBlock == null)
{
return;
}
bool? value = (bool?)cell.Value;
if (value.HasValue)
bool? cellValue = (bool?)value;
if (cellValue.HasValue)
{
textBlock.Text = value.Value ? CheckedGlyph : UncheckedGlyph;
textBlock.Text = cellValue.Value ? CheckedGlyph : UncheckedGlyph;
}
else
{
@ -91,21 +122,6 @@ namespace Telerik.UI.Xaml.Controls.Grid
}
}
internal override FrameworkElement CreateEditorContentVisual()
{
return new CheckBox();
}
internal override void ClearEditorContentVisual(FrameworkElement editorContent)
{
editorContent.ClearValue(CheckBox.IsCheckedProperty);
}
internal override void PrepareEditorContentVisual(FrameworkElement editorContent, Binding binding)
{
editorContent.SetBinding(CheckBox.IsCheckedProperty, binding);
}
/// <summary>
/// Creates the <see cref="DataGridBooleanFilterControl" /> instance that allows filtering operation to be applied upon this column.
/// </summary>

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

@ -163,14 +163,20 @@ namespace Telerik.UI.Xaml.Controls.Grid
return item;
}
/// <inheritdoc/>
internal override object GetEditorType(object item)
/// <summary>
/// Gets the type of the editor for the DataGridComboBoxColumn that is visualized when entering in edit mode.
/// </summary>
/// <returns>The type of the editor.</returns>
public override object GetEditorType(object item)
{
return this.CanEdit ? comboBoxType : DataGridNumericalColumn.TextBlockType;
}
/// <inheritdoc/>
internal override FrameworkElement CreateEditorContentVisual()
/// <summary>
/// Creates an instance of a ComboBox used by the column when entering edit mode.
/// </summary>
/// <returns>An instance of the editor.</returns>
public override FrameworkElement CreateEditorContentVisual()
{
var comboBoxEditor = new ComboBox();
comboBoxEditor.Unloaded += this.OnComboBoxUnloaded;
@ -178,8 +184,11 @@ namespace Telerik.UI.Xaml.Controls.Grid
return comboBoxEditor;
}
/// <inheritdoc/>
internal override void PrepareEditorContentVisual(FrameworkElement editorContent, Binding binding)
/// <summary>
/// Prepares all bindings and content set to the ComboBox visualized when entering edit mode.
/// </summary>
/// <param name="editorContent">The editor itself.</param>
public override void PrepareEditorContentVisual(FrameworkElement editorContent, Binding binding)
{
var item = binding.Source;
@ -235,8 +244,11 @@ namespace Telerik.UI.Xaml.Controls.Grid
}
}
/// <inheritdoc/>
internal override void ClearEditorContentVisual(FrameworkElement editorContent)
/// <summary>
/// Clears all bindings and content set to the ComboBox visualized when entering edit mode.
/// </summary>
/// <param name="editorContent">The editor itself.</param>
public override void ClearEditorContentVisual(FrameworkElement editorContent)
{
if (!string.IsNullOrEmpty(this.SelectedValuePath))
{
@ -320,7 +332,7 @@ namespace Telerik.UI.Xaml.Controls.Grid
if (column.itemsType != null)
{
column.itemPropertyGetter = BindingExpressionHelper.CreateGetValueFunc(column.itemsType, (string)e.NewValue);
column.OnProperyChange(UpdateFlags.All);
column.OnPropertyChange(UpdateFlags.All);
}
}

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

@ -39,24 +39,40 @@ namespace Telerik.UI.Xaml.Controls.Grid
get { return this.PropertyInfoInitialized && this.PropertyInfo.DataType.GetTypeInfo().IsAssignableFrom(dateTypeInfo) && this.CanUserEdit; }
}
internal override object GetEditorType(object item)
/// <summary>
/// Gets the type of the editor for the DataGridDateColumn that is visualized when entering in edit mode.
/// </summary>
/// <returns>The type of the editor.</returns>
public override object GetEditorType(object item)
{
return this.CanEdit ? datePickerType : DataGridTextColumn.TextBlockType;
}
internal override FrameworkElement CreateEditorContentVisual()
/// <summary>
/// Creates an instance of a RadDatePicker used by the column when entering edit mode.
/// </summary>
/// <returns>An instance of the editor.</returns>
public override FrameworkElement CreateEditorContentVisual()
{
return new RadDatePicker();
}
internal override void PrepareEditorContentVisual(FrameworkElement editorContent, Binding binding)
/// <summary>
/// Prepares all bindings and content set to the RadDatePicker visualized when entering edit mode.
/// </summary>
/// <param name="editorContent">The editor itself.</param>
public override void PrepareEditorContentVisual(FrameworkElement editorContent, Binding binding)
{
editorContent.SetBinding(RadTimePicker.ValueProperty, binding);
editorContent.SetBinding(RadDatePicker.ValueProperty, binding);
}
internal override void ClearEditorContentVisual(FrameworkElement editorContent)
/// <summary>
/// Clears all bindings and content set to the RadDatePicker visualized when entering edit mode.
/// </summary>
/// <param name="editorContent">The editor itself.</param>
public override void ClearEditorContentVisual(FrameworkElement editorContent)
{
editorContent.ClearValue(RadTimePicker.ValueProperty);
editorContent.ClearValue(RadDatePicker.ValueProperty);
}
/// <summary>

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

@ -54,21 +54,70 @@ namespace Telerik.UI.Xaml.Controls.Grid
}
}
internal override object GetEditorType(object item)
/// <summary>
/// Gets the type of the editor for the DataGridImageColumn that is visualized when entering in edit mode.
/// </summary>
/// <returns>The type of the editor.</returns>
public override object GetEditorType(object item)
{
return ImageType;
}
internal override object GetContainerType(object rowItem)
/// <summary>
/// Gets the type of the control visualized when the image column is not currently edited.
/// </summary>
/// <returns>The type of the control.</returns>
public override object GetContainerType(object rowItem)
{
return ImageType;
}
internal override object CreateContainer(object rowItem)
/// <summary>
/// Creates an instance of an Image visualized when the column is not edited.
/// </summary>
/// <returns>An instance of the control.</returns>
public override object CreateContainer(object rowItem)
{
return new Image();
}
/// <summary>
/// Creates an instance of an Image used by the column when entering edit mode.
/// </summary>
/// <returns>An instance of the editor.</returns>
public override FrameworkElement CreateEditorContentVisual()
{
return new Image();
}
/// <summary>
/// Prepares all bindings and content set to the Image visualized when entering edit mode.
/// </summary>
/// <param name="editorContent">The editor itself.</param>
public override void PrepareEditorContentVisual(FrameworkElement editorContent, Windows.UI.Xaml.Data.Binding binding)
{
}
/// <summary>
/// Clears all bindings and content set to the Image visualized when entering edit mode.
/// </summary>
/// <param name="editorContent">The editor itself.</param>
public override void ClearEditorContentVisual(FrameworkElement editorContent)
{
}
public override void ClearCell(object container)
{
base.ClearCell(container);
Image image = container as Image;
if (image != null)
{
image.ImageOpened -= this.OnImageOpened;
SetIsImageOpened(image, false);
}
}
internal override Size MeasureCellContainer(double availableWidth, UIElement container)
{
var size = base.MeasureCellContainer(availableWidth, container);
@ -87,42 +136,30 @@ namespace Telerik.UI.Xaml.Controls.Grid
return size;
}
internal override void ClearCell(GridCellModel cell)
public override async void PrepareCell(object container, object value, object item)
{
base.ClearCell(cell);
base.PrepareCell(container, value, item);
Image image = cell.Container as Image;
if (image != null)
{
image.ImageOpened -= this.OnImageOpened;
SetIsImageOpened(image, false);
}
}
internal override async void PrepareCell(GridCellModel cell)
{
base.PrepareCell(cell);
var image = cell.Container as Image;
var image = container as Image;
if (image == null)
{
return;
}
if (cell.Value == null)
if (value == null)
{
image.Source = null;
}
else if (cell.Value is ImageSource)
else if (value is ImageSource)
{
image.Source = cell.Value as ImageSource;
image.Source = value as ImageSource;
}
else if (cell.Value is string)
else if (value is string)
{
try
{
var source = image.Source as BitmapImage;
var uri = new Uri((string)cell.Value, UriKind.RelativeOrAbsolute);
var uri = new Uri((string)value, UriKind.RelativeOrAbsolute);
if (source == null)
{
source = new BitmapImage(uri);
@ -138,9 +175,9 @@ namespace Telerik.UI.Xaml.Controls.Grid
// TODO: What exceptions can be caught here?
}
}
else if (cell.Value is byte[])
else if (value is byte[])
{
image.Source = await this.LoadImageFromBytes(cell.Value as byte[]);
image.Source = await this.LoadImageFromBytes(value as byte[]);
}
if (!GetIsImageOpened(image))
@ -149,19 +186,6 @@ namespace Telerik.UI.Xaml.Controls.Grid
}
}
internal override FrameworkElement CreateEditorContentVisual()
{
return new Image();
}
internal override void PrepareEditorContentVisual(FrameworkElement editorContent, Windows.UI.Xaml.Data.Binding binding)
{
}
internal override void ClearEditorContentVisual(FrameworkElement editorContent)
{
}
/// <summary>
/// Returns null as the Image column may not be filtered by default.
/// </summary>
@ -195,7 +219,7 @@ namespace Telerik.UI.Xaml.Controls.Grid
image.ImageOpened -= this.OnImageOpened;
SetIsImageOpened(image, true);
this.OnProperyChange(UpdateFlags.AffectsContent);
this.OnPropertyChange(UpdateFlags.AffectsContent);
}
}
}

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

@ -31,22 +31,38 @@ namespace Telerik.UI.Xaml.Controls.Grid
}
}
internal override object GetEditorType(object item)
/// <summary>
/// Gets the type of the editor for the DataGridNumericalColumn that is visualized when entering in edit mode.
/// </summary>
/// <returns>The type of the editor.</returns>
public override object GetEditorType(object item)
{
return this.CanEdit ? numericBoxType : DataGridNumericalColumn.TextBlockType;
}
internal override FrameworkElement CreateEditorContentVisual()
/// <summary>
/// Creates an instance of a RadNumericBox used by the column when entering edit mode.
/// </summary>
/// <returns>An instance of the editor.</returns>
public override FrameworkElement CreateEditorContentVisual()
{
return new RadNumericBox();
}
internal override void PrepareEditorContentVisual(FrameworkElement editorContent, Binding binding)
/// <summary>
/// Prepares all bindings and content set to the RadNumericBox visualized when entering edit mode.
/// </summary>
/// <param name="editorContent">The editor itself.</param>
public override void PrepareEditorContentVisual(FrameworkElement editorContent, Binding binding)
{
editorContent.SetBinding(RadNumericBox.ValueProperty, binding);
}
internal override void ClearEditorContentVisual(FrameworkElement editorContent)
/// <summary>
/// Clears all bindings and content set to the RadNumericBox visualized when entering edit mode.
/// </summary>
/// <param name="editorContent">The editor itself.</param>
public override void ClearEditorContentVisual(FrameworkElement editorContent)
{
editorContent.ClearValue(RadNumericBox.ValueProperty);
}

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

@ -96,27 +96,74 @@ namespace Telerik.UI.Xaml.Controls.Grid
}
}
internal override object GetEditorType(object item)
/// <summary>
/// Gets the type of the editor for the DataGridTextColumn that is visualized when entering in edit mode.
/// </summary>
/// <returns>The type of the editor.</returns>
public override object GetEditorType(object item)
{
return this.CanEdit ? textBoxType : TextBlockType;
}
internal override object GetContainerType(object rowItem)
/// <summary>
/// Gets the type of the control visualized when the text column is not currently edited.
/// </summary>
/// <returns>The type of the control.</returns>
public override object GetContainerType(object rowItem)
{
return TextBlockType;
}
internal override void PrepareCell(GridCellModel cell)
/// <summary>
/// Creates an instance of a TextBlock visualized when the column is not edited.
/// </summary>
/// <returns>An instance of the control.</returns>
public override object CreateContainer(object rowItem)
{
base.PrepareCell(cell);
return new TextBlock();
}
TextBlock tb = cell.Container as TextBlock;
/// <summary>
/// Creates an instance of a TextBox used by the column when entering edit mode.
/// </summary>
/// <returns>An instance of the editor.</returns>
public override FrameworkElement CreateEditorContentVisual()
{
TextBox textbox = new TextBox();
textbox.TextChanged += this.Textbox_TextChanged;
return textbox;
}
/// <summary>
/// Prepares all bindings and content set to the TextBox visualized when entering edit mode.
/// </summary>
/// <param name="editorContent">The editor itself.</param>
public override void PrepareEditorContentVisual(FrameworkElement editorContent, Binding binding)
{
editorContent.SetBinding(TextBox.TextProperty, binding);
}
/// <summary>
/// Clears all bindings and content set to the TextBox visualized when entering edit mode.
/// </summary>
/// <param name="editorContent">The editor itself.</param>
public override void ClearEditorContentVisual(FrameworkElement editorContent)
{
editorContent.ClearValue(TextBox.TextProperty);
}
public override void PrepareCell(object container, object value, object item)
{
base.PrepareCell(container, value, item);
TextBlock tb = container as TextBlock;
if (tb == null)
{
return;
}
if (cell.Value == null)
if (value == null)
{
tb.ClearValue(TextBlock.TextProperty);
return;
@ -125,11 +172,11 @@ namespace Telerik.UI.Xaml.Controls.Grid
string text;
if (!string.IsNullOrEmpty(this.cellContentFormatCache))
{
text = string.Format(CultureInfo.CurrentUICulture, this.cellContentFormatCache, cell.Value);
text = string.Format(CultureInfo.CurrentUICulture, this.cellContentFormatCache, value);
}
else
{
text = Convert.ToString(cell.Value, CultureInfo.CurrentUICulture);
text = Convert.ToString(value, CultureInfo.CurrentUICulture);
}
if (tb.Text != text)
@ -138,29 +185,6 @@ namespace Telerik.UI.Xaml.Controls.Grid
}
}
internal override object CreateContainer(object rowItem)
{
return new TextBlock();
}
internal override FrameworkElement CreateEditorContentVisual()
{
TextBox textbox = new TextBox();
textbox.TextChanged += this.Textbox_TextChanged;
return textbox;
}
internal override void PrepareEditorContentVisual(FrameworkElement editorContent, Binding binding)
{
editorContent.SetBinding(TextBox.TextProperty, binding);
}
internal override void ClearEditorContentVisual(FrameworkElement editorContent)
{
editorContent.ClearValue(TextBox.TextProperty);
}
/// <summary>
/// Creates the <see cref="DataGridTextFilterControl"/> instance that allows filtering operation to be applied upon this column.
/// </summary>
@ -177,7 +201,7 @@ namespace Telerik.UI.Xaml.Controls.Grid
var column = d as DataGridTextColumn;
column.cellContentFormatCache = (string)e.NewValue;
column.OnProperyChange(UpdateFlags.AllButData);
column.OnPropertyChange(UpdateFlags.AllButData);
}
private void Textbox_TextChanged(object sender, TextChangedEventArgs e)

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

@ -39,22 +39,38 @@ namespace Telerik.UI.Xaml.Controls.Grid
get { return this.PropertyInfoInitialized && this.PropertyInfo.DataType.GetTypeInfo().IsAssignableFrom(dateTypeInfo) && this.CanUserEdit; }
}
internal override object GetEditorType(object item)
/// <summary>
/// Gets the type of the editor for the DataGridTimeColumn that is visualized when entering in edit mode.
/// </summary>
/// <returns>The type of the editor.</returns>
public override object GetEditorType(object item)
{
return this.CanEdit ? timePickerType : DataGridTextColumn.TextBlockType;
}
internal override FrameworkElement CreateEditorContentVisual()
/// <summary>
/// Creates an instance of a RadTimePicker used by the column when entering edit mode.
/// </summary>
/// <returns>An instance of the editor.</returns>
public override FrameworkElement CreateEditorContentVisual()
{
return new RadTimePicker();
}
internal override void PrepareEditorContentVisual(FrameworkElement editorContent, Binding binding)
/// <summary>
/// Prepares all bindings and content set to the RadTimePicker visualized when entering edit mode.
/// </summary>
/// <param name="editorContent">The editor itself.</param>
public override void PrepareEditorContentVisual(FrameworkElement editorContent, Binding binding)
{
editorContent.SetBinding(RadTimePicker.ValueProperty, binding);
}
internal override void ClearEditorContentVisual(FrameworkElement editorContent)
/// <summary>
/// Clears all bindings and content set to the RadTimePicker visualized when entering edit mode.
/// </summary>
/// <param name="editorContent">The editor itself.</param>
public override void ClearEditorContentVisual(FrameworkElement editorContent)
{
editorContent.ClearValue(RadTimePicker.ValueProperty);
}

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

@ -220,6 +220,43 @@ namespace Telerik.UI.Xaml.Controls.Grid
return null;
}
/// <summary>
/// Creates an instance of the editor used by the column when entering edit mode.
/// </summary>
/// <returns>An instance of the editor.</returns>
public abstract FrameworkElement CreateEditorContentVisual();
/// <summary>
/// Prepares all bindings and content set to the editor visualized when entering edit mode.
/// </summary>
/// <param name="editorContent">The editor itself.</param>
public abstract void PrepareEditorContentVisual(FrameworkElement editorContent, Binding binding);
/// <summary>
/// Clears all bindings and content set to the editor visualized when entering edit mode.
/// </summary>
/// <param name="editorContent">The editor itself.</param>
public abstract void ClearEditorContentVisual(FrameworkElement editorContent);
public override void PrepareCell(object container, object value, object item)
{
FrameworkElement element = container as FrameworkElement;
if (element == null)
{
return;
}
Style style = this.ComposeCellContentStyle(element, item);
if (style != null)
{
element.Style = style;
}
else
{
element.ClearValue(FrameworkElement.StyleProperty);
}
}
internal override void SetValueForInstance(object instance, object value)
{
var memberAccess = this.propertyInfo as IMemberAccess;
@ -239,25 +276,6 @@ namespace Telerik.UI.Xaml.Controls.Grid
}
}
internal override void PrepareCell(GridCellModel cell)
{
FrameworkElement element = cell.Container as FrameworkElement;
if (element == null)
{
return;
}
Style style = this.ComposeCellContentStyle(element, cell);
if (style != null)
{
element.Style = style;
}
else
{
element.ClearValue(FrameworkElement.StyleProperty);
}
}
internal override SortDescriptorBase GetSortDescriptor()
{
return this.CreateSortDescriptor();
@ -291,12 +309,6 @@ namespace Telerik.UI.Xaml.Controls.Grid
return new Tuple<FrameworkElement, FrameworkElement, FrameworkElement>(content, host, validation);
}
internal abstract FrameworkElement CreateEditorContentVisual();
internal abstract void PrepareEditorContentVisual(FrameworkElement editorContent, Binding binding);
internal abstract void ClearEditorContentVisual(FrameworkElement editorContent);
internal override void PrepareEditorContainer(GridCellEditorModel editor)
{
if (!this.CanEdit)
@ -431,31 +443,31 @@ namespace Telerik.UI.Xaml.Controls.Grid
// Assuming that for the time being the path is property name (Simple Binding).
definition.UpdatePropertyInfo(definition.propertyNameCache);
definition.OnProperyChange(UpdateFlags.All);
definition.OnPropertyChange(UpdateFlags.All);
}
private static void OnCellContentStyleChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var definition = d as DataGridTypedColumn;
definition.cellContentStyleCache = e.NewValue as Style;
definition.OnProperyChange(UpdateFlags.AllButData);
definition.OnPropertyChange(UpdateFlags.AllButData);
}
private static void OnCellContentStyleSelectorChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var definition = d as DataGridTypedColumn;
definition.cellContentStyleSelectorCache = e.NewValue as StyleSelector;
definition.OnProperyChange(UpdateFlags.AllButData);
definition.OnPropertyChange(UpdateFlags.AllButData);
}
private static void OnCellEditorStyleChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var definition = d as DataGridTypedColumn;
definition.cellEditorStyleCache = e.NewValue as Style;
definition.OnProperyChange(UpdateFlags.AllButData);
definition.OnPropertyChange(UpdateFlags.AllButData);
}
private Style ComposeCellContentStyle(FrameworkElement container, GridCellModel cell)
private Style ComposeCellContentStyle(FrameworkElement container, object item)
{
if (this.cellContentStyleCache != null)
{
@ -464,8 +476,7 @@ namespace Telerik.UI.Xaml.Controls.Grid
if (this.cellContentStyleSelectorCache != null)
{
var parentRow = cell.parent as GridRowModel;
var selectContext = new DataGridCellInfo(parentRow.ItemInfo.Item, cell.Column);
var selectContext = new DataGridCellInfo(item, this);
var style = this.cellContentStyleSelectorCache.SelectStyle(selectContext, container);
if (style != null)
{

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

@ -238,6 +238,9 @@ namespace Telerik.UI.Xaml.Controls.Grid.Primitives
// Overcome the differences in the DesiredSize of the header and the ArrangeSize, coming from the NodePool.
if (!this.AllowArrange)
{
// We need to call the base implementation in order to resolve an issue
// where the headers disappear when the DataGrid in visualized initially and the Alt key gets pressed.
base.ArrangeOverride(this.ArrangeRestriction);
return new Size(0, 0);
}

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

@ -81,9 +81,10 @@ namespace Telerik.UI.Xaml.Controls.Grid.Primitives
this.Container.Owner = this.Owner.Owner;
for (int i = 0; i < this.Owner.Owner.Columns.Count; i++)
var visibleColumns = this.Owner.Owner.Model.VisibleColumns;
for (int i = 0; i < visibleColumns.Count(); i++)
{
DataGridColumn column = this.Owner.Owner.Columns[i];
DataGridColumn column = visibleColumns.ElementAt(i);
DataGridFlyoutColumnHeader header = new DataGridFlyoutColumnHeader();

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

@ -114,15 +114,8 @@ namespace Telerik.UI.Xaml.Controls.Grid.Primitives
flyoutPadding = this.Flyout.Padding.Left + this.Flyout.Padding.Right;
}
double availableHeight = double.IsInfinity(availableSize.Height) ? this.Owner.ActualHeight : availableSize.Height;
while (this.Elements.Count > 0)
{
if (this.totalRealizedHeight > availableHeight)
{
break;
}
var child = this.Elements[0];
this.Elements.RemoveAt(0);
this.Children.Add(child);
@ -135,10 +128,8 @@ namespace Telerik.UI.Xaml.Controls.Grid.Primitives
this.realizedWidth = Math.Min(Math.Max(this.realizedWidth, child.DesiredSize.Width), this.owner.ActualWidth - servicePanelWidthToDeduct - flyoutPadding);
}
var actualHeight = this.VerticalAlignment == VerticalAlignment.Stretch ? availableHeight : this.totalRealizedHeight;
base.MeasureOverride(new Size(this.realizedWidth, actualHeight));
return new Size(this.realizedWidth, actualHeight);
base.MeasureOverride(new Size(this.realizedWidth, this.totalRealizedHeight));
return new Size(this.realizedWidth, this.totalRealizedHeight);
}
}
}

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

@ -1,6 +1,7 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using Telerik.Data.Core;
@ -68,6 +69,18 @@ namespace Telerik.UI.Xaml.Controls.Grid.Primitives
return entity;
}
/// <inheritdoc/>
protected override EntityProperty GenerateEntityProperty(object property)
{
var column = this.Columns.FirstOrDefault(a => a is DataGridTypedColumn
&& ((DataGridTypedColumn)a).PropertyName.Equals(((PropertyInfo)property).Name));
var entityProperty = new GridFormEntityProperty((PropertyInfo)property, this.Context, column);
entityProperty.PopulatePropertyMetadata();
return entityProperty;
}
/// <inheritdoc/>
protected override Type GetEntityPropertyType(object property)
{

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

@ -8,12 +8,15 @@ namespace Telerik.UI.Xaml.Controls.Grid.Primitives
/// </summary>
public class GridFormEntityProperty : RuntimeEntityProperty
{
private DataGridColumn column;
/// <summary>
/// Initializes a new instance of the <see cref="GridFormEntityProperty"/> class.
/// </summary>
public GridFormEntityProperty(PropertyInfo property, object item)
public GridFormEntityProperty(PropertyInfo property, object item, DataGridColumn column)
: base(property, item)
{
this.column = column;
}
/// <summary>
@ -41,5 +44,15 @@ namespace Telerik.UI.Xaml.Controls.Grid.Primitives
return label;
}
protected override bool GetIsReadOnly(object property)
{
if (column != null && !column.CanEdit)
{
return true;
}
return base.GetIsReadOnly(property);
}
}
}

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

@ -47,7 +47,7 @@ namespace Telerik.UI.Xaml.Controls.Grid.Primitives
/// <summary>
/// Gets the actual associated descriptor, having in mind possible Composite filter.
/// </summary>
internal FilterDescriptorBase ActualAssociatedDescriptor
public FilterDescriptorBase ActualAssociatedDescriptor
{
get
{

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

@ -1,9 +1,9 @@
using System;
using System.Linq;
using Telerik.Core;
using Telerik.UI.Xaml.Controls.Grid.Model;
using Telerik.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Media;
namespace Telerik.UI.Xaml.Controls.Grid
@ -110,7 +110,8 @@ namespace Telerik.UI.Xaml.Controls.Grid
}
// TODO: consider adding displayindex to the columns to improve this when this operation become a performance issue.
var columnIndex = this.Columns.IndexOf(column);
var visibleCollumns = this.model.VisibleColumns.ToList();
var columnIndex = visibleCollumns.IndexOf(column);
if (columnIndex < 0)
{
return;

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

@ -6,7 +6,8 @@ namespace Telerik.UI.Xaml.Controls.Grid
{
None = 0,
AffectsData = 1,
AffectsContent = AffectsData << 1,
AffectsColumnHeader = AffectsData << 1,
AffectsContent = AffectsColumnHeader << 1,
AffectsScrollPosition = AffectsContent << 1,
AffectsColumnsWidth = AffectsScrollPosition << 1,
AffectsDecorations = AffectsColumnsWidth << 1,

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

@ -58,6 +58,12 @@ namespace Telerik.UI.Xaml.Controls.Grid
return;
}
if (enumFlags == UpdateFlags.AffectsColumnHeader)
{
grid.Model.ColumnPool.Update(enumFlags);
return;
}
grid.Model.ColumnPool.Update(enumFlags);
grid.Model.RowPool.Update(enumFlags);
grid.Model.CellsController.Update(enumFlags);

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

@ -555,6 +555,11 @@ namespace Telerik.UI.Xaml.Controls.Primitives
/// </returns>
protected override Windows.Foundation.Size MeasureOverride(Windows.Foundation.Size availableSize)
{
if (this.drawer == null || this.mainContent == null)
{
return base.MeasureOverride(availableSize);
}
this.drawer.Measure(new Size(availableSize.Width, availableSize.Height));
this.mainContent.Measure(new Size(availableSize.Width, availableSize.Height));
@ -931,4 +936,4 @@ namespace Telerik.UI.Xaml.Controls.Primitives
this.InvalidateMeasure();
}
}
}
}

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

@ -70,7 +70,7 @@ BEGIN
VALUE "FileDescription", "Telerik UI For UWP"
VALUE "FileVersion", STRFILEVER
VALUE "InternalName", "Native.dll"
VALUE "LegalCopyright", "Copyright © 2015-2017 Telerik AD. All rights reserved."
VALUE "LegalCopyright", "Copyright © 2015-2018 Telerik AD. All rights reserved."
VALUE "OriginalFilename", "Native.dll"
VALUE "ProductName", "Telerik UI For UWP"
VALUE "ProductVersion", STRPRODUCTVER

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

@ -1,4 +1,4 @@
Copyright © 2015-2017 Telerik AD. All rights reserved.
Copyright © 2015-2018 Telerik AD. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.

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

@ -43,7 +43,10 @@ UI for UWP is built to target UWP Windows 10 application development and deliver
The official documentation for UI for UWP is available [here](http://docs.telerik.com/devtools/universal-windows-platform/Introduction-uwp) and here is the git repo for it [Telerik UI for UWP documentaton repo](https://github.com/telerik/uwp-docs)
## Demos
Currently, you can take a look at the [Customers Orders Database sample](https://github.com/Microsoft/Windows-appsample-customers-orders-database) developed by Microsoft, which showcases the usage of the RadDataGrid control.
The [UI for UWP Demos application](https://github.com/telerik/UI-For-UWP-Demos) demonstrates a great number of user case scenarios using Telerik UI for UWP.
Also, you can take a look at the [Customers Orders Database sample](https://github.com/Microsoft/Windows-appsample-customers-orders-database) developed by Microsoft, which showcases the usage of the RadDataGrid control.
**********************************************************************************************************************************

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

@ -94,6 +94,7 @@
<Control Name="Grid">
<Example DisplayName="Column DataOperations Mode" ClassName="SDKExamples.UWP.DataGrid.ColumnDataOperationsModeExample" />
<Example DisplayName="Change position of Group Panel" ClassName="SDKExamples.UWP.DataGrid.GroupPanelPosition" />
<Example DisplayName="Custom Rating Column" ClassName="SDKExamples.UWP.DataGrid.CustomRatingColumn" />
<Example DisplayName="Priority Columns" ClassName="SDKExamples.UWP.DataGrid.PriorityColumns" />
<Example DisplayName="Reorder Columns" ClassName="SDKExamples.UWP.DataGrid.ColumnReordering" />
<Example DisplayName="Resize Columns" ClassName="SDKExamples.UWP.DataGrid.ColumnResizing" />

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

@ -0,0 +1,56 @@
using Telerik.Data.Core;
using Telerik.UI.Xaml.Controls.Grid.Primitives;
using Telerik.UI.Xaml.Controls.Input;
using Windows.UI.Xaml;
namespace SDKExamples.UWP.DataGrid
{
[TemplatePart(Name = "PART_Rating", Type = typeof(RadRating))]
public sealed class DataGridCustomFilteringControl : DataGridFilterControlBase
{
private RadRating rating;
public DataGridCustomFilteringControl()
{
this.DefaultStyleKey = typeof(DataGridCustomFilteringControl);
}
public string PropertyName
{
get;
set;
}
public override FilterDescriptorBase BuildDescriptor()
{
var descriptor = new NumericalFilterDescriptor();
descriptor.PropertyName = this.PropertyName;
descriptor.Value = this.rating.Value;
return descriptor;
}
protected override bool ApplyTemplateCore()
{
bool applied = base.ApplyTemplateCore();
this.rating = this.GetTemplateChild("PART_Rating") as RadRating;
applied = applied && this.rating != null;
return applied;
}
protected override void Initialize()
{
var descriptor = this.ActualAssociatedDescriptor as NumericalFilterDescriptor;
if (descriptor != null)
{
double value;
if (double.TryParse(descriptor.Value.ToString(), out value))
{
this.rating.Value = value;
}
}
}
}
}

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

@ -0,0 +1,19 @@
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:datagrid="using:SDKExamples.UWP.DataGrid"
xmlns:local="using:SDKExamples.UWP"
xmlns:input="using:Telerik.UI.Xaml.Controls.Input">
<Style TargetType="datagrid:DataGridCustomFilteringControl">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="datagrid:DataGridCustomFilteringControl">
<Grid>
<input:RadRating x:Name="PART_Rating"/>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>

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

@ -0,0 +1,34 @@
<local:ExamplePageBase
x:Class="SDKExamples.UWP.DataGrid.CustomRatingColumn"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:SDKExamples.UWP"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:grid="using:Telerik.UI.Xaml.Controls.Grid"
xmlns:datagrid="using:SDKExamples.UWP.DataGrid"
mc:Ignorable="d" x:Name="page">
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<TextBlock Text="{Binding Title, ElementName=page}" Style="{StaticResource ExampleHeaderTextBlockStyle}" />
<grid:RadDataGrid Grid.Row="1" ItemsSource="{Binding Items}" Margin="10" AutoGenerateColumns="False" UserEditMode="Inline">
<grid:RadDataGrid.Resources>
<ResourceDictionary Source="CustomFilteringControl/DataGridCustomFilteringControl.xaml"/>
</grid:RadDataGrid.Resources>
<grid:RadDataGrid.Columns>
<grid:DataGridTextColumn PropertyName="Name"/>
<datagrid:DataGridRatingColumn PropertyName="Rating">
<datagrid:DataGridRatingColumn.CellContentStyle>
<Style TargetType="TextBlock">
<Setter Property="VerticalAlignment" Value="Center"/>
</Style>
</datagrid:DataGridRatingColumn.CellContentStyle>
</datagrid:DataGridRatingColumn>
</grid:RadDataGrid.Columns>
</grid:RadDataGrid>
</Grid>
</local:ExamplePageBase>

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

@ -0,0 +1,16 @@
// The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238
namespace SDKExamples.UWP.DataGrid
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class CustomRatingColumn : ExamplePageBase
{
public CustomRatingColumn()
{
this.InitializeComponent();
this.DataContext = new ViewModel();
}
}
}

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

@ -0,0 +1,86 @@
using System;
using Telerik.UI.Xaml.Controls.Grid;
using Telerik.UI.Xaml.Controls.Grid.Primitives;
using Telerik.UI.Xaml.Controls.Input;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Data;
namespace SDKExamples.UWP.DataGrid
{
public class DataGridRatingColumn : DataGridTypedColumn
{
private static Type ratingType = typeof(RadRating);
private static Type iconsPanel = typeof(StackPanel);
public override object GetContainerType(object rowItem)
{
return iconsPanel;
}
public override object GetEditorType(object item)
{
if (!string.IsNullOrEmpty(this.PropertyName) && this.CanUserEdit)
{
return iconsPanel;
}
return ratingType;
}
public override object CreateContainer(object rowItem)
{
return new StackPanel() { Orientation = Orientation.Horizontal };
}
public override FrameworkElement CreateEditorContentVisual()
{
var rating = new RadRating();
return rating;
}
public override void PrepareCell(object container, object value, object item)
{
StackPanel ratingPanel = container as StackPanel;
if (ratingPanel == null)
{
return;
}
if (value == null)
{
ratingPanel.Children.Clear();
return;
}
int starsCount;
if (int.TryParse(value.ToString(), out starsCount))
{
ratingPanel.Children.Clear();
for (int i = 0; i < starsCount; i++)
{
var symbolIcon = new SymbolIcon(Symbol.SolidStar);
ratingPanel.Children.Add(symbolIcon);
}
}
}
public override void PrepareEditorContentVisual(FrameworkElement editorContent, Binding binding)
{
editorContent.SetBinding(RadRating.ValueProperty, binding);
}
public override void ClearEditorContentVisual(FrameworkElement editorContent)
{
editorContent.ClearValue(RadRating.ValueProperty);
}
protected override DataGridFilterControlBase CreateFilterControl()
{
return new DataGridCustomFilteringControl()
{
PropertyName = this.PropertyName
};
}
}
}

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

@ -0,0 +1,8 @@
namespace SDKExamples.UWP.DataGrid
{
public class Item
{
public string Name { get; set; }
public int Rating { get; set; }
}
}

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

@ -0,0 +1,28 @@
using System;
using System.Collections.ObjectModel;
namespace SDKExamples.UWP.DataGrid
{
public class ViewModel
{
public ViewModel()
{
this.Items = ViewModel.GenerateItems();
}
public ObservableCollection<Item> Items { get; set; }
private static ObservableCollection<Item> GenerateItems()
{
var randomRating = new Random();
var items = new ObservableCollection<Item>();
for (int i = 0; i < 25; i++)
{
var item = new Item() { Name = "Name " + i, Rating = randomRating.Next(1, 5) };
items.Add(item);
}
return items;
}
}
}

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

@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SDKExamples.UWP")]
[assembly: AssemblyCopyright("Copyright © 2015-2017 Telerik AD. All rights reserved.")]
[assembly: AssemblyCopyright("Copyright © 2015-2018 Telerik AD. All rights reserved.")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

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

@ -275,6 +275,13 @@
<Compile Include="Examples\Grid\ColumnResizing.xaml.cs">
<DependentUpon>ColumnResizing.xaml</DependentUpon>
</Compile>
<Compile Include="Examples\Grid\CustomRatingColumn\CustomFilteringControl\DataGridCustomFilteringControl.cs" />
<Compile Include="Examples\Grid\CustomRatingColumn\CustomRatingColumn.xaml.cs">
<DependentUpon>CustomRatingColumn.xaml</DependentUpon>
</Compile>
<Compile Include="Examples\Grid\CustomRatingColumn\DataGridRatingColumn.cs" />
<Compile Include="Examples\Grid\CustomRatingColumn\Item.cs" />
<Compile Include="Examples\Grid\CustomRatingColumn\ViewModel.cs" />
<Compile Include="Examples\Grid\EditMode.xaml.cs">
<DependentUpon>EditMode.xaml</DependentUpon>
</Compile>
@ -664,6 +671,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Examples\Grid\CustomRatingColumn\CustomRatingColumn.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Examples\Grid\EditMode.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
@ -824,6 +835,10 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Examples\Grid\CustomRatingColumn\CustomFilteringControl\DataGridCustomFilteringControl.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
</ItemGroup>
<ItemGroup />
<ItemGroup>

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

@ -9,7 +9,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Chart.Tests")]
[assembly: AssemblyCopyright("Copyright © 2015-2017 Telerik AD. All rights reserved.")]
[assembly: AssemblyCopyright("Copyright © 2015-2018 Telerik AD. All rights reserved.")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyMetadata("TargetPlatform", "UAP")]

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

@ -9,7 +9,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("DataControls.Tests")]
[assembly: AssemblyCopyright("Copyright © 2015-2017 Telerik AD. All rights reserved.")]
[assembly: AssemblyCopyright("Copyright © 2015-2018 Telerik AD. All rights reserved.")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyMetadata("TargetPlatform", "UAP")]

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

@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Grid.Tests")]
[assembly: AssemblyCopyright("Copyright © 2015-2017 Telerik AD. All rights reserved.")]
[assembly: AssemblyCopyright("Copyright © 2015-2018 Telerik AD. All rights reserved.")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyMetadata("TargetPlatform", "UAP")]

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

@ -9,7 +9,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Input.Tests")]
[assembly: AssemblyCopyright("Copyright © 2015-2017 Telerik AD. All rights reserved.")]
[assembly: AssemblyCopyright("Copyright © 2015-2018 Telerik AD. All rights reserved.")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyMetadata("TargetPlatform", "UAP")]

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

@ -4,6 +4,6 @@
== in this case for Telerik UI for UWP by Progress ==
=========================================================================
Telerik UI for UWP by Progress
Copyright (C) 2015 - 2017 Telerik AD
Copyright (C) 2015 - 2018 Telerik AD
For license information see the LICENSE.md file which accompanies this NOTICE.txt file.
Any open source software that may be delivered by Telerik AD embedded in or in association with Telerik UI for UWP by Progress is provided pursuant to the open source license applicable to such software and subject to the disclaimers and limitations on liability set forth in such license.