Hi,
I have a RadGridView in a radpane, selectedItem return correctly, but after the radpane undocked, or docking again after undocked, the always selectedItem return null which I used for DragAndDrop. Anthing wrong or what should I do to get selectedItem return correct value? here is code:
<telerik:RadGridView
x:Name="itemView"
ItemsSource="{Binding AvailableItems}"
SelectedItem="{Binding SelectedAvailableItem}"
SelectionMode="Extended"
SelectionUnit="FullRow"
IsReadOnly="True"
CanUserSelect="True"
AllowDrop="True"
AutoGenerateColumns="False"
IsFilteringAllowed="False"
RowIndicatorVisibility="Collapsed"
Grid.Column="0"
Grid.Row="1">
<telerik:RadGridView.RowStyle>
<Style TargetType="telerik:GridViewRow">
<Setter Property="telerik:RadDragAndDropManager.AllowDrag" Value="True" />
<EventSetter Event="Control.RequestBringIntoView" Handler="RadGridView_RequestBringIntoView"/>
</Style>
</telerik:RadGridView.RowStyle>
</teleric.RadGridView>
in C#
RadDragAndDropManager.AddDragQueryHandler(itemView, OnGridViewDragQuery);
private void OnGridViewDragQuery(object sender, DragDropQueryEventArgs e)
{
try
{
if (sender is RadGridView)
{
RadGridView gridView = sender as RadGridView;
IList selectedItems = gridView.SelectedItems.ToList();
e.QueryResult = selectedItems.Count > 0;
e.Options.Payload = selectedItems;
}
else
{
e.QueryResult = true;
}
}
catch (Exception)
{
}
finally
{
e.Handled = true;
}
}
After undocking or docking again(data may rebinded), when drag a item in gridview, above gridView.SelectedItems in OnGridViewDragQuery() return null.
Thanks
Felix
I have a RadGridView in a radpane, selectedItem return correctly, but after the radpane undocked, or docking again after undocked, the always selectedItem return null which I used for DragAndDrop. Anthing wrong or what should I do to get selectedItem return correct value? here is code:
<telerik:RadGridView
x:Name="itemView"
ItemsSource="{Binding AvailableItems}"
SelectedItem="{Binding SelectedAvailableItem}"
SelectionMode="Extended"
SelectionUnit="FullRow"
IsReadOnly="True"
CanUserSelect="True"
AllowDrop="True"
AutoGenerateColumns="False"
IsFilteringAllowed="False"
RowIndicatorVisibility="Collapsed"
Grid.Column="0"
Grid.Row="1">
<telerik:RadGridView.RowStyle>
<Style TargetType="telerik:GridViewRow">
<Setter Property="telerik:RadDragAndDropManager.AllowDrag" Value="True" />
<EventSetter Event="Control.RequestBringIntoView" Handler="RadGridView_RequestBringIntoView"/>
</Style>
</telerik:RadGridView.RowStyle>
</teleric.RadGridView>
in C#
RadDragAndDropManager.AddDragQueryHandler(itemView, OnGridViewDragQuery);
private void OnGridViewDragQuery(object sender, DragDropQueryEventArgs e)
{
try
{
if (sender is RadGridView)
{
RadGridView gridView = sender as RadGridView;
IList selectedItems = gridView.SelectedItems.ToList();
e.QueryResult = selectedItems.Count > 0;
e.Options.Payload = selectedItems;
}
else
{
e.QueryResult = true;
}
}
catch (Exception)
{
}
finally
{
e.Handled = true;
}
}
After undocking or docking again(data may rebinded), when drag a item in gridview, above gridView.SelectedItems in OnGridViewDragQuery() return null.
Thanks
Felix
7 Answers, 1 is accepted
0
Hello Felix,
The SelectedItem would be not preserved if the DataContent is lost on re-docking. To ensure this you should set a DataContext for the pane.
How does this work for you?
Regards,
Didie
Telerik
The SelectedItem would be not preserved if the DataContent is lost on re-docking. To ensure this you should set a DataContext for the pane.
How does this work for you?
Regards,
Didie
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Felix
Top achievements
Rank 1
answered on 05 Dec 2013, 08:12 PM
Hi Didie,
Thanks for your reply.
There is stackPanel in RadPane, the RadGridView(itemView) is which I want to drag, after re-docking, it is ok if pre-selection is gone but reselect is return null as in the first post. I am not sure how to set DataContext for the pane. can I get an example?
Thanks and best regards,
Felix
Thanks for your reply.
There is stackPanel in RadPane, the RadGridView(itemView) is which I want to drag, after re-docking, it is ok if pre-selection is gone but reselect is return null as in the first post. I am not sure how to set DataContext for the pane. can I get an example?
Thanks and best regards,
Felix
0
Hello,
I am not sure how have you defined your panes.
Still, a sample code would be similar to:
Regards,
Didie
Telerik
I am not sure how have you defined your panes.
Still, a sample code would be similar to:
<
telerik:RadPane
Title
=
"Description"
DataContext
=
"{Binding ElementName=radDocking1, Path=DataContext}"
>
Regards,
Didie
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Felix
Top achievements
Rank 1
answered on 09 Dec 2013, 07:41 PM
Hi Didie,
Thanks for your reply. I tried but doesn't work.
Here I attached code related to it. it looks a bit complicated, thanks for a lot for your help and support.
<Grid>
<Grid.Resources ...>
<telerikDocking:RadDocking
x:Name="myDocker"
Grid.Row="0" Grid.Column="0" >
<telerikDocking:RadDocking.DocumentHost >
<telerikDocking:RadSplitContainer
Orientation="Vertical"
InitialPosition="DockedRight">
<telerikDocking:RadPaneGroup x:Name="Group2">
<telerikDocking:RadDocumentPane
Header="DocPane"
CanFloat="False"
CanUserClose="False"
CanUserPin="False"
CanDockInDocumentHost="False"
PaneHeaderVisibility="Collapsed"
ContextMenuTemplate="{x:Null}"
Visibility="{Binding DocumentPaneHeader, Mode=OneTime}">
<Grid.Column="0" Grid.Row="0" >
<Grid .../>
</telerikDocking:RadDocumentPane>
</telerikDocking:RadSplitContainer>
</telerikDocking:RadDocking.DocumentHost>
<telerik:RadSplitContainer Name="LeftContainer"
Orientation="Vertical"
InitialPosition="DockedLeft">
<telerik:RadPaneGroup x:Name="Group1" >
<telerik:RadPane
CanFloat="True"
CanUserClose="False"
CanUserPin="True"
CanDockInDocumentHost="False"
IsSelected="{Binding Path=SelectedItemType, Mode=OneWay,
Converter={StaticResource protocolTypeToBoolConverter}, ConverterParameter={x:Static Helpers:ItemType.Type1}}">
<telerik:RadPane.Header>
<StackPanel Orientation="Horizontal">
<Image .../>
<TextBlock
Text="Items"
VerticalAlignment="Center"/>
</StackPanel>
</telerik:RadPane.Header>
<telerik:RadPane.TitleTemplate>
<DataTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="40"/>
</Grid.ColumnDefinitions>
<StackPanel
Grid.Column="0"
Orientation="Horizontal">
<Image ...>
<TextBlock
Text="Items"
VerticalAlignment="Center"/>
</StackPanel>
<telerik:RadButton
Grid.Column="1"
Width="18"
Height="18"
Margin="0,0,5,0"
HorizontalAlignment="Right"
Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type telerik:RadTabControl}}, Path=DataContext.AddItemCommand}"
CommandParameter="{Binding}"
ToolTip="Add sensor to graph">
<Grid>
<Image Source="/Images/Add.ico"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"/>
</Grid>
</telerik:RadButton>
<Grid Grid.Column="2"... >
</Grid>
</DataTemplate>
</telerik:RadPane.TitleTemplate>
<Grid Grid.Column="0" Grid.Row="0">
<...>
<Grid Grid.Column="{Binding Path=ColumnEquipment}"
Grid.Row="{Binding Path=RowEquipment}"
Grid.ColumnSpan="{Binding Path=ColumnSpanEquipment}"
Grid.RowSpan="{Binding Path=RowSpanEquipment}">
<telerik:RadDataFilter .../>
<telerik:RadGridView .../>
</Grid>
<GridSplitter.../>
<GridSplitter.../>
<Grid Grid.Column="{Binding Path=ColumnSensorProtocol}"
Grid.Row="{Binding Path=RowSensorProtocol}"
Grid.ColumnSpan="{Binding Path=ColumnSpanSensorProtocol}"
Grid.RowSpan="{Binding Path=RowSpanSensorProtocol}">
<Grid.RowDefinitions .../>
<telerik:RadDataFilter .../>
<telerik:RadGridView
x:Name="itemView"
ItemsSource="{Binding AvailableItems}"
SelectedItem="{Binding SelectedAvailableItem}"
SelectionMode="Extended"
SelectionUnit="FullRow"
IsReadOnly="True"
CanUserSelect="True"
AllowDrop="True"
AutoGenerateColumns="False"
IsFilteringAllowed="False"
RowIndicatorVisibility="Collapsed"
Grid.Column="0"
Grid.Row="1">
<telerik:RadGridView.RowStyle>
<Style TargetType="telerik:GridViewRow">
<Setter Property="telerik:RadDragAndDropManager.AllowDrag" Value="True" />
<EventSetter Event="Control.RequestBringIntoView" Handler="RadGridView_RequestBringIntoView"/>
</Style>
</telerik:RadGridView.RowStyle>
</teleric.RadGridView>
</Grid>
<Grid .../>
</Grid>
</telerik:RadPane>
<telerik:RadPane.../>
</telerik:RadPaneGroup>
</telerik:RadSplitContainer>
</telerikDocking:RadDocking>
</Grid>
Best regards
Felix
Thanks for your reply. I tried but doesn't work.
Here I attached code related to it. it looks a bit complicated, thanks for a lot for your help and support.
<Grid>
<Grid.Resources ...>
<telerikDocking:RadDocking
x:Name="myDocker"
Grid.Row="0" Grid.Column="0" >
<telerikDocking:RadDocking.DocumentHost >
<telerikDocking:RadSplitContainer
Orientation="Vertical"
InitialPosition="DockedRight">
<telerikDocking:RadPaneGroup x:Name="Group2">
<telerikDocking:RadDocumentPane
Header="DocPane"
CanFloat="False"
CanUserClose="False"
CanUserPin="False"
CanDockInDocumentHost="False"
PaneHeaderVisibility="Collapsed"
ContextMenuTemplate="{x:Null}"
Visibility="{Binding DocumentPaneHeader, Mode=OneTime}">
<Grid.Column="0" Grid.Row="0" >
<Grid .../>
</telerikDocking:RadDocumentPane>
</telerikDocking:RadSplitContainer>
</telerikDocking:RadDocking.DocumentHost>
<telerik:RadSplitContainer Name="LeftContainer"
Orientation="Vertical"
InitialPosition="DockedLeft">
<telerik:RadPaneGroup x:Name="Group1" >
<telerik:RadPane
CanFloat="True"
CanUserClose="False"
CanUserPin="True"
CanDockInDocumentHost="False"
IsSelected="{Binding Path=SelectedItemType, Mode=OneWay,
Converter={StaticResource protocolTypeToBoolConverter}, ConverterParameter={x:Static Helpers:ItemType.Type1}}">
<telerik:RadPane.Header>
<StackPanel Orientation="Horizontal">
<Image .../>
<TextBlock
Text="Items"
VerticalAlignment="Center"/>
</StackPanel>
</telerik:RadPane.Header>
<telerik:RadPane.TitleTemplate>
<DataTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="40"/>
</Grid.ColumnDefinitions>
<StackPanel
Grid.Column="0"
Orientation="Horizontal">
<Image ...>
<TextBlock
Text="Items"
VerticalAlignment="Center"/>
</StackPanel>
<telerik:RadButton
Grid.Column="1"
Width="18"
Height="18"
Margin="0,0,5,0"
HorizontalAlignment="Right"
Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type telerik:RadTabControl}}, Path=DataContext.AddItemCommand}"
CommandParameter="{Binding}"
ToolTip="Add sensor to graph">
<Grid>
<Image Source="/Images/Add.ico"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"/>
</Grid>
</telerik:RadButton>
<Grid Grid.Column="2"... >
</Grid>
</DataTemplate>
</telerik:RadPane.TitleTemplate>
<Grid Grid.Column="0" Grid.Row="0">
<...>
<Grid Grid.Column="{Binding Path=ColumnEquipment}"
Grid.Row="{Binding Path=RowEquipment}"
Grid.ColumnSpan="{Binding Path=ColumnSpanEquipment}"
Grid.RowSpan="{Binding Path=RowSpanEquipment}">
<telerik:RadDataFilter .../>
<telerik:RadGridView .../>
</Grid>
<GridSplitter.../>
<GridSplitter.../>
<Grid Grid.Column="{Binding Path=ColumnSensorProtocol}"
Grid.Row="{Binding Path=RowSensorProtocol}"
Grid.ColumnSpan="{Binding Path=ColumnSpanSensorProtocol}"
Grid.RowSpan="{Binding Path=RowSpanSensorProtocol}">
<Grid.RowDefinitions .../>
<telerik:RadDataFilter .../>
<telerik:RadGridView
x:Name="itemView"
ItemsSource="{Binding AvailableItems}"
SelectedItem="{Binding SelectedAvailableItem}"
SelectionMode="Extended"
SelectionUnit="FullRow"
IsReadOnly="True"
CanUserSelect="True"
AllowDrop="True"
AutoGenerateColumns="False"
IsFilteringAllowed="False"
RowIndicatorVisibility="Collapsed"
Grid.Column="0"
Grid.Row="1">
<telerik:RadGridView.RowStyle>
<Style TargetType="telerik:GridViewRow">
<Setter Property="telerik:RadDragAndDropManager.AllowDrag" Value="True" />
<EventSetter Event="Control.RequestBringIntoView" Handler="RadGridView_RequestBringIntoView"/>
</Style>
</telerik:RadGridView.RowStyle>
</teleric.RadGridView>
</Grid>
<Grid .../>
</Grid>
</telerik:RadPane>
<telerik:RadPane.../>
</telerik:RadPaneGroup>
</telerik:RadSplitContainer>
</telerikDocking:RadDocking>
</Grid>
Best regards
Felix
0
Accepted
Hi Felix,
I checked the xaml code you shared and it seems you have not explicitly set the DataContext for your RadPane. Would you please try setting it as I suggested?
Regards,
Didie
Telerik
I checked the xaml code you shared and it seems you have not explicitly set the DataContext for your RadPane. Would you please try setting it as I suggested?
Regards,
Didie
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Felix
Top achievements
Rank 1
answered on 12 Dec 2013, 11:55 PM
Hi Diedie,
It is works as you suggested, after set
<telerik:RadPane Title="Description"
DataContext="{Binding ElementName=myDocker, Path=DataContext}">
Thanks,
Felix
It is works as you suggested, after set
<telerik:RadPane Title="Description"
DataContext="{Binding ElementName=myDocker, Path=DataContext}">
Thanks,
Felix
0
Hi Felix,
I am glad to hear that!
Regards,
Didie
Telerik
I am glad to hear that!
Regards,
Didie
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>