Converter in radcombobox

2 posts, 0 answers
  1. gowthami
    gowthami avatar
    5 posts
    Member since:
    Jun 2011

    Posted 18 Aug 2011 Link to this post

    Hai,

    I have a combobox outside the grid.iam binding PhoneNumber In radcombobox.but i cannt binding in phoneformat.

    How to display in phoneformat?
    PhoneFormat.cs;
     public class PhoneFormat : IValueConverter
        {
            public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
            {
                string PhoneNumber = null;
                if (value != null)
                {
                    PhoneNumber = string.Format("{0:(###) ###-####}", System.Convert.ToInt64(value));
                }
                return PhoneNumber;
            }
     
            public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
            {
                throw new NotImplementedException();
            }
     
            internal void Convert(int? nullable)
            {
                throw new NotImplementedException();
            }
     
     
    xaml:
    <UserControl x:Class="BusinessAccounting.View.CustomerCreditMemo.CustomerCreditMemo"
         xmlns:Converter="clr-namespace:BusinessAccounting.Helpers.Converters"
        mc:Ignorable="d"
        d:DesignHeight="600" d:DesignWidth="1041"
                 xmlns:telerikRibbonBar="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.RibbonBar"
                 xmlns:telerikInput="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Input"
                 xmlns:TelerikDocking="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Docking"
                 xmlns:TelerikCombo="http://schemas.telerik.com/2008/xaml/presentation"
     xmlns:Converter="clr-namespace:BusinessAccounting.Helpers.Converters"
     
     
     
    <UserControl.Resources>
            <Icons:IconViewModel x:Key="iconviewmodel" />
            <!--<data:InvoiceContainer x:Key="Inv" />-->
            <Converter:PhoneFormat x:Key="phoneformat"/>
     
            <Style TargetType="GridViewFooter:GridViewFooterCell">
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate>
                            <Border BorderBrush="LightGray" BorderThickness="0,0,1,0" >
                                <Button x:Name="Btn_AddEmptyRow" Opacity="0" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Command="{Binding AddEmptyRowCommand, Source={StaticResource invoiceViewModel}}"/>
                            </Border>
                        </ControlTemplate>
                    </Setter.Value>
    </UserControl.Resources>
     
     
    <TextBlock x:Name="Lbl_Phone" Text="Phone" Grid.Row="0" Grid.Column="4" FontWeight="Normal" FontSize="10.667" VerticalAlignment="Top" Margin="5,0,0,0"/>
                            <telerikInput:RadComboBox x:Name="Cmb_Phone" 
                                      Grid.Row="0" Grid.Column="5" 
                                      Height="19" VerticalAlignment="Top"
                                       
                                      IsEditable="True" IsTextSearchEnabled="True"
                                      SelectedValuePath="PhoneID" Style="{StaticResource RadComboBoxStyle}"
                                      telerik:TextSearch.TextPath="PhoneNumber"
                                      FontSize="10.667" MinHeight="15" TabIndex="8" SelectionChanged="Cmb_Phone_SelectionChanged"  
                                                      ItemsSource="{Binding Phone}"   ClearSelectionButtonVisibility="Visible" SelectedItem="{Binding SelectedPhone,Converter={StaticResource phoneformat}, ConverterParameter={StaticResource Phoneformat}}"
                                      SelectedValue="{Binding CurrentInvoice.PhoneID}" >
     
                               
                                <TelerikCombo:RadComboBox.ItemsPanel>
                                    <ItemsPanelTemplate>
                                        <VirtualizingStackPanel />
                                    </ItemsPanelTemplate>
                                </TelerikCombo:RadComboBox.ItemsPanel>
     
                            </telerikInput:RadComboBox>
                            <Border x:Name="Bdr_Phone" Grid.Row="0" Grid.Column="4" Grid.ColumnSpan="2" BorderThickness="1" VerticalAlignment="Top" Height="19"/>
  2. Valeri Hristov
    Admin
    Valeri Hristov avatar
    2252 posts

    Posted 22 Aug 2011 Link to this post

    Hello Gowthami,

    Your requirement is not supported in RadComboBox when the IsEditable property is set to true.You need to create a property in your data items that returns the formatted value.

    Greetings,
    Valeri Hristov
    the Telerik team

    Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

  3. DevCraft banner
Back to Top