зеркало из https://github.com/telerik/xaml-sdk.git
Updated examples
This commit is contained in:
Родитель
f78afab7f1
Коммит
496ba3ff28
|
@ -12,8 +12,10 @@
|
|||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock Text="This example demonstrates how to use a custom DockingPanesFactory in order to add the RadPanes from the PanesSource collection to a predefined empty RadPaneGroups in the control." TextWrapping="Wrap" Width="400" Margin="20" FontWeight="Bold" VerticalAlignment="Center" HorizontalAlignment="Center"/>
|
||||
<telerik:RadDocking PanesSource="{Binding Panes}" Grid.Row="1">
|
||||
<TextBlock Text="This example demonstrates how to use a custom DockingPanesFactory in order to add the RadPanes from the PanesSource collection to a predefined empty RadPaneGroups in the control. The example also demonstrates how to permanently remove a RadPane instance when its 'X' close button is pressed."
|
||||
TextWrapping="Wrap" Width="600" Margin="20" FontWeight="Bold" VerticalAlignment="Center" HorizontalAlignment="Center"/>
|
||||
<telerik:RadDocking PanesSource="{Binding Panes}" Grid.Row="1"
|
||||
Close="OnRadDockingClose">
|
||||
<telerik:RadDocking.DockingPanesFactory>
|
||||
<local:MyDockingPanesFactory />
|
||||
</telerik:RadDocking.DockingPanesFactory>
|
||||
|
|
|
@ -1,16 +1,5 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
using System.Windows.Controls;
|
||||
using Telerik.Windows.Controls;
|
||||
|
||||
namespace CustomDockingPanesFactory
|
||||
{
|
||||
|
@ -24,5 +13,26 @@ namespace CustomDockingPanesFactory
|
|||
InitializeComponent();
|
||||
this.DataContext = new ViewModel();
|
||||
}
|
||||
|
||||
private void OnRadDockingClose(object sender, Telerik.Windows.Controls.Docking.StateChangeEventArgs e)
|
||||
{
|
||||
// By default when a RadPane is closed via its 'X' close button it is not fully removed from the control rather its
|
||||
// IsHidden property is set to True. This is done in order to provide an easy way of reopening such closed instance
|
||||
// without the need of fully creating the a new 'mirrored' instance and adding it to the control.
|
||||
|
||||
// The next code will permanently remove the RadPane instance from the RadDocking control. When PanesSource is set
|
||||
// the closed RadPane instance needs to be manually removed from the bound collection. This will trigger the RemovePane()
|
||||
// method of the DockingPanesFactory of the control. If no PanesSource is used again a manually remove needs to be
|
||||
// done by simply calling the RemoveFromParent() method of the RadPane instance.
|
||||
var docking = sender as RadDocking;
|
||||
foreach (var pane in e.Panes)
|
||||
{
|
||||
var dataContext = docking.DataContext as ViewModel;
|
||||
if (dataContext != null)
|
||||
{
|
||||
dataContext.Panes.Remove(pane);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="clr-namespace:CustomDockingPanesFactory"
|
||||
Title="MainWindow" Height="350" Width="525">
|
||||
WindowStartupLocation="CenterScreen"
|
||||
Title="MainWindow" Height="700" Width="970">
|
||||
<Grid>
|
||||
<local:Example/>
|
||||
</Grid>
|
||||
|
|
|
@ -20,5 +20,10 @@ namespace CustomDockingPanesFactory
|
|||
base.AddPane(radDocking, pane);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void RemovePane(RadPane pane)
|
||||
{
|
||||
base.RemovePane(pane);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
#Custom DockingPanesFactory#
|
||||
This example demonstrates how to use a custom DockingPanesFactory in order to add the RadPanes from the PanesSource collection to a predefined empty RadPaneGroups in the control.
|
||||
This example demonstrates how to use a custom DockingPanesFactory in order to add the RadPanes from the PanesSource collection to a predefined empty RadPaneGroups in the control. The example also demonstrates how to permanently remove a RadPane instance when its 'X' close button is pressed.
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Telerik.Windows.Controls;
|
||||
|
@ -8,11 +9,11 @@ namespace CustomDockingPanesFactory
|
|||
{
|
||||
public class ViewModel : ViewModelBase
|
||||
{
|
||||
public List<RadPane> Panes { get; set; }
|
||||
private ObservableCollection<RadPane> panes;
|
||||
|
||||
public ViewModel()
|
||||
{
|
||||
this.Panes = new List<RadPane>()
|
||||
this.Panes = new ObservableCollection<RadPane>()
|
||||
{
|
||||
new RadPane() { Header = "Bottom Pane 1", Tag = "Bottom" },
|
||||
new RadPane() { Header = "Bottom Pane 2", Tag = "Bottom" },
|
||||
|
@ -24,5 +25,25 @@ namespace CustomDockingPanesFactory
|
|||
new RadDocumentPane() { Header = "DocumentHost Pane 5", Tag = "DocumentHost" }
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets Panes and notifies for changes
|
||||
/// </summary>
|
||||
public ObservableCollection<RadPane> Panes
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.panes;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (this.panes != value)
|
||||
{
|
||||
this.panes = value;
|
||||
this.OnPropertyChanged(() => this.Panes);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
</ResourceDictionary.MergedDictionaries>
|
||||
<Style TargetType="telerik:GridViewRow" BasedOn="{StaticResource GridViewRowCoreValidationStyle}"/>
|
||||
<Style TargetType="telerik:GridViewCell" BasedOn="{StaticResource GridViewCellCoreValidationStyle}"/>
|
||||
<Style TargetType="telerik:TreeListViewRow" BasedOn="{StaticResource TreeListViewRowCoreValidationStyle}"/>
|
||||
</ResourceDictionary>
|
||||
</UserControl.Resources>
|
||||
<Grid>
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
</ResourceDictionary.MergedDictionaries>
|
||||
<Style TargetType="telerik:GridViewRow" BasedOn="{StaticResource GridViewRowCoreValidationStyle}"/>
|
||||
<Style TargetType="telerik:GridViewCell" BasedOn="{StaticResource GridViewCellCoreValidationStyle}"/>
|
||||
<Style TargetType="telerik:TreeListViewRow" BasedOn="{StaticResource TreeListViewRowCoreValidationStyle}"/>
|
||||
</ResourceDictionary>
|
||||
</Window.Resources>
|
||||
<Grid>
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#Lightweight GridViewComboBoxColumn#
|
||||
This example demonstrates how to configure lightweight GridViewComboBoxColumn with validation.
|
||||
Validation rules:
|
||||
- ItemKey can not be 0
|
||||
- CustomerItem can not be empty
|
||||
|
||||
See also:
|
||||
WPF: http://docs.telerik.com/devtools/wpf/controls/radgridview/columns/columntypes/column-types-combobox-column
|
||||
SL: http://docs.telerik.com/devtools/silverlight/controls/radgridview/columns/columntypes/column-types-combobox-column
|
Загрузка…
Ссылка в новой задаче