This is a migrated thread and some comments may be shown as answers.

RadGridView: Add new Row isn't clickable

3 Answers 137 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Dmitrijs
Top achievements
Rank 1
Dmitrijs asked on 02 Aug 2012, 09:35 AM
Hi,
I see "Click here to add new item" , but it doesnt work. It's not enabled(clickable). Where i messed up? =)
<
telerik:RadGridView Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="3" ItemsSource="{Binding Path=Step.Outputs,Mode=TwoWay}" ShowInsertRow="True" IsReadOnly="False" EditTriggers="CellClick" CanUserInsertRows="True" CanUserDeleteRows="True" AutoGenerateColumns="False" CanUserSortColumns="False" ShowGroupPanel="False" ShowGroupFooters="False">
    <telerik:RadGridView.Columns>
        <telerik:GridViewComboBoxColumn Width="Auto" Header="Typ">
            <telerik:GridViewComboBoxColumn.ItemTemplate>
                <DataTemplate>
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition Width="*"/>
                        </Grid.ColumnDefinitions>
                        <Image Source="{Binding Path=OutputType.IconId, Mode=TwoWay, Converter={StaticResource imageConverter}, ConverterParameter='png'}" Grid.Column="0" VerticalAlignment="Center"/>
                        <TextBlock Text="{Binding Path=OutputType.Name, Mode=TwoWay}" Grid.Column="1"></TextBlock>
                    </Grid>
                </DataTemplate>
            </telerik:GridViewComboBoxColumn.ItemTemplate>
        </telerik:GridViewComboBoxColumn>
        <telerik:GridViewDataColumn Width="*"  Header="Text" DataMemberBinding="{Binding Path=CurrentText, Mode=TwoWay}">
        </telerik:GridViewDataColumn>
    </telerik:RadGridView.Columns>
</telerik:RadGridView>
Step.Outputs - ObserverableCollection

3 Answers, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 02 Aug 2012, 12:02 PM
Hi,

 May I ask you to share some more information on how is you bound collection defined?

Regards,
Didie
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Dmitrijs
Top achievements
Rank 1
answered on 02 Aug 2012, 12:07 PM
<telerik:RadGridView Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="3" ItemsSource="{Binding Path=Step.Outputs,Mode=TwoWay}" ShowInsertRow="True" IsReadOnly="False" EditTriggers="CellClick" CanUserInsertRows="True" CanUserDeleteRows="True" AutoGenerateColumns="False" CanUserSortColumns="False" ShowGroupPanel="False" ShowGroupFooters="False">
    <telerik:RadGridView.Columns>
        <telerik:GridViewComboBoxColumn Width="Auto" Header="Typ" ItemsSource="{Binding OutputTypes}">
            <telerik:GridViewComboBoxColumn.ItemTemplate>
                <DataTemplate>
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition Width="*"/>
                        </Grid.ColumnDefinitions>
                        <Image Source="{Binding Path=IconId, Mode=TwoWay, Converter={StaticResource imageConverter}, ConverterParameter='png'}" Grid.Column="0" VerticalAlignment="Center"/>
                        <TextBlock Text="{Binding Path=Name, Mode=TwoWay}" Grid.Column="1"></TextBlock>
                    </Grid>
                </DataTemplate>
            </telerik:GridViewComboBoxColumn.ItemTemplate>
        </telerik:GridViewComboBoxColumn>
        <telerik:GridViewDataColumn Width="*"  Header="Text" DataMemberBinding="{Binding Path=Step.Outputs.CurrentText, Mode=TwoWay}">
        </telerik:GridViewDataColumn>
    </telerik:RadGridView.Columns>
</telerik:RadGridView>
 
I changed the xaml code a little bit.
How i can bound Step.Outputs[].OutputType on
<telerik:GridViewComboBoxColumn Width="Auto" Header="Typ" ItemsSource="{Binding OutputTypes}"> 

public Step Step
{
    get{
        return this._step;}
    set{
    this._step=value;
    this.NotifyOfPropertyChange(() => this.Step);
    }
}

step has Outputs - ObserverableCollection<IOutput>
each output has OutputType (IOutput)
0
Dimitrina
Telerik team
answered on 02 Aug 2012, 04:30 PM
Hi,

 Thank you. 

Generally the reason why you can not add any entry, would be because the RadGridView does not know how to create the new object of the bound type. This is due to the fact that the bound items does not have a default constructor.

All the best,
Didie
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
GridView
Asked by
Dmitrijs
Top achievements
Rank 1
Answers by
Dimitrina
Telerik team
Dmitrijs
Top achievements
Rank 1
Share this question
or