This question is locked. New answers and comments are not allowed.
Hi
I am fairly new to both Silverlight and RadGridView for Silverlight. I have two issues.
1. I have a RadGridView that is bound to an ObservableCollection in my ViewModel. Things seem to work pretty much good except when the grid is populated, pressing the "Insert" key or clicking the area "Click here to add new row" does not seem to have any effect. I have not written any code to add a new row. But I assume, RadGridView is smart enough to insert a blank row in the grid so that the user can fill into the row. This is mostly a simple grid except that the itemsource comes from a viewmodel Observable collection. What do I need to do to get this thing working? Here is my XAML code.
2. I also have a RadContextMenu on this grid. I would like to confine the visibility of this context menu only when one clicks some where in the data rows area. In other words, I don't want the menu pop up when one clicks in the column header area or in the grouping area or anywhere else. Just on the data rows. How can I do this? Thanks.
Babu.
I am fairly new to both Silverlight and RadGridView for Silverlight. I have two issues.
1. I have a RadGridView that is bound to an ObservableCollection in my ViewModel. Things seem to work pretty much good except when the grid is populated, pressing the "Insert" key or clicking the area "Click here to add new row" does not seem to have any effect. I have not written any code to add a new row. But I assume, RadGridView is smart enough to insert a blank row in the grid so that the user can fill into the row. This is mostly a simple grid except that the itemsource comes from a viewmodel Observable collection. What do I need to do to get this thing working? Here is my XAML code.
<UserControl x:Class="Library.Views.Contributors" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" d:DesignHeight="500" d:DesignWidth="700" xmlns:riaControls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.DomainServices" xmlns:my="clr-namespace:Library.Web.Model" xmlns:my1="clr-namespace:Library.Web.Service" xmlns:vm="clr-namespace:Library.ViewModels" xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk" xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"> <UserControl.Resources> <vm:ContributorListViewModel x:Key="ContributorsViewModel" xmlns:vm="clr-namespace:Library.ViewModels" /> </UserControl.Resources> <Grid x:Name="LayoutRoot" Background="White" DataContext="{Binding Source={StaticResource ContributorsViewModel}}"> <Grid.ColumnDefinitions> <ColumnDefinition Width="0.731*"/> <ColumnDefinition Width="0.269*"/> </Grid.ColumnDefinitions> <Grid.RowDefinitions> <RowDefinition Height="0.8*"/> <RowDefinition Height="0.2*"/> </Grid.RowDefinitions> <telerik:RadGridView HorizontalAlignment="Left" Name="rgContributors" VerticalAlignment="Top" Width="Auto" ItemsSource="{Binding Path=Contribs}" ShowInsertRow="True" AutoGenerateColumns="False" Height="Auto" Grid.Row="0" Grid.ColumnSpan="2"> <telerik:RadContextMenu.ContextMenu> <telerik:RadContextMenu x:Name="GridContextMenu"> <telerik:RadMenuItem Header="Add Row" Click="RadMenuItem_Click" /> <telerik:RadMenuItem Header="DeleteRow" Click="RadMenuItem_Click" /> </telerik:RadContextMenu> </telerik:RadContextMenu.ContextMenu> <telerik:RadGridView.Columns> <telerik:GridViewDataColumn Header="ID" UniqueName="PKId" DataMemberBinding="{Binding PKId}" Width="100" IsReadOnly="True" /> <telerik:GridViewDataColumn Header="Name" UniqueName="Name" Width="300" DataMemberBinding="{Binding Name}" /> <telerik:GridViewDataColumn Header="Description" UniqueName="Description" Width="400" DataMemberBinding="{Binding Description}" /> </telerik:RadGridView.Columns> </telerik:RadGridView> <telerik:RadDataPager Height="28" HorizontalAlignment="Left" Margin="8,16,0,0" Name="radDataPager1" VerticalAlignment="Top" Grid.Row="1" Grid.Column="0" d:LayoutOverrides="HorizontalAlignment, VerticalAlignment" Source="{Binding Contribs, Mode=OneWay}" PageSize="5" DisplayMode="All" /> <StackPanel HorizontalAlignment="Left" Height="Auto" Grid.Row="1" Grid.Column="1" Margin="12,16,0,0" Orientation="Horizontal" VerticalAlignment="Top" Width="Auto"> <Button Content="Save" Height="25" Name="btnSave" Width="Auto" Margin="5" Command="{Binding Path=SaveCommand}" /> <Button Content="Add New" Height="25" Name="btnAdd" Width="Auto" Margin="5" Command="{Binding Path=AddCommand}" /> </StackPanel> </Grid> </UserControl> 2. I also have a RadContextMenu on this grid. I would like to confine the visibility of this context menu only when one clicks some where in the data rows area. In other words, I don't want the menu pop up when one clicks in the column header area or in the grouping area or anywhere else. Just on the data rows. How can I do this? Thanks.
Babu.