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

Numeric values are not displaying on combobox selected item

5 Answers 126 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Ravi
Top achievements
Rank 1
Ravi asked on 06 Jun 2013, 07:27 AM
Hi There,
I have a strange problem with selected item of combobox.

I have created a template for combobox to display ellipses when text is trimming, for this i have removed the content presenter and replaced with textblock. when i display sting value then its working fine, but if i try to bind with numeric value then i am not able to see the selected value on combobox. 

Can you please tell me how can i fix this? is there any other  way that i can control this from the style of radcombobox.

Sample Style which i have created.:
<ControlTemplate x:Key="NonEditableComboBox" TargetType="telerikInput:RadComboBox">
       <Grid x:Name="VisualRoot">
           <VisualStateManager.VisualStateGroups>
               <VisualStateGroup x:Name="CommonStates">
                   <VisualState x:Name="Disabled">
                       <Storyboard>
                           <DoubleAnimationUsingKeyFrames Storyboard.TargetName="PART_DropDownButton" Storyboard.TargetProperty="Opacity">
                               <DiscreteDoubleKeyFrame KeyTime="0:0:0" Value=".5" />
                           </DoubleAnimationUsingKeyFrames>
                       </Storyboard>
                   </VisualState>
                   <VisualState x:Name="Normal">
                   </VisualState>
                   <VisualState x:Name="MouseOver">
                       <Storyboard>
                           <ObjectAnimationUsingKeyFrames Storyboard.TargetName="BackgroundBorder" Storyboard.TargetProperty="Background">
                               <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource HoverBackground}" />
                           </ObjectAnimationUsingKeyFrames>
                           <ObjectAnimationUsingKeyFrames Storyboard.TargetName="DropDownIcon" Storyboard.TargetProperty="Foreground">
                               <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource ButtonIconForeground_MouseOver}" />
                           </ObjectAnimationUsingKeyFrames>
                           <ObjectAnimationUsingKeyFrames Storyboard.TargetName="DropDownIcon" Storyboard.TargetProperty="Background">
                               <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource ButtonIconBackground_MouseOver}" />
                           </ObjectAnimationUsingKeyFrames>
                       </Storyboard>
                   </VisualState>
                   <VisualState x:Name="DropDownOpen">
                       <Storyboard>
                           <ObjectAnimationUsingKeyFrames Storyboard.TargetName="BackgroundBorder" Storyboard.TargetProperty="Background">
                               <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource DropDownOpenBackground}" />
                           </ObjectAnimationUsingKeyFrames>
                           <ObjectAnimationUsingKeyFrames Storyboard.TargetName="DropDownIcon" Storyboard.TargetProperty="Foreground">
                               <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource ButtonIconForeground_Pressed}" />
                           </ObjectAnimationUsingKeyFrames>
                           <ObjectAnimationUsingKeyFrames Storyboard.TargetName="DropDownIcon" Storyboard.TargetProperty="Background">
                               <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource ButtonIconBackground_Pressed}" />
                           </ObjectAnimationUsingKeyFrames>
                           <ObjectAnimationUsingKeyFrames Storyboard.TargetName="FocusBorder" Storyboard.TargetProperty="Visibility">
                               <DiscreteObjectKeyFrame KeyTime="0">
                                   <DiscreteObjectKeyFrame.Value>
                                       <Visibility>Collapsed</Visibility>
                                   </DiscreteObjectKeyFrame.Value>
                               </DiscreteObjectKeyFrame>
                           </ObjectAnimationUsingKeyFrames>
                           <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PopupFakeBorder"
                                   Storyboard.TargetProperty="Visibility">
                               <DiscreteObjectKeyFrame KeyTime="0">
                                   <DiscreteObjectKeyFrame.Value>
                                       <Visibility>Visible</Visibility>
                                   </DiscreteObjectKeyFrame.Value>
                               </DiscreteObjectKeyFrame>
                           </ObjectAnimationUsingKeyFrames>
                       </Storyboard>
                   </VisualState>
               </VisualStateGroup>
               <VisualStateGroup x:Name="FocusStates">
                   <VisualState x:Name="Focused">
                       <Storyboard>
                           <ObjectAnimationUsingKeyFrames Storyboard.TargetName="FocusBorder" Storyboard.TargetProperty="Visibility">
                               <DiscreteObjectKeyFrame KeyTime="0">
                                   <DiscreteObjectKeyFrame.Value>
                                       <Visibility>Visible</Visibility>
                                   </DiscreteObjectKeyFrame.Value>
                               </DiscreteObjectKeyFrame>
                           </ObjectAnimationUsingKeyFrames>
                       </Storyboard>
                   </VisualState>
                   <VisualState x:Name="Unfocused" />
               </VisualStateGroup>
           </VisualStateManager.VisualStateGroups>
           <Border x:Name="PopupFakeBorder" Visibility="Collapsed" BorderThickness="1,0,1,0" CornerRadius="5,5,0,0"
                   Grid.ColumnSpan="2" Background="{StaticResource PickerPopupBackground_fake}"
                   BorderBrush="{TemplateBinding BorderBrush}" />
           <Border IsHitTestVisible="False" Background="{TemplateBinding Background}" CornerRadius="5" />
           <telerik:RadToggleButton x:Name="PART_DropDownButton" Foreground="{TemplateBinding Foreground}" IsTabStop="False" Margin="0" Padding="0" ClickMode="Press">
               <telerik:RadToggleButton.Template>
                   <ControlTemplate TargetType="telerik:RadToggleButton">
                       <ContentPresenter />
                   </ControlTemplate>
               </telerik:RadToggleButton.Template>
               <Grid>
                   <Grid.ColumnDefinitions>
                       <ColumnDefinition Width="*" />
                       <ColumnDefinition Width="36" />
                   </Grid.ColumnDefinitions>
                   <Border x:Name="BackgroundBorder"
                           CornerRadius="{StaticResource SplitButton_SpanCornerRadius}"
                           Grid.ColumnSpan="2"
                           BorderBrush="{StaticResource Control_OuterBorderBrush}" BorderThickness="1" Background="{StaticResource DefaultBackground}" />
                   <ContentControl x:Name="DropDownIcon"
                                   Grid.Column="1"
                                   IsTabStop="False"
                                   Foreground="{StaticResource ButtonIconForeground_Normal}"
                                   Background="{StaticResource ButtonIconBackground_Normal}"
                                   Template="{StaticResource ArrowTemplateNonEditableCombobox}" />
                   <TextBlock x:Name="Content"
                              FontFamily="Segoe UI"
                              IsHitTestVisible="True"
                              Grid.Column="0"
                              Foreground="{TemplateBinding Foreground}"
                              HorizontalAlignment="Left"
                              Margin="{TemplateBinding Padding}"
                              VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                              Text="{TemplateBinding SelectionBoxItem}"
                              TextTrimming="CharacterEllipsis"
                              ToolTip="{TemplateBinding  SelectionBoxItem}">
                
                   </TextBlock>
                   <!--<ContentPresenter x:Name="Content"
                                     Grid.Column="0"
                                     Margin="{TemplateBinding Padding}"
                                     IsHitTestVisible="False"
                                     Content="{TemplateBinding SelectionBoxItem}"
                                     ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}"
                                     TextBlock.Foreground="Black"
                                     HorizontalAlignment="Left"
                                     VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
                      
                   </ContentPresenter>-->
                   <Border x:Name="FocusBorder"
                           BorderThickness="1"
                           Margin="1"
                           Visibility="Collapsed"
                           BorderBrush="{StaticResource Control_FocusBorderBrush}" Grid.ColumnSpan="2" CornerRadius="3" />
               </Grid>
           </telerik:RadToggleButton>
           <Popup x:Name="PART_Popup">
               <Grid x:Name="PopupRoot">
                   <Border BorderThickness="{TemplateBinding BorderThickness}" Margin="0,-10,0,0" Padding="0,10,0,0" BorderBrush="{TemplateBinding BorderBrush}" MinWidth="{TemplateBinding MinDropDownWidth}" MaxHeight="{TemplateBinding MaxDropDownHeight}" Background="{StaticResource PickerPopupBackground}" CornerRadius="0 0 5 5">
                       <Grid>
                           <Grid.RowDefinitions>
                               <RowDefinition Height="Auto" />
                               <RowDefinition Height="*" />
                           </Grid.RowDefinitions>
                           <telerik:RadButton x:Name="PART_ClearButton" Grid.Row="0" Margin="-1 -1 -1 0" Visibility="{TemplateBinding ClearSelectionButtonVisibility}" Content="{TemplateBinding ClearSelectionButtonContent}" />
                           <ScrollViewer x:Name="PART_ScrollViewer" Grid.Row="1" Foreground="{TemplateBinding Foreground}" Padding="0 1 0 0" BorderThickness="0" VerticalScrollBarVisibility="Auto" CanContentScroll="True">
                               <ItemsPresenter />
                           </ScrollViewer>
                       </Grid>
                   </Border>
               </Grid>
           </Popup>
       </Grid>
   </ControlTemplate>

