<
Page.Resources>
.
.
.. <Style TargetType="telerikGrid:GridViewRow" x:Key="Grid1ItemStyle">
<Setter Property="dragDrop:RadDragAndDropManager.AllowDrop" Value="True" />
<Setter Property="dragDrop:RadDragAndDropManager.AllowDrag" Value="True" />
</Style>
<Style TargetType="telerikGrid:GridViewRow" x:Key="Grid2ItemStyle">
<Setter Property="dragDrop:RadDragAndDropManager.AllowDrop" Value="True" />
<Setter Property="dragDrop:RadDragAndDropManager.AllowDrag" Value="True" />
</Style>
<
DataTemplate x:Key="ProductTemplate">
<DockPanel Margin="2" MaxWidth="200">
<TextBlock Text="{Binding TableName}" FontWeight="Bold" DockPanel.Dock="Top" />
<TextBlock Text="{Binding ColumnName}" Foreground="Green" DockPanel.Dock="Left" />
<TextBlock Text="{Binding ColumnFriendlyName}" DockPanel.Dock="Left" Margin="2 0 0 0" Foreground="Gray" TextWrapping="Wrap" />
</DockPanel>
</DataTemplate>
<DataTemplate x:Key="Product1Template">
<DockPanel Margin="2" MaxWidth="200">
<TextBlock Text="{Binding Table1Name}" FontWeight="Bold" DockPanel.Dock="Top" />
<TextBlock Text="{Binding Column1Name}" Foreground="Green" DockPanel.Dock="Left" />
</DockPanel>
</DataTemplate>
.
.
</Page.Resources>
<Grid>
.
.
.
<
telerik:RadGridView x:Name="gridSourceTableColumns" Margin="10,0,8,0" AutoGenerateColumns="False" ShowGroupPanel="False"
HorizontalAlignment="Stretch" CanUserFreezeColumns="False" telerik:StyleManager.Theme="Windows7" CanUserReorderColumns="False" ScrollMode="RealTime" Height="300" CanUserSortColumns="False" Width="Auto" IsReadOnly="False" RowIndicatorVisibility="Collapsed" Grid.ColumnSpan="2" SelectionMode="Multiple" Grid.Row="0" Grid.Column="0" Loaded="gridSourceTableColumns_Loaded" CanUserInsertRows="True" dragDrop:RadDragAndDropManager.AllowDrag="True" RowStyle="{StaticResource Grid1ItemStyle}" >
.
.
.
</
telerik:RadGridView>
.
.
.
<
telerikNavigation:RadTabControl x:Name="tabDEEParameters" Grid.Row="2" Grid.Column="0" Height="250">
<telerikNavigation:RadTabItem Header="Where Clause" x:Name="tabItemWhereClause">
<telerik:RadGridView x:Name="grdSrcWhereClause" Margin="10,0,8,0" AutoGenerateColumns="False" ShowGroupPanel="False"
HorizontalAlignment="Stretch" CanUserFreezeColumns="False" CanUserSortColumns="False" ItemsSource="{Binding}"
IsReadOnly="False" RowIndicatorVisibility="Collapsed" ScrollMode="RealTime" Width="Auto" IsFilteringAllowed="False"
Grid.Row="1" Grid.ColumnSpan="2" Height="200" RowEditEnded="OnRowEditEnded" CanUserDeleteRows="True"
CanUserInsertRows="True" RowStyle="{StaticResource Grid2ItemStyle}"
dragDrop:RadDragAndDropManager.AllowDrop="True" CanUserReorderColumns="False" >
.
.
.
</
telerik:RadGridView>
</
telerikNavigation:RadTabItem>
<
telerikNavigation:RadTabItem Header="Join Parameters" x:Name="tabItemJoinParameters">
<telerik:RadGridView x:Name="grdSrcJoinParameter" Margin="10,0,8,0" AutoGenerateColumns="False" ShowGroupPanel="False"
HorizontalAlignment="Stretch" CanUserFreezeColumns="False" CanUserReorderColumns="False"
CanUserSortColumns="False" Width="Auto" ItemsSource="{Binding}"
IsReadOnly="False" RowIndicatorVisibility="Collapsed" ScrollMode="RealTime"
Grid.Row="1" Grid.ColumnSpan="2" Height="200" RowEditEnded="OnRowEditEnded"
CanUserInsertRows="True" CanUserDeleteRows="True" IsFilteringAllowed="False"
dragDrop:RadDragAndDropManager.AllowDrop="True" AllowDrop="True"
RowStyle="{StaticResource Grid2ItemStyle}">
.
.
.
.
.
</telerik:RadGridView>
</telerikNavigation:RadTabItem>
</telerikNavigation:RadTabControl>
.
.
.
.
.
</
Grid>
public
SAPSourceTableDetails()
{
// Allow dropping into the GridView only if the drop items:
RadDragAndDropManager.AddDragQueryHandler(gridSourceTableColumns, OnDragQuery);
// Change the dropping cue and choose an action for the sucessful drop in the GridView:
RadDragAndDropManager.AddDragInfoHandler(gridSourceTableColumns, OnGridViewDragInfo);
// Allow dropping into the GridView only if the dragged items:
RadDragAndDropManager.AddDropQueryHandler(grdSrcWhereClause, OnDropQuery);
// Change the dropping cue and choose an action for the sucessful drag in the GridView:
RadDragAndDropManager.AddDropInfoHandler(grdSrcWhereClause, OnGridViewDropInfo);
// Allow dropping into the GridView only if the drop items:
RadDragAndDropManager.AddDragQueryHandler(grdSrcJoinParameter, OnDropJoinQuery);
// Change the dropping cue and choose an action for the sucessful drop in the GridView:
RadDragAndDropManager.AddDragInfoHandler(grdSrcJoinParameter, OnGridViewDropJoinInfo);
//Add class handler to handle dropping before / after items:
EventManager.RegisterClassHandler(typeof(GridViewRow), RadDragAndDropManager.DropQueryEvent, new
EventHandler<DragDropQueryEventArgs>(OnRowDropQuery));
EventManager.RegisterClassHandler(typeof(GridViewRow), RadDragAndDropManager.DropInfoEvent, new
EventHandler<DragDropEventArgs>(OnRowDropInfo));
// Make the GridView a drag Source:
RadDragAndDropManager.SetAllowDrag(gridSourceTableColumns, true);
// Make the GridView a drop target:
RadDragAndDropManager.SetAllowDrop(grdSrcWhereClause, true);
// Make the GridView a drag Source:
RadDragAndDropManager.SetAllowDrop(grdSrcJoinParameter, true);
tabDEEParameters.SelectedIndex = 2;
private
DropPosition lastRowDropPosition;
// Get the drag cue that we have created
private
void OnRowDropInfo(object sender, DragDropEventArgs e)
{
var row = sender as GridViewRow;
var gridView = row.GridViewDataControl as RadGridView;
var draggedItems = e.Options.Payload as ICollection;
// Get the drag cue that we have created
var cue = e.Options.DragCue as TreeViewDragCue;
if (e.Options.Status == DragStatus.DropPossible)
{
// Set a suitable text:
cue.DragActionContent =
String.Format("Insert {0} item{1} {2} ", draggedItems.Count, draggedItems.Count > 1 ? "s" : String.Empty, lastRowDropPosition.ToString().ToLower());
cue.DragTooltipContent = row.Item;
cue.DragTooltipContentTemplate =
this.Resources["ProductTemplate"] as DataTemplate;
grdSrcWhereClause.SetIsSelected(grdSrcWhereClause.SelectedItem,
true);
ShowBetweenItemsCue(gridView, row, lastRowDropPosition);
//We need to think of some kind of template here, we will use one we have.
cue.IsDropPossible =
true;
}
else if (e.Options.Status == DragStatus.DropImpossible)
{
HideBetweenItemsCue(gridView);
cue.DragActionContent =
null;
cue.IsDropPossible =
false;
}
else if (e.Options.Status == DragStatus.DropComplete)
{
HideBetweenItemsCue(gridView);
var items = gridView.ItemsSource as IList;
var insertIndex = items.IndexOf(row.Item);
if (lastRowDropPosition == DropPosition.After)
{
insertIndex++;
}
foreach (var draggedItem in draggedItems)
{
items.Insert(insertIndex, draggedItem);
insertIndex++;
}
}
e.Handled =
true;
}
private void OnRowDropJoinInfo(object sender, DragDropEventArgs e)
{
var row = sender as GridViewRow;
var gridView = row.GridViewDataControl as RadGridView;
var draggedItems = e.Options.Payload as ICollection;
// Get the drag cu that the TreeView or we have created
var cue = e.Options.DragCue as TreeViewDragCue;
if (e.Options.Status == DragStatus.DropPossible)
{
// Set a suitable text:
cue.DragActionContent =
String.Format("Insert {0} item{1} {2} ", draggedItems.Count, draggedItems.Count > 1 ? "s" : String.Empty, lastRowDropPosition.ToString().ToLower());
cue.DragTooltipContent = row.Item;
cue.DragTooltipContentTemplate =
this.Resources["Product1Template"] as DataTemplate;
grdSrcJoinParameter.SetIsSelected(grdSrcWhereClause.SelectedItem,
true);
ShowBetweenItemsCue(gridView, row, lastRowDropPosition);
//We need to think of some kind of template here, we will use one we have.
cue.IsDropPossible =
true;
}
else if (e.Options.Status == DragStatus.DropImpossible)
{
HideBetweenItemsCue(gridView);
cue.DragActionContent =
null;
cue.IsDropPossible =
false;
}
else if (e.Options.Status == DragStatus.DropComplete)
{
HideBetweenItemsCue(gridView);
var items = gridView.ItemsSource as IList;
var insertIndex = items.IndexOf(row.Item);
if (lastRowDropPosition == DropPosition.After)
{
insertIndex++;
}
foreach (var draggedItem in draggedItems)
{
items.Insert(insertIndex, draggedItem);
insertIndex++;
}
}
e.Handled =
true;
}
private void ShowBetweenItemsCue(RadGridView gridView, GridViewRow row, DropPosition lastRowDropPosition)
{
if (gridView != null)
{
//We need to get the first visual child so that we can search in the template:
var firstChild = VisualTreeHelper.GetChild(gridView, 0) as FrameworkElement;
var cue = firstChild.FindName("BetweenItemsCue") as FrameworkElement;
cue.Visibility =
Visibility.Visible;
//How much should the cue be offset?
var yOffset = row.TransformToVisual(gridView).Transform(new Point()).Y;
if (lastRowDropPosition == DropPosition.After)
{
yOffset += row.ActualHeight;
}
cue.RenderTransform =
new TranslateTransform() { Y = yOffset };
}
}
private void HideBetweenItemsCue(RadGridView gridView)
{
if (gridView != null)
{
//We need to get the first visual child so that we can search in the template:
var firstChild = VisualTreeHelper.GetChild(gridView, 0) as FrameworkElement;
var cue = firstChild.FindName("BetweenItemsCue") as FrameworkElement;
cue.Visibility =
Visibility.Collapsed;
}
}
private void OnRowDropJoinQuery(object sender, DragDropQueryEventArgs e)
{
var row = sender as GridViewRow;
var dragCue = e.Options.DragCue as TreeViewDragCue;
var draggedItems = e.Options.Payload as ICollection;
//Get the Y displacement ragarding the screen:
var top = row.TransformToVisual(this).Transform(new Point()).Y;
var currentPoint = e.Options.CurrentDragPoint;
lastRowDropPosition = currentPoint.Y - top < row.ActualHeight / 2 ?
DropPosition.Before : DropPosition.After;
//Here you can check whether a drop should really be allowed.
e.QueryResult = draggedItems.Cast<
object>().All(item => item is SAPTable);
e.Handled =
true;
}
private void OnRowDropQuery(object sender, DragDropQueryEventArgs e)
{
var row = sender as GridViewRow;
var dragCue = e.Options.DragCue as TreeViewDragCue;
var draggedItems = e.Options.Payload as ICollection;
//Get the Y displacement ragarding the screen:
var top = row.TransformToVisual(this).Transform(new Point()).Y;
var currentPoint = e.Options.CurrentDragPoint;
lastRowDropPosition = currentPoint.Y - top < row.ActualHeight / 2 ?
DropPosition.Before : DropPosition.After;
if (draggedItems != null)
{
//Here you can check whether a drop should really be allowed.
e.QueryResult = draggedItems.Cast<
object>().All(item => item is SAPTable);
}
e.Handled =
true;
}
private void OnGridViewDragInfo(object sender, DragDropEventArgs e)
{
var gridView = sender as RadGridView;
var draggedItems = e.Options.Payload as IEnumerable;
if (e.Options.Status == DragStatus.DragInProgress)
{
this.Dispatcher.BeginInvoke(new Action(() =>
{
var capturedElement = Mouse.Captured;
if (capturedElement != null)
{
capturedElement.ReleaseMouseCapture();
}
}));
//Set up a drag cue:
var cue = new TreeViewDragCue();
if (e.Options.Payload != null)
{
//Here we need to choose a template for the items:
if (e.Options.Payload.GetType().Name == "SAPJoinClause")
{
cue.ItemTemplate =
this.Resources["Product1Template"] as DataTemplate;
}
else
{
cue.ItemTemplate =
this.Resources["ProductTemplate"] as DataTemplate;
}
}
cue.ItemsSource = draggedItems;
e.Options.DragCue = cue;
}
//else if (e.Options.Status == DragStatus.DragComplete)
//{
// var source = gridView.ItemsSource as IList;
// foreach (object draggedItem in draggedItems)
// {
// source.Remove(draggedItem);
// }
//}
}
private void OnDragQuery(object sender, DragDropQueryEventArgs e)
{
var gridView = sender as RadGridView;
if (gridView != null)
{
var selectedItems = gridView.SelectedItems.ToList();
e.QueryResult = selectedItems.Count > 0;
SAPWhereClause clause = new SAPWhereClause();
SAPJoinClause clause1 = new SAPJoinClause();
foreach (SAPSourceFieldInfo item in selectedItems)
{
if (tabDEEParameters.SelectedIndex == 2)
{
SAPJoinCond table = new SAPJoinCond(item.PI_ERPTableID, -1, item.TableName, "", item.PI_ERPColumnID, -1, item.ColumnName,
"", "", "", "", "", -1, "");
clause1.Add(table);
}
else if (tabDEEParameters.SelectedIndex == 1)
{
SAPWhereCond table = new SAPWhereCond(item.PI_ERPTableID, item.TableName, item.PI_ERPColumnID,
item.ColumnName, -1,
"", "", "", "", "", "", "");
clause.Add(table);
}
}
if (tabDEEParameters.SelectedIndex == 2)
{
e.Options.Payload = clause1;
}
else if (tabDEEParameters.SelectedIndex == 1)
{
e.Options.Payload = clause;
}
}
e.QueryResult =
true;
e.Handled =
true;
}
private void OnGridViewDropJoinInfo(object sender, DragDropEventArgs e)
{
var destGrid = e.Options.Destination as RadGridView;
var draggedItems = e.Options.Payload as ICollection;
// Get the drag cu that the TreeView or we have created
var cue = e.Options.DragCue as TreeViewDragCue;
if (e.Options.Status == DragStatus.DropPossible)
{
// Set a suitable text:
cue.DragActionContent =
String.Format("Add {0} item{1} to Join Parameters", draggedItems.Count, draggedItems.Count > 1 ? "s" : String.Empty);
cue.IsDropPossible =
true;
if (destGrid != null)
{
destGrid.Background =
this.Resources["DropPossibleBackground"] as Brush;
}
}
else if (e.Options.Status == DragStatus.DropImpossible)
{
cue.DragActionContent =
null;
cue.IsDropPossible =
false;
}
else if (e.Options.Status == DragStatus.DropComplete)
{
var items = grdSrcJoinParameter.ItemsSource as IList;
foreach (var draggedItem in draggedItems)
{
items.Add(draggedItem);
}
grdSrcWhereClause.SelectedItem =
null;
grdSrcWhereClause.Rebind();
}
if (e.Options.Status != DragStatus.DropPossible)
{
if (destGrid != null)
{
destGrid.Background =
new SolidColorBrush(Colors.White);
}
}
foreach (var parent in e.Options.Source.GetAncestorsInclusive<UIElement>())
{
parent.ReleaseMouseCapture();
}
}
private void OnGridViewDropInfo(object sender, DragDropEventArgs e)
{
var destGrid = e.Options.Destination as RadGridView;
var draggedItems = e.Options.Payload as ICollection;
// Get the drag cu that the TreeView or we have created
var cue = e.Options.DragCue as TreeViewDragCue;
if (e.Options.Status == DragStatus.DropPossible)
{
// Set a suitable text:
cue.DragActionContent =
String.Format("Add {0} item{1} to Conditions", draggedItems.Count, draggedItems.Count > 1 ? "s" : String.Empty);
cue.IsDropPossible =
true;
if (destGrid != null)
{
destGrid.Background =
this.Resources["DropPossibleBackground"] as Brush;
}
}
else if (e.Options.Status == DragStatus.DropImpossible)
{
cue.DragActionContent =
null;
cue.IsDropPossible =
false;
}
else if (e.Options.Status == DragStatus.DropComplete)
{
var items = grdSrcWhereClause.ItemsSource as IList;
foreach (var draggedItem in draggedItems)
{
items.Add(draggedItem);
}
grdSrcWhereClause.SelectedItem =
null;
grdSrcWhereClause.Rebind();
}
if (e.Options.Status != DragStatus.DropPossible)
{
if (destGrid != null)
{
destGrid.Background =
new SolidColorBrush(Colors.White);
}
}
foreach (var parent in e.Options.Source.GetAncestorsInclusive<UIElement>())
{
parent.ReleaseMouseCapture();
}
}
private void OnDropQuery(object sender, DragDropQueryEventArgs e)
{
// We allow drop only if the dragged items are products:
var draggedItems = e.Options.Payload as ICollection;
var result = draggedItems.Cast<object>().All(item => item is SAPWhereCond);
e.QueryResult = result;
e.Handled =
true;
// Note that here we agree to accept a drop. We will be notified
// in the DropInfo event whether a drop is actually possible.
}
private void OnDropJoinQuery(object sender, DragDropQueryEventArgs e)
{
// We allow drop only if the dragged items are products:
var draggedItems = e.Options.Payload as ICollection;
var result = draggedItems.Cast<object>().All(item => item is SAPJoinCond);
e.QueryResult = result;
e.Handled =
true;
// Note that here we agree to accept a drop. We will be notified
// in the DropInfo event whether a drop is actually possible.
}
Thanks for your help...
Neha
With the version Q2 2010 - 2010.2.714.35,
When i set a date with 2 digit for the month (such as 01/01/2010), this error occurs :
analyse de "(?<dim.>(?<=\b|\W)dim.(?=\b|\W)|(?<=\b|\W)dimanche(?=\b|\W))|(?<lun.>(?<=\b|\W)lun.(?=\b|\W)|(?<=\b|\W)lundi(?=\b|\W))|(?<mar.>(?<=\b|\W)mar.(?=\b|\W)|(?<=\b|\W)mardi(?=\b|\W))|(?<mer.>(?<=\b|\W)mer.(?=\b|\W)|(?<=\b|\W)mercredi(?=\b|\W))|(?<jeu.>(?<=\b|\W)jeu.(?=\b|\W)|(?<=\b|\W)jeudi(?=\b|\W))|(?<ven.>(?<=\b|\W)ven.(?=\b|\W)|(?<=\b|\W)vendredi(?=\b|\W))|(?<sam.>(?<=\b|\W)sam.(?=\b|\W)|(?<=\b|\W)samedi(?=\b|\W))" - Nom de groupe non valide : les noms de groupes doivent commencer par un caractère alphabétique.
à System.Text.RegularExpressions.RegexParser.ScanGroupOpen()
à System.Text.RegularExpressions.RegexParser.ScanRegex()
à System.Text.RegularExpressions.RegexParser.Parse(String re, RegexOptions op)
à System.Text.RegularExpressions.Regex..ctor(String pattern, RegexOptions options, Boolean useCache)
à System.Text.RegularExpressions.Regex..ctor(String pattern, RegexOptions options)
à Telerik.Windows.Controls.DayOfWeekParser.TryParse(String value, DateTime& result, DateTime current) dans c:\Builds\WPF_Scrum\Release_WPF_2010_Q2\Sources\Development\Controls\Input\DateTimePicker\Parsers\DayOfWeekParser.cs:ligne 31
à Telerik.Windows.Controls.CompositeDateTimeParser.TryParse(String value, DateTime& result, DateTime current) dans c:\Builds\WPF_Scrum\Release_WPF_2010_Q2\Sources\Development\Controls\Input\DateTimePicker\Parsers\CompositeDateTimeParser.cs:ligne 67
à Telerik.Windows.Controls.RadDateTimePicker.OnCurrentDateTimeTextChanged() dans c:\Builds\WPF_Scrum\Release_WPF_2010_Q2\Sources\Development\Controls\Input\DateTimePicker\RadDateTimePicker.cs:ligne 1117
à Telerik.Windows.Controls.RadDateTimePicker.OnCurrentDateTimeTextChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) dans c:\Builds\WPF_Scrum\Release_WPF_2010_Q2\Sources\Development\Controls\Input\DateTimePicker\RadDateTimePicker.cs:ligne 1041
à System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
à System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
à System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)
à System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, OperationType operationType)
à System.Windows.DependencyObject.SetValueCommon(DependencyProperty dp, Object value, PropertyMetadata metadata, Boolean coerceWithDeferredReference, OperationType operationType, Boolean isInternal)
à System.Windows.DependencyObject.SetValue(DependencyProperty dp, Object value)
à MS.Internal.Data.PropertyPathWorker.SetValue(Object item, Object value)
à MS.Internal.Data.ClrBindingWorker.UpdateValue(Object value)
à System.Windows.Data.BindingExpression.UpdateSource(Object value)
With 01/1/2010, it work's fine.
How can i set the month format for allow 2 digit in the month number ?
Thanks in advance
Style styleLabel =
new
Style(
typeof
(TextBlock));
styleLabel.Setters.Add(
new
Setter(TextBlock.TextWrappingProperty, TextWrapping.Wrap));
styleLabel.Setters.Add(
new
Setter(TextBlock.WidthProperty, 120));
telerikChart.DefaultView.ChartArea.AxisY.AxisStyles.ItemLabelStyle = styleLabel;