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;
}