This question is locked. New answers and comments are not allowed.
Hai,
I have a combobox outside the grid.iam binding PhoneNumber In radcombobox.but i cannt binding in phoneformat.
How to display in phoneformat?
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"
/>