Regards,
Srinivas.

5 Answers, 1 is accepted

Sort by
0
Konstantina
Telerik team
answered on 07 Jun 2013, 06:47 AM
Hi Srinivas,

You could use the SelectionBoxTemplate property of the RadComboBox instead of editing the whole ControlTemplate of the control. For example:

<telerik:RadComboBox ItemsSource="{Binding HostComboItems}" VerticalAlignment="Center" 
                          DisplayMemberPath="DisplayText"
                          Width="120">            
           <telerik:RadComboBox.SelectionBoxTemplate>
              <DataTemplate>
                  <TextBlock Text="{Binding DisplayText}" TextTrimming="CharacterEllipsis" FontSize="20"/>
              </DataTemplate>
          </telerik:RadComboBox.SelectionBoxTemplate>
      </telerik:RadComboBox>

For more information about RadComboBox you could refer to our online documentation.

Hope this helps. Please let us know if you have further questions.

Regards,
Konstantina
Telerik

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Ravi
Top achievements
Rank 1
answered on 07 Jun 2013, 07:09 AM
Hi Konstantina,
Thanks for your reply, 

There is a strong reason for us to keep this in the controltemplate. because we can keep this in one place(resourcedictionary) and it can apply automatically to all the modules.

so can you tell me how i can do this ?


Regards,
Srinivas.

0
Konstantina
Telerik team
answered on 11 Jun 2013, 08:11 AM
Hi Srinivas,

I am sorry, but I am not able to create a project with the template you've pasted as it misses too much StaticResources.
Could you please prepare a really simple project with this template with all the resources it uses and a ComboBox bound to an integer property which is not displayed properly.
In that way we will be able to review it in details and track down the source of the problem.

Looking forward to your reply.

Regards,
Konstantina
Telerik

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Ravi
Top achievements
Rank 1
answered on 11 Jul 2013, 11:12 AM
Hi Konstantina,

Sorry for late reply.

Sorry i cannot attache the sample project because only png, jpeg and gif files are supported in telerik forum, so i have pasted my resource dictionary here please check at the x:Key="NonEditableComboBox" where i have added a texblock and to this i have attached a behavior which can display ellipses. 
please bind the combobox to any class object which is numerick and test, you will notice that nothing is displayed.

