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

Editable RadComboBox bound to DateTime

1 Answer 80 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Manas
Top achievements
Rank 1
Manas asked on 02 Sep 2010, 06:39 PM
I have a RadComboBox that is attached to DateTime type member of a Class collection. When I make the IsEditable="true" in the XAML, on Selection of an item from the ComboBox it shows the ToString() of the Class it self. If IsEditable="false" the Selected Text shows the date selected. I am actually using a Converter that converts the TransactionDate from Universal Time to local. In the pasted code I have simplfied it to just use the TransactionDate without any conversion. However without the converter also I see the same behavior on item selection from the RadComboBox (it shows the ToString() of the Class).

Simplified Code:
<telerikInput:RadComboBox x:Name="radCombo" IsEditable="True" Height="25" Width="120" ItemsSource="{Binding}" Grid.Row="6" Grid.Column="1">  
            <telerikInput:RadComboBox.ItemTemplate> 
                <DataTemplate > 
                    <Grid> 
                        <Grid.ColumnDefinitions> 
                            <ColumnDefinition Width="*"/>  
                        </Grid.ColumnDefinitions> 
                        <TextBlock Text="{Binding TransactionDate}" Grid.Column="0" /> 
                    </Grid> 
                </DataTemplate> 
            </telerikInput:RadComboBox.ItemTemplate>  
</telerikInput:RadComboBox>

Actual Code: (please note that the above simplified code without the Converter also shows the Class name rather than the selected item on selection when editable is turned on)

<telerikInput:RadComboBox x:Name="radCombo" IsEditable="True" Height="25" Width="120" ItemsSource="{Binding}" Grid.Row="6" Grid.Column="1">  
            <telerikInput:RadComboBox.ItemTemplate> 
                <DataTemplate > 
                    <Grid> 
                        <Grid.ColumnDefinitions> 
                            <ColumnDefinition Width="*"/>  
                        </Grid.ColumnDefinitions> 
                        <TextBlock Text="{Binding Converter={StaticResource dateLocal}, Path=TransactionDate}" Grid.Column="0" /> 
                    </Grid> 
                </DataTemplate> 
            </telerikInput:RadComboBox.ItemTemplate>  
</telerikInput:RadComboBox>

Thanks,
Manas

1 Answer, 1 is accepted

Sort by
0
Valeri Hristov
Telerik team
answered on 03 Sep 2010, 01:29 PM
Hello,

When IsEditable=true RadComboBox displays one of the telerik:TextSearch.TextPath, DisplayMemberPath or ToString() (in that order). If you are using ItemTemplate you could customize the displayed value in the TextBox by setting telerik:TextSearch.TextPath. Unfortunately there is no support for Converter when getting the property value. Instead, if your scenario allows this, you could override the ToString() method of the data object and return the proper value.

Here is a simple example, demonstrating the most common usages of the properties above:
http://demos.telerik.com/silverlight/#ComboBox/DataBinding

Greetings,
Valeri Hristov
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items
Tags
ComboBox
Asked by
Manas
Top achievements
Rank 1
Answers by
Valeri Hristov
Telerik team
Share this question
or