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

ComboBoxColumn display truncating

1 Answer 146 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Terry
Top achievements
Rank 1
Terry asked on 31 Aug 2015, 03:56 PM

 I have an expander containing a grid with a ComboBoxColumn and a template applied in order to provide for the application of a style to result in an embedded search behavior.  Mostly that works well, with one clear problem.  The text displayed in the resulting drop down is truncated and I have been unable to affect this truncation.

 

I doubt the converter I am using to load only distinct values has anything to do with the truncation, but I have include all of the potentially significant code and attached an image of the resulting display with a selection of a row being truncated in the drop down display (not in the grid cell) to demonstrate the problem.  I want to cause the drop down to use the entire width to display the items, and it is not.

 

I will entertain any useful recommendations.  I have tried manually controlling the width of the drop down both with explicit and automatic width settings in the template and it can change the width of the drop down, but the text is still truncated.

 

       <converters:DropDownCodesDistinctOpen x:Key="DropDownCodesDistinctOpen" />

======================================================== 

                    <telerik:RadExpander Style="{StaticResource RatesExpander}" Expanded="RadExpander_Expanded"
                            Header="Time Code (D) Flat" Name="rexTimeCode">
                        <StackPanel>
                            <telerik:RadGridView Style="{StaticResource rgvRatesDetail}"
                                    AddingNewDataItem="rgvTkprClass_AddingNewDataItem"
                                    CellEditEnded="rgvTkprIDActivityCode_CellEditEnded" Name="rgvTimeCode"
                                    RowValidating="IDs_RowValidating">
                                <telerik:RadGridView.Columns>
                                    <telerik:GridViewColumn>
                                        <telerik:GridViewColumn.CellTemplate>
                                            <DataTemplate>
                                                <telerik:RadButton Height="18" Width="20"
                                                        Command="telerik:RadGridViewCommands.Delete"
                                                        CommandParameter="{Binding}" Name="btnDelete">
                                                    <Image Source="/LawtimeMain;component/Icons/delete.png" />
                                                </telerik:RadButton>
                                            </DataTemplate>
                                        </telerik:GridViewColumn.CellTemplate>
                                    </telerik:GridViewColumn>
                                    <telerik:GridViewComboBoxColumn Width="*"
                                            DataMemberBinding="{Binding Id1, Mode=TwoWay}" 
                                            DisplayMemberPath="Value"
                                            ItemsSourceBinding="{Binding Id1, Converter={StaticResource DropDownCodesDistinctOpen}, ConverterParameter=TC}"
                                            SelectedValueMemberPath="Key"
                                            IsComboBoxEditable="True"
                                            EditTriggers="CellClick"
                                            Header="Time Code"
                                            CellStyleSelector="{StaticResource CellStyleSelector}"
                                            IsSortable="True">
                                        <telerik:GridViewComboBoxColumn.EditorStyle>
                                            <Style TargetType="telerik:RadComboBox">
                                                <Setter Property="ItemContainerStyle" Value="{StaticResource comboBoxItemStyle}" />
                                                <Setter Property="IsFilteringEnabled" Value="True"/>
                                                <Setter Property="StaysOpenOnEdit" Value="True"/>
                                                <Setter Property="OpenDropDownOnFocus" Value="True"/>
                                                <Setter Property="TextSearchMode" Value="Contains" />
                                                <Setter Property="ItemsPanel">
                                                    <Setter.Value>
                                                        <ItemsPanelTemplate>
                                                            <StackPanel/>
                                                        </ItemsPanelTemplate>
                                                    </Setter.Value>
                                                </Setter>
                                            </Style>
                                        </telerik:GridViewComboBoxColumn.EditorStyle>
                                    </telerik:GridViewComboBoxColumn>

                                    <telerik:GridViewCheckBoxColumn
                                            CellStyleSelector="{StaticResource CellStyleSelector}"
                                            DataMemberBinding="{Binding IsPercent}" Header="%" />
                                    <telerik:GridViewDataColumn CellStyleSelector="{StaticResource CellStyleSelector}"
                                            DataFormatString="{}{0:n}" DataMemberBinding="{Binding RateOrPct}"
                                            Header="Rate" />
                                </telerik:RadGridView.Columns>
                                <telerik:RadGridView.Resources>
                                    <Style TargetType="TextBlock" />
                                </telerik:RadGridView.Resources>
                            </telerik:RadGridView>
                        </StackPanel>
                    </telerik:RadExpander>

================================================= 

     public class DropDownCodesDistinctOpen : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            return LawtimeMain.LMUtils.GetCodeDropDownDistinctOpen(parameter.ToString(),8);

        }
        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            return "";
        }
    }
=========================================

        public static List<ddKeyValue> GetCodeDropDownDistinctOpen(string codeType, int? keywidth)
        {
            App ap = (App)Application.Current;
            List<ddKeyValue> ddClass = new List<ddKeyValue>();

            var tkclass = from LTMainService.LTCode a in ap.mpData.LTCodes where a.RecordType == codeType orderby  a.CoCode ,a.Description select a;

            foreach (var a in tkclass)
            {
                if (a.Status != 'C' && LawtimeMain.LMUtils.FindKey(ddClass,a.CoCode.Trim())==null)
                {//could use .contains if I figured out how do to an equality specified dynamically
                    ddKeyValue ddkv = new ddKeyValue();
                    ddkv.Key = a.CoCode.Trim();
                    if (keywidth != null && keywidth > 0)
                    {
                        ddkv.Value = a.CoCode + new String(' ', (int)(keywidth - a.CoCode.Length)) + a.Description.Trim();
                    }
                    else
                    {
                        ddkv.Value = a.CoCode.Trim() + " " + a.Description.Trim();
                    }

                    ddkv.Status = a.Status;
                    ddClass.Add(ddkv);
                }
           }
            return ddClass;
        }

        public static object FindKey(List<ddKeyValue> myList, string key)
        { 
            foreach (var item in myList)
            {
                if (item.Key == key)
                    return item;
            }
            return null;
        }


1 Answer, 1 is accepted

Sort by
0
Nasko
Telerik team
answered on 03 Sep 2015, 07:51 AM
Hi Terry,

We are not aware of the observed by you appearance of RadGridView's GridViewComboBoxColumn. However, we noticed that a lot Styles and StyleSelectors have been modified and set to the RadExpander, RadGridView etc. - some of the applied styles could cause the observed unexpected appearance.

Could you please try to isolate the issue in a simple sample project and send it back to us - thus we could be able to continue our investigation and provide you with a prompt solution or some detailed technical instructions how to resolve it.

We are looking forward to hearing from you.

Regards,
Nasko
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
ComboBox
Asked by
Terry
Top achievements
Rank 1
Answers by
Nasko
Telerik team
Share this question
or