Resource dictionary:
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
                    xmlns:sys="clr-namespace:System;assembly=mscorlib"
                    xmlns:calculator="clr-namespace:Telerik.Windows.Controls.Calculator;assembly=Telerik.Windows.Controls.Input"
                    xmlns:controls="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Input"
                    xmlns:telerikInput="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Input"
                    xmlns:calendar="clr-namespace:Telerik.Windows.Controls.Calendar;assembly=Telerik.Windows.Controls.Input"
                    xmlns:theme="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero"
                    xmlns:telerikChromes="clr-namespace:Telerik.Windows.Controls.Chromes;assembly=Telerik.Windows.Controls"
                    xmlns:primitives="clr-namespace:Telerik.Windows.Controls.Primitives;assembly=Telerik.Windows.Controls"
                    xmlns:telerikMaskedTextBox="clr-namespace:Telerik.Windows.Controls.MaskedTextBox;assembly=Telerik.Windows.Controls.Input"
                    xmlns:telerikMaskedInput="clr-namespace:Telerik.Windows.Controls.MaskedInput;assembly=Telerik.Windows.Controls.Input"
                    xmlns:telerikRating="clr-namespace:Telerik.Windows.Controls.Rating;assembly=Telerik.Windows.Controls.Input"
                    xmlns:colorPickerConverters="clr-namespace:Telerik.Windows.Controls.ColorEditor.Converters;assembly=Telerik.Windows.Controls.Input"
                    xmlns:colorPicker="clr-namespace:Telerik.Windows.Controls.ColorEditor;assembly=Telerik.Windows.Controls.Input"
                    xmlns:maskedInput="clr-namespace:Telerik.Windows.Controls.MaskedInput;assembly=Telerik.Windows.Controls.Input"
                    xmlns:effects="clr-namespace:Telerik.Windows.Controls.ColorEditor.Effects;assembly=Telerik.Windows.Controls.Input"
                    xmlns:colorMode="clr-namespace:Telerik.Windows.Controls.ColorEditor.Mode;assembly=Telerik.Windows.Controls.Input"
                    xmlns:colorEditorHelpers="clr-namespace:Telerik.Windows.Controls.ColorEditor.Helpers;assembly=Telerik.Windows.Controls.Input"
                    xmlns:pad="clr-namespace:Telerik.Windows.Controls.ColorEditor.Pad;assembly=Telerik.Windows.Controls.Input"
                    xmlns:bhv="clr-namespace:Intergraph.WPF.UI.Toolkit.Behaviors"
                    xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
                    xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions">
     
    <SolidColorBrush x:Key="ControlOuterBorder_Normal" Color="#FF000000" />
    <SolidColorBrush x:Key="ControlOuterBorder_MouseOver" Color="#FFFFC92B" />
    <LinearGradientBrush x:Key="ControlOuterBorder_Pressed" EndPoint="0.5,1" StartPoint="0.5,0">
        <GradientStop Color="#FF282828" />
        <GradientStop Color="#FF5F5F5F" Offset="1" />
    </LinearGradientBrush>
    <SolidColorBrush x:Key="ControlOuterBorder_Disabled" Color="#FF989898" />
    <SolidColorBrush x:Key="ControlBackground_Disabled" Color="#FFE0E0E0" />
    <SolidColorBrush x:Key="ControlOuterBorder_Focused" Color="#FFFFC92B" />
    <SolidColorBrush x:Key="ControlInnerBorder_Focused" Color="Transparent" />
    <SolidColorBrush x:Key="ControlOuterBorder_Highlighted" Color="#FF7E98C6" />
    <LinearGradientBrush x:Key="ControlBackground_Highlighted" EndPoint="0.5,1" StartPoint="0.5,0">
        <GradientStop Color="#FFD3E6F7" Offset="1" />
        <GradientStop Color="#FFEFF5FC" Offset="0" />
    </LinearGradientBrush>
    <SolidColorBrush x:Key="ControlInnerBorder_Highlighted" Color="#FFFFFFFF" />
    <SolidColorBrush x:Key="PickerForeground_Disabled" Color="#FF8D8D8D" />
    <SolidColorBrush x:Key="ButtonIconForeground_Disabled" Color="#FF8D8D8D" />
    <SolidColorBrush x:Key="ButtonIconBackground_Disabled" Color="#FFFFFFFF" />
    <SolidColorBrush x:Key="ButtonIconForeground_MouseOver" Color="#FF000000" />
    <SolidColorBrush x:Key="ButtonIconBackground_MouseOver" Color="#FFFFFFFF" />
    <SolidColorBrush x:Key="ButtonIconForeground_Pressed" Color="#FF000000" />
    <SolidColorBrush x:Key="ButtonIconBackground_Pressed" Color="#FFFFFFFF" />
    <SolidColorBrush x:Key="PickerBackground_Normal" Color="#FFCCCCCC" />
    <CornerRadius x:Key="SplitButton_LeftPartCornerRadius">5 0 0 5</CornerRadius>
    <CornerRadius x:Key="SplitButton_SpanCornerRadius">5</CornerRadius>
    <CornerRadius x:Key="SplitButton_SpanInnerCornerRadius">0</CornerRadius>
    <CornerRadius x:Key="SplitButton_RightPartCornerRadius">0 5 5 0</CornerRadius>
    <SolidColorBrush x:Key="ButtonIconForeground_Normal" Color="#FF000000" />
    <SolidColorBrush x:Key="ButtonIconBackground_Normal" Color="#FFFFFFFF" />
 
    <!-- New -->
    <LinearGradientBrush x:Key="DefaultBackground" StartPoint=".5,0" EndPoint=".5,1">
        <GradientStop Color="#FFD1D5DB" Offset="0" />
        <GradientStop Color="#FFC9CDD4" Offset=".50" />
        <GradientStop Color="#FFBDC3CB" Offset=".51" />
        <GradientStop Color="#FFAEB6BF" Offset="1" />
    </LinearGradientBrush>
    <LinearGradientBrush x:Key="HoverBackground" StartPoint=".5,0" EndPoint=".5,1">
        <GradientStop Color="#FFECEEF3" Offset="0" />
        <GradientStop Color="#FFD3D6DD" Offset=".50" />
        <GradientStop Color="#FFC8CCD4" Offset=".51" />
        <GradientStop Color="#FFAFB7C0" Offset="1" />
    </LinearGradientBrush>
    <LinearGradientBrush x:Key="DropDownOpenBackground" StartPoint=".5,0" EndPoint=".5,1">
        <GradientStop Color="#FFAEB6BF" Offset="0" />
        <GradientStop Color="#FFCFD3D9" Offset="1" />
    </LinearGradientBrush>
    <SolidColorBrush x:Key="Control_OuterBorderBrush"
                     Color="#FF344A63" />
    <SolidColorBrush x:Key="Control_FocusBorderBrush"
                     Color="#FF0067A2" />
 
    <ControlTemplate x:Key="ArrowTemplateEditableCombobox" TargetType="ContentControl">
        <Grid Margin="5 0">
            <!--<Path x:Name="BackgroundIcon" Data="M0,0 L2,0 1,1 Z" Stretch="Fill" Width="10" Height="3" Fill="{TemplateBinding Background}" Margin="0 2 0 0" />-->
            <Path x:Name="ForegroundIcon" Data="M0,0 L2,0 1,1 Z" Stretch="Fill" Width="10" Height="8" Fill="#FF4D4F4F" Margin="0 3 0 1" />
        </Grid>
    </ControlTemplate>
    <SolidColorBrush x:Key="PickerPopupBackground_fake" Color="#FFF9FAFB" />
    <LinearGradientBrush x:Key="PickerPopupBackground" StartPoint=".5,0" EndPoint=".5,1">
        <GradientStop Color="#FFF9FAFB" Offset="0" />
        <GradientStop Color="#FFE3E5E5" Offset="1" />
    </LinearGradientBrush>
    <ControlTemplate x:Key="ArrowTemplateNonEditableCombobox" TargetType="ContentControl">
        <Grid Margin="5 0">
            <!--<Path x:Name="BackgroundIcon" Data="M0,0 L2,0 1,1 Z" Stretch="Fill" Width="10" Height="3" Fill="{TemplateBinding Background}" Margin="0 2 0 0" />-->
            <Path x:Name="ForegroundIcon" Data="M0,0 L2,0 1,1 Z" Stretch="Fill" Width="10" Height="8" Fill="#FF4D4F4F" Margin="0 3 0 1" />
        </Grid>
    </ControlTemplate>
    <SolidColorBrush x:Key="PickerForeground_Normal" Color="#FF000000" />
    <ControlTemplate x:Key="EditableComboBox" TargetType="telerikInput:RadComboBox">
        <Grid x:Name="VisualRoot">
            <VisualStateManager.VisualStateGroups>
                <VisualStateGroup x:Name="CommonStates">
                    <VisualState x:Name="Disabled">
                        <Storyboard>
                            <DoubleAnimationUsingKeyFrames Storyboard.TargetName="VisualRoot"
                                                           Storyboard.TargetProperty="Opacity">
                                <DiscreteDoubleKeyFrame KeyTime="0:0:0"
                                                        Value=".5" />
                            </DoubleAnimationUsingKeyFrames>
                        </Storyboard>
                    </VisualState>
                    <VisualState x:Name="Normal">
                    </VisualState>
                    <VisualState x:Name="MouseOver">
                        <Storyboard>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="BackgroundBorder" Storyboard.TargetProperty="Background">
                                <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource HoverBackground}" />
                            </ObjectAnimationUsingKeyFrames>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Background" Storyboard.TargetProperty="Background">
                                <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource HoverBackground}" />
                            </ObjectAnimationUsingKeyFrames>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="DropDownIcon" Storyboard.TargetProperty="Foreground">
                                <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource ButtonIconForeground_MouseOver}" />
                            </ObjectAnimationUsingKeyFrames>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="DropDownIcon" Storyboard.TargetProperty="Background">
                                <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource ButtonIconBackground_MouseOver}" />
                            </ObjectAnimationUsingKeyFrames>
                        </Storyboard>
                    </VisualState>
                    <VisualState x:Name="DropDownOpen">
                        <Storyboard>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Background" Storyboard.TargetProperty="Background">
                                <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource DropDownOpenBackground}" />
                            </ObjectAnimationUsingKeyFrames>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="BackgroundBorder" Storyboard.TargetProperty="Background">
                                <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource DropDownOpenBackground}" />
                            </ObjectAnimationUsingKeyFrames>
                            <!--<ObjectAnimationUsingKeyFrames Storyboard.TargetName="Border" Storyboard.TargetProperty="BorderBrush">
                                <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{StaticResource ControlOuterBorder_Normal}" />
                            </ObjectAnimationUsingKeyFrames>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="BackgroundBorder"
                                    Storyboard.TargetProperty="BorderBrush">
                                <DiscreteObjectKeyFrame KeyTime="0:0:0"
                                        Value="{StaticResource ControlOuterBorder_Normal}" />
                            </ObjectAnimationUsingKeyFrames>-->
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="DropDownIcon" Storyboard.TargetProperty="Foreground">
                                <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource ButtonIconForeground_Pressed}" />
                            </ObjectAnimationUsingKeyFrames>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="DropDownIcon" Storyboard.TargetProperty="Background">
                                <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource ButtonIconBackground_Pressed}" />
                            </ObjectAnimationUsingKeyFrames>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="FocusBorder" Storyboard.TargetProperty="Visibility">
                                <DiscreteObjectKeyFrame KeyTime="0">
                                    <DiscreteObjectKeyFrame.Value>
                                        <Visibility>Collapsed</Visibility>
                                    </DiscreteObjectKeyFrame.Value>
                                </DiscreteObjectKeyFrame>
                            </ObjectAnimationUsingKeyFrames>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PopupFakeBorder"
                                    Storyboard.TargetProperty="Visibility">
                                <DiscreteObjectKeyFrame KeyTime="0">
                                    <DiscreteObjectKeyFrame.Value>
                                        <Visibility>Visible</Visibility>
                                    </DiscreteObjectKeyFrame.Value>
                                </DiscreteObjectKeyFrame>
                            </ObjectAnimationUsingKeyFrames>
                        </Storyboard>
                    </VisualState>
                </VisualStateGroup>
                <VisualStateGroup x:Name="FocusStates">
                    <VisualState x:Name="Focused">
                        <Storyboard>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="FocusBorder" Storyboard.TargetProperty="Visibility">
                                <DiscreteObjectKeyFrame KeyTime="0">
                                    <DiscreteObjectKeyFrame.Value>
                                        <Visibility>Visible</Visibility>
                                    </DiscreteObjectKeyFrame.Value>
                                </DiscreteObjectKeyFrame>
                            </ObjectAnimationUsingKeyFrames>
                        </Storyboard>
                    </VisualState>
                    <VisualState x:Name="Unfocused" />
                </VisualStateGroup>
                <VisualStateGroup x:Name="WatermarkStates">
                    <VisualState x:Name="WatermarkVisible">
                        <Storyboard>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Watermark" Storyboard.TargetProperty="Visibility">
                                <DiscreteObjectKeyFrame KeyTime="0:0:0">
                                    <DiscreteObjectKeyFrame.Value>
                                        <Visibility>Visible</Visibility>
                                    </DiscreteObjectKeyFrame.Value>
                                </DiscreteObjectKeyFrame>
                            </ObjectAnimationUsingKeyFrames>
                        </Storyboard>
                    </VisualState>
                    <VisualState x:Name="WatermarkInvisible" />
                </VisualStateGroup>
            </VisualStateManager.VisualStateGroups>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="36" />
            </Grid.ColumnDefinitions>
            <Border x:Name="PopupFakeBorder" Visibility="Collapsed" BorderThickness="1,0,1,0" CornerRadius="5,5,0,0"
                    Grid.ColumnSpan="2" Background="{StaticResource PickerPopupBackground_fake}"
                    BorderBrush="{TemplateBinding BorderBrush}" />
            <Border x:Name="Background" Grid.Column="0" IsHitTestVisible="False" Background="{StaticResource DefaultBackground}" CornerRadius="{StaticResource SplitButton_LeftPartCornerRadius}" />
            <Border Grid.ColumnSpan="2" IsHitTestVisible="False" Background="{TemplateBinding Background}" CornerRadius="{StaticResource SplitButton_SpanCornerRadius}" />
            <Border x:Name="Border" Grid.ColumnSpan="2" IsHitTestVisible="False" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="{StaticResource SplitButton_SpanCornerRadius}" />
            <TextBox x:Name="PART_EditableTextBox" Grid.Column="0" BorderThickness="1,1,0,1" Padding="{TemplateBinding Padding}" Background="{TemplateBinding Background}" Foreground="{TemplateBinding Foreground}" VerticalAlignment="Stretch" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" IsReadOnly="{TemplateBinding IsReadOnly}" SelectionBrush="DarkGray">
                <TextBox.Template>
                    <ControlTemplate TargetType="TextBox">
                        <Grid>
                            <ScrollViewer x:Name="PART_ContentHost" Foreground="White" TextBlock.Foreground="White" Padding="{TemplateBinding Padding}" BorderBrush="Transparent" Background="Transparent" BorderThickness="0" IsTabStop="False" VerticalScrollBarVisibility="Auto" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" />
                        </Grid>
                    </ControlTemplate>
                </TextBox.Template>
            </TextBox>
            <Border x:Name="FocusVisual" Visibility="Collapsed" Grid.ColumnSpan="2" IsHitTestVisible="False" BorderBrush="{StaticResource ControlOuterBorder_Focused}" CornerRadius="{StaticResource SplitButton_SpanCornerRadius}" BorderThickness="{TemplateBinding BorderThickness}">
                <Border BorderBrush="{StaticResource ControlInnerBorder_Focused}" CornerRadius="{StaticResource SplitButton_SpanInnerCornerRadius}" BorderThickness="{TemplateBinding BorderThickness}" />
            </Border>
            <telerik:RadToggleButton x:Name="PART_DropDownButton" Margin="0" Padding="0" Grid.Column="1" IsTabStop="False" ClickMode="Press">
                <telerik:RadToggleButton.Template>
                    <ControlTemplate TargetType="telerik:RadToggleButton">
                        <ContentPresenter />
                    </ControlTemplate>
                </telerik:RadToggleButton.Template>
                <Grid>
                    <Border x:Name="BackgroundBorder" CornerRadius="{StaticResource SplitButton_RightPartCornerRadius}" Grid.ColumnSpan="2" BorderBrush="{StaticResource Control_OuterBorderBrush}" BorderThickness="0,1,1,1" Background="{StaticResource DefaultBackground}" />
                    <Border BorderBrush="#FFCDCFD0" BorderThickness="2,0,0,0" Margin="0,1" />
                    <Border BorderBrush="#FFC3C7CF" BorderThickness="1,0,0,0" Margin="0,1" />
                    <ContentControl x:Name="DropDownIcon" Grid.Column="1" IsTabStop="False" Foreground="{StaticResource ButtonIconForeground_Normal}" Background="{StaticResource ButtonIconBackground_Normal}" Template="{StaticResource ArrowTemplateEditableCombobox}" />
                </Grid>
            </telerik:RadToggleButton>
            <TextBlock x:Name="Watermark" Text="{TemplateBinding EmptyText}" Opacity=".5" IsHitTestVisible="False" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="5,0,0,0" Visibility="Collapsed" />
            <Border x:Name="FocusBorder"
                    BorderThickness="1"
                    Margin="1"
                    Visibility="Collapsed"
                    BorderBrush="{StaticResource Control_FocusBorderBrush}" Grid.ColumnSpan="2" CornerRadius="3" />
            <Border x:Name="DisabledBorder" BorderThickness="0" Grid.ColumnSpan="2" Visibility="Collapsed" Background="#AAC0C0C0" CornerRadius="{StaticResource SplitButton_SpanCornerRadius}"  />
            <Popup x:Name="PART_Popup">
                <Grid x:Name="PopupRoot">
                    <Border BorderThickness="{TemplateBinding BorderThickness}" Margin="0,-10,0,0" Padding="0,10,0,0" BorderBrush="{TemplateBinding BorderBrush}" MinWidth="{TemplateBinding MinDropDownWidth}" MaxHeight="{TemplateBinding MaxDropDownHeight}" Background="{StaticResource PickerPopupBackground}" CornerRadius="0 0 5 5">
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="*" />
                            </Grid.RowDefinitions>
                            <telerik:RadButton x:Name="PART_ClearButton" Grid.Row="0" Margin="-1 -1 -1 0" Visibility="{TemplateBinding ClearSelectionButtonVisibility}" Content="{TemplateBinding ClearSelectionButtonContent}" />
                            <ScrollViewer x:Name="PART_ScrollViewer" Grid.Row="1" Foreground="{TemplateBinding Foreground}" Padding="0 1 0 0" BorderThickness="0" VerticalScrollBarVisibility="Auto" CanContentScroll="True">
                                <ItemsPresenter />
                            </ScrollViewer>
                        </Grid>
                    </Border>
                </Grid>
            </Popup>
        </Grid>
    </ControlTemplate>
    <ControlTemplate x:Key="NonEditableComboBox" TargetType="telerikInput:RadComboBox">
        <Grid x:Name="VisualRoot">
            <VisualStateManager.VisualStateGroups>
                <VisualStateGroup x:Name="CommonStates">
                    <VisualState x:Name="Disabled">
                        <Storyboard>
                            <DoubleAnimationUsingKeyFrames Storyboard.TargetName="PART_DropDownButton" Storyboard.TargetProperty="Opacity">
                                <DiscreteDoubleKeyFrame KeyTime="0:0:0" Value=".5" />
                            </DoubleAnimationUsingKeyFrames>
                        </Storyboard>
                    </VisualState>
                    <VisualState x:Name="Normal">
                    </VisualState>
                    <VisualState x:Name="MouseOver">
                        <Storyboard>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="BackgroundBorder" Storyboard.TargetProperty="Background">
                                <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource HoverBackground}" />
                            </ObjectAnimationUsingKeyFrames>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="DropDownIcon" Storyboard.TargetProperty="Foreground">
                                <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource ButtonIconForeground_MouseOver}" />
                            </ObjectAnimationUsingKeyFrames>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="DropDownIcon" Storyboard.TargetProperty="Background">
                                <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource ButtonIconBackground_MouseOver}" />
                            </ObjectAnimationUsingKeyFrames>
                        </Storyboard>
                    </VisualState>
                    <VisualState x:Name="DropDownOpen">
                        <Storyboard>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="BackgroundBorder" Storyboard.TargetProperty="Background">
                                <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource DropDownOpenBackground}" />
                            </ObjectAnimationUsingKeyFrames>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="DropDownIcon" Storyboard.TargetProperty="Foreground">
                                <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource ButtonIconForeground_Pressed}" />
                            </ObjectAnimationUsingKeyFrames>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="DropDownIcon" Storyboard.TargetProperty="Background">
                                <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource ButtonIconBackground_Pressed}" />
                            </ObjectAnimationUsingKeyFrames>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="FocusBorder" Storyboard.TargetProperty="Visibility">
                                <DiscreteObjectKeyFrame KeyTime="0">
                                    <DiscreteObjectKeyFrame.Value>
                                        <Visibility>Collapsed</Visibility>
                                    </DiscreteObjectKeyFrame.Value>
                                </DiscreteObjectKeyFrame>
                            </ObjectAnimationUsingKeyFrames>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PopupFakeBorder"
                                    Storyboard.TargetProperty="Visibility">
                                <DiscreteObjectKeyFrame KeyTime="0">
                                    <DiscreteObjectKeyFrame.Value>
                                        <Visibility>Visible</Visibility>
                                    </DiscreteObjectKeyFrame.Value>
                                </DiscreteObjectKeyFrame>
                            </ObjectAnimationUsingKeyFrames>
                        </Storyboard>
                    </VisualState>
                </VisualStateGroup>
                <VisualStateGroup x:Name="FocusStates">
                    <VisualState x:Name="Focused">
                        <Storyboard>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="FocusBorder" Storyboard.TargetProperty="Visibility">
                                <DiscreteObjectKeyFrame KeyTime="0">
                                    <DiscreteObjectKeyFrame.Value>
                                        <Visibility>Visible</Visibility>
                                    </DiscreteObjectKeyFrame.Value>
                                </DiscreteObjectKeyFrame>
                            </ObjectAnimationUsingKeyFrames>
                        </Storyboard>
                    </VisualState>
                    <VisualState x:Name="Unfocused" />
                </VisualStateGroup>
            </VisualStateManager.VisualStateGroups>
            <Border x:Name="PopupFakeBorder" Visibility="Collapsed" BorderThickness="1,0,1,0" CornerRadius="5,5,0,0"
                    Grid.ColumnSpan="2" Background="{StaticResource PickerPopupBackground_fake}"
                    BorderBrush="{TemplateBinding BorderBrush}" />
            <Border IsHitTestVisible="False" Background="{TemplateBinding Background}" CornerRadius="5" />
            <telerik:RadToggleButton x:Name="PART_DropDownButton" Foreground="{TemplateBinding Foreground}" IsTabStop="False" Margin="0" Padding="0" ClickMode="Press">
                <telerik:RadToggleButton.Template>
                    <ControlTemplate TargetType="telerik:RadToggleButton">
                        <ContentPresenter />
                    </ControlTemplate>
                </telerik:RadToggleButton.Template>
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*" />
                        <ColumnDefinition Width="36" />
                    </Grid.ColumnDefinitions>
                    <Border x:Name="BackgroundBorder"
                            CornerRadius="{StaticResource SplitButton_SpanCornerRadius}"
                            Grid.ColumnSpan="2"
                            BorderBrush="{StaticResource Control_OuterBorderBrush}" BorderThickness="1" Background="{StaticResource DefaultBackground}" />
                    <ContentControl x:Name="DropDownIcon"
                                    Grid.Column="1"
                                    IsTabStop="False"
                                    Foreground="{StaticResource ButtonIconForeground_Normal}"
                                    Background="{StaticResource ButtonIconBackground_Normal}"
                                    Template="{StaticResource ArrowTemplateNonEditableCombobox}" />
                    <TextBlock x:Name="Content"
                               FontFamily="Segoe UI"
                               IsHitTestVisible="True"
                               Grid.Column="0"
                               Foreground="{TemplateBinding Foreground}"
                               HorizontalAlignment="Left"
                               Margin="{TemplateBinding Padding}"
                               VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                               Text="{TemplateBinding SelectionBoxItem}"
                               TextTrimming="CharacterEllipsis"
                               ToolTip="{TemplateBinding  SelectionBoxItem}">
                <i:Interaction.Behaviors>
                  <bhv:TooltipTextBlockBehavior Enabled="True" />
                </i:Interaction.Behaviors >
                    </TextBlock>
                    <!--<ContentPresenter x:Name="Content"
                                      Grid.Column="0"
                                      Margin="{TemplateBinding Padding}"
                                      IsHitTestVisible="False"
                                      Content="{TemplateBinding SelectionBoxItem}"
                                      ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}"
                                      TextBlock.Foreground="Black"
                                      HorizontalAlignment="Left"
                                      VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />-->
                    <Border x:Name="FocusBorder"
                            BorderThickness="1"
                            Margin="1"
                            Visibility="Collapsed"
                            BorderBrush="{StaticResource Control_FocusBorderBrush}" Grid.ColumnSpan="2" CornerRadius="3" />
                </Grid>
            </telerik:RadToggleButton>
            <Popup x:Name="PART_Popup">
                <Grid x:Name="PopupRoot">
                    <Border BorderThickness="{TemplateBinding BorderThickness}" Margin="0,-10,0,0" Padding="0,10,0,0" BorderBrush="{TemplateBinding BorderBrush}" MinWidth="{TemplateBinding MinDropDownWidth}" MaxHeight="{TemplateBinding MaxDropDownHeight}" Background="{StaticResource PickerPopupBackground}" CornerRadius="0 0 5 5">
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="*" />
                            </Grid.RowDefinitions>
                            <telerik:RadButton x:Name="PART_ClearButton" Grid.Row="0" Margin="-1 -1 -1 0" Visibility="{TemplateBinding ClearSelectionButtonVisibility}" Content="{TemplateBinding ClearSelectionButtonContent}" />
                            <ScrollViewer x:Name="PART_ScrollViewer" Grid.Row="1" Foreground="{TemplateBinding Foreground}" Padding="0 1 0 0" BorderThickness="0" VerticalScrollBarVisibility="Auto" CanContentScroll="True">
                                <ItemsPresenter />
                            </ScrollViewer>
                        </Grid>
                    </Border>
                </Grid>
            </Popup>
        </Grid>
    </ControlTemplate>
    <Style x:Key="RadComboBoxItemStyle" TargetType="telerikInput:RadComboBoxItem">
        <Setter Property="MinHeight" Value="19" />
        <Setter Property="Margin" Value="0,-1,0,0" />
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="BorderBrush" Value="Transparent" />
        <Setter Property="Background" Value="Transparent" />
        <Setter Property="Padding" Value="10,2" />
        <Setter Property="HorizontalContentAlignment" Value="Stretch" />
        <Setter Property="VerticalContentAlignment" Value="Center" />
        <Setter Property="FocusVisualStyle" Value="{x:Null}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="telerikInput:RadComboBoxItem">
                    <Border BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}" Background="{TemplateBinding Background}">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal" />
                                <VisualState x:Name="MouseOver">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="HighlightVisual" Storyboard.TargetProperty="Visibility">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetName="Content" Storyboard.TargetProperty="Opacity">
                                            <DiscreteDoubleKeyFrame KeyTime="0:0:0" Value="0.33" />
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Grid>
                            <Border x:Name="HighlightVisual" Visibility="Collapsed" CornerRadius="0" BorderThickness="2" BorderBrush="{StaticResource ControlOuterBorder_Highlighted}" Background="{StaticResource ControlBackground_Highlighted}">
                                <!--<Border BorderThickness="1" CornerRadius="0" BorderBrush="{StaticResource ControlInnerBorder_Highlighted}" />-->
                            </Border>
                            <!--<TextBlock x:Name="Content"
                                       FontFamily="Segoe UI"
                                      
                                       Foreground="{TemplateBinding Foreground}"
                                       HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                       Margin="{TemplateBinding Padding}"
                                       VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                       Text="{TemplateBinding Content}"
                                       TextTrimming="CharacterEllipsis"
                                       ToolTip="{TemplateBinding Content}">
                <i:Interaction.Behaviors>
                  <bhv:TooltipTextBlockBehavior Enabled="True" />
                </i:Interaction.Behaviors >
                            </TextBlock>-->
                            <ContentPresenter x:Name="Content"
                                              Margin="{TemplateBinding Padding}"
                                              HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                              VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                              TextBlock.Foreground="Black" />
                        </Grid>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style TargetType="telerikInput:RadComboBoxItem" BasedOn="{StaticResource RadComboBoxItemStyle}" />
    <Style x:Key="RadComboBoxStyle" TargetType="telerikInput:RadComboBox">
        <Setter Property="Template" Value="{StaticResource NonEditableComboBox}" />
        <Setter Property="EditableTemplate" Value="{StaticResource EditableComboBox}" />
        <Setter Property="NonEditableTemplate" Value="{StaticResource NonEditableComboBox}" />
        <Setter Property="HorizontalContentAlignment" Value="Stretch" />
        <Setter Property="VerticalContentAlignment" Value="Center" />
        <Setter Property="MinHeight" Value="28" />
        <Setter Property="Padding" Value="10,0" />
        <Setter Property="Foreground" Value="{StaticResource PickerForeground_Normal}" />
        <Setter Property="Background" Value="Transparent" />
        <Setter Property="BorderBrush"
                Value="{StaticResource Control_OuterBorderBrush}" />
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="SnapsToDevicePixels" Value="True" />
        <Setter Property="FocusVisualStyle" Value="{x:Null}" />
         
    </Style>
    <Style TargetType="telerikInput:RadComboBox" BasedOn="{StaticResource RadComboBoxStyle}" />
