Editable RadComboBox bound to DateTime

2 posts, 0 answers
  1. Manas
    Manas avatar
    4 posts
    Member since:
    Apr 2010

    Posted 02 Sep 2010 Link to this post

    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
  2. Valeri Hristov
    Admin
    Valeri Hristov avatar
    2252 posts

    Posted 03 Sep 2010 Link to this post

    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
  3. DevCraft banner
Back to Top