Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# WPF Silverlight
Hi all.
 
I am trying to change wpf combo box style in order to add ellipsis to the combo in case of long selected item the combo show me ellipsis. so using expression bland 4 i did change the control template and i did found a content presenter in order to show the selected item. for applying ellipsis i did change the content presenter to Label and in the label template i did use texblock. but it did not work then i did bound the textblock to content presenter content.Description with is displaymemberpath of combo. the problem is i did write statically content.description maybe in other case the display member path be Name or Age or any things. do any one have an idea to meet this requiremet.this is the xaml code:
combo style:
<Style x:Key="ComboBoxStyle1" TargetType="{x:Type ComboBox}">
























<Canvas HorizontalAlignment="Left" Height="0" VerticalAlignment="Top" Width="0">

</Canvas>







 
<Label ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}" ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}"
Content="{TemplateBinding SelectionBoxItem}" ContentStringFormat="{TemplateBinding SelectionBoxItemStringFormat}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" IsHitTestVisible="false" Margin="{TemplateBinding Padding}"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
Style="{DynamicResource LabelEllipsis}"/>
























<Style.Triggers>







</Style.Triggers>
</Style>
 
<Style x:Key="LabelEllipsis" TargetType="{x:Type Label}">



 




</Style>
 
in LabelEllipsis style i did bind textbloxk text to Content.Description, Description is display member path, can any one tel me how to make it dynamic
Posted 28-Jan-13 0:25am

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 555
1 Kornfeld Eliyahu Peter 409
2 Maciej Los 369
3 DamithSL 196
4 OriginalGriff 188
0 OriginalGriff 6,353
1 DamithSL 4,854
2 Maciej Los 4,466
3 Kornfeld Eliyahu Peter 4,058
4 Sergey Alexandrovich Kryukov 3,897


Advertise | Privacy | Mobile
Web01 | 2.8.141220.1 | Last Updated 28 Jan 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100