</ResourceDictionary>


Behavior for charecter ellipses.:
Imports System.Windows
Imports System.Windows.Controls
Imports System.Windows.Interactivity
Imports System.Windows.Media
 
Namespace Behaviors
 
    Public Class TooltipTextBlockBehavior
        Inherits Behavior(Of TextBlock)
 
        Public Shared ReadOnly EnabledProperty As DependencyProperty = DependencyProperty.RegisterAttached("Enabled", GetType(Boolean), GetType(TooltipTextBlockBehavior), New UIPropertyMetadata(False))
        Public Shared ReadOnly ParentClassNameProperty As DependencyProperty = DependencyProperty.RegisterAttached("ParentClassName", GetType(String), GetType(TooltipTextBlockBehavior), New UIPropertyMetadata(""))
 
        Public Property ParentClassName() As String
            Get
                Return CStr(GetValue(ParentClassNameProperty))
            End Get
            Set(value As String)
                SetValue(ParentClassNameProperty, value)
            End Set
        End Property
 
        Public Property Enabled() As Boolean
            Get
                Return CBool(GetValue(EnabledProperty))
            End Get
            Set(value As Boolean)
                SetValue(EnabledProperty, value)
            End Set
        End Property
 
        Protected Overrides Sub OnAttached()
            MyBase.OnAttached()
 
            Dim element As TextBlock = AssociatedObject
            If element Is Nothing Then
                Return
            End If
 
            If Me.Enabled Then
                AddHandler element.ToolTipOpening, AddressOf OnToolTipOpening
            End If
        End Sub
 
        Protected Overrides Sub OnDetaching()
            MyBase.OnDetaching()
 
            Dim element As TextBlock = TryCast(AssociatedObject, TextBlock)
            If element Is Nothing Then
                Return
            End If
 
            If Me.Enabled Then
                RemoveHandler element.ToolTipOpening, AddressOf OnToolTipOpening
            End If
        End Sub
 
        Public Shared Function GetParentDependencyObjectFromVisualTree(startObject As DependencyObject, typeName As String) As FrameworkElement
            'Walk the visual tree to get the parent of this control
            Dim parent As DependencyObject = startObject
            While parent IsNot Nothing
                If parent.GetType().Name.ToString.Contains(typeName) Then
                    Exit While
                Else
                    parent = VisualTreeHelper.GetParent(parent)
                End If
            End While
 
            Return CType(parent, FrameworkElement)
        End Function
 
        Private Sub OnToolTipOpening(sender As Object, e As ToolTipEventArgs)
            Dim tb = CType(sender, TextBlock)
            If ParentClassName = String.Empty Then
                If Not IsTextTrimmed(tb) Then
                    e.Handled = True
                End If
                Return
            End If
 
            Dim parentView = GetParentDependencyObjectFromVisualTree(tb, ParentClassName)
            Dim xoff As Double = GetXOffsetFromTextBlockToContainer(tb, parentView)
            If Not (parentView.ActualWidth < tb.ActualWidth + xoff) Then
                e.Handled = True
            End If
        End Sub
 
        Private Shared Function GetXOffsetFromTextBlockToContainer(ByVal tb As TextBlock, ByVal container As Visual) As Double
            Dim gb As MatrixTransform = CType(container.TransformToVisual(tb), MatrixTransform)
            Return -gb.Value.OffsetX
        End Function
 
        Private Shared Function IsTextTrimmed(ByVal textBlock As TextBlock) As Boolean
            Dim formattedText As FormattedText = New FormattedText(textBlock.Text, System.Threading.Thread.CurrentThread.CurrentCulture, textBlock.FlowDirection,
                                                                   New Typeface(textBlock.FontFamily, textBlock.FontStyle, textBlock.FontWeight, textBlock.FontStretch),
                                                                   textBlock.FontSize, textBlock.Foreground)
 
            Return formattedText.Width > textBlock.ActualWidth
        End Function
    End Class
End Namespace

0
Konstantina
Telerik team
answered on 15 Jul 2013, 11:22 AM
Hello Srinivas,

Please open a support ticket and attach the project there. It will be much faster in order to resolve the issue.

Regards,
Konstantina
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Tags
ComboBox
Asked by
Ravi
Top achievements
Rank 1
Answers by
Konstantina
Telerik team
Ravi
Top achievements
Rank 1
Share this question
or