hi,
I still haven't able to figure out the problem of where I get the cast error, but since I still have other columns to play with, I can igore adding more columns for now. Seems like the casting problem only exists when I try to add more columns into my Grid, but for those existing data columns, I can complie the add TextBlock and TextBox into CellTemplate and CellEditTemplte, respectively, without any compiling errors. However, input text only stays inside the textbox if I put the textbox inside CellTemplate section, instead of the cellEditTemplte, which I think it is the proper wayt to do it. Anyways, I have the following xaml code for one of my input text column inside my GridView:
<
telerik:GridViewDataColumn DataMemberBinding="{Binding Quantity}" Header="Design Quantity" TextAlignment="Center" IsResizable="False">
<telerik:GridViewColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Quantity, Mode=TwoWay}" />
</DataTemplate>
</telerik:GridViewColumn.CellTemplate>
<telerik:GridViewColumn.CellEditTemplate>
<DataTemplate>
<TextBox Text="{Binding Quantity, Mode=TwoWay}"/>
</DataTemplate>
</telerik:GridViewColumn.CellEditTemplate>
</telerik:GridViewDataColumn>
I have the following c# code to control the above xaml grid code:
public
class TextBoxes : INotifyPropertyChanged
{
private string quantity;
public string Quantity;
{
get
{
return this.quantity;
}
set
{
this.quantity = value;
this.OnPropertyChanged("Quantity");
}
}
#region
INotifyPropertyChanged Members
public event PropertyChangedEventHandler PropertyChanged;
private void OnPropertyChanged(string propertyName)
{
if (this.PropertyChanged != null)
{
this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
}
#endregion
}
My intention is just setting up an empty column and lets user input the number of items they want into the GridView. But seems like the problem is harder than I thought. Although the attached project you sent last time wasn't able to compile, I had tried to copy and tailor the code to fit my project, but I still can't able to make my gridview working. Since I have never done programming in c# in the .NET environment before, and I have very little time to tackle down this problem, Can you please to give me some advise on how to make that column work in the GridView?
Thanks!