开发者

GridViewComboBoxColumn Telerik empty combobox until selected

I have a telerik GridView with a GridViewComboBoxColumn - this control is empty until i click on an item in that column. Once I click on that column these values appear.

<telerik:GridViewComboBoxColumn Header="Currency Quality" EditTriggers="CellClick" 
ItemsSource="{Binding Path=CurrencyQualityList, Source={StaticResource mainPageViewModel}}" 
SelectedValueMemberPath="DisplayText" 
DataMemberBinding="{Binding CurrencyQuality, Mode=TwoWay}" DisplayMemberPath="DisplayText">
</telerik:GridViewComboBoxColumn>

I read that at the top of my page to put this in.

<UserControl.Resources>
    <local:SearchRedemptionDetailViewModel x:Key="mainPageViewModel" />
</UserControl.Resources>

I am using an MVVM framework - I ha开发者_如何学JAVAve an observable collection of type LookupValue in my ViewModel. The source for my combobox is CurrencyQualityList. My lookup value has two properties, DisplayText and Value -

Even with these changes I still am unable to get the values to display.


Set the CellTemplate on the column to be the following.

<telerik:GridViewComoBoxColumn.CellTemplate>
    <DataTemplate>
        <TextBlock Text="{Binding Path=CurrencyQuality.DisplayText}"/>
    </DataTemplate>
</telerik:GridViewComoBoxColumn.CellTemplate>


Even I had the same issue but I got a workaround of it. We need to set the data source of the grid once we complete binding of the GridViewComboBoxColumn.

Sample code:

void BaseGridUserControl_LoadComboBoxColumns()
    {
        MYDomainContext myDomainContext =
                                        new MYDomainContext();
        #region Bind to Grade Code Column
        GridViewComboBoxColumn gradeCodeColumn =
              (GridViewComboBoxColumn)BaseGridUserControl.BaseGridControl.Columns["GRADE_ID"];

            if (gradeCodeColumn != null)
            {
                myDomainContext.Load(myDomainContext.GetGradesByBlockedQuery());
                gradeCodeColumn.ItemsSource = myDomainContext.GRADEs;
                gradeCodeColumn.DisplayMemberPath = "Grade_Desc";// +" " + "Grade_Description";
                gradeCodeColumn.SelectedValueMemberPath = "Grade_ID";
            }
        #endregion

       //Set the grid's data source here
       SetParentDataSource();

    }

I posted this query to Telerik but dont get good answered.

Please let me know if that works for you.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