none
Item in ComboBox is showing double height RRS feed

  • Question

  • Hello,

    Can someone please tell me why my item in the picture below is showing double the height it needs?

    n

    Also, here is my XAML:

    <ComboBox Grid.Column="2" Grid.Row="3"  x:Name="cmbSavType" ItemsSource="{Binding}" 
                      SelectedValuePath="IDSavingType" DisplayMemberPath="SavingType" 
                      HorizontalAlignment="Left" VerticalAlignment="Center" Width="120" Height="22"/>

    I even tried stretching out the ComboBox to three times the size of the text but it still doubles the height for the selected item "Materials - Expense". It does not do it for any other items. I also check to see if the source data had blank spaces, it does not.

    Thank you,

    - Justair07


    • Edited by Justair07 Wednesday, August 7, 2019 12:45 PM
    Wednesday, August 7, 2019 12:44 PM

Answers

  • I would check the object in the ItemsSource that has the SavingType = "Materials - Expense".  I would think there is a CR at the end of the string that is causing the problem.

    Lloyd Sheen

    • Marked as answer by Justair07 Friday, August 9, 2019 10:30 AM
    Wednesday, August 7, 2019 2:22 PM

All replies

  • I would check the object in the ItemsSource that has the SavingType = "Materials - Expense".  I would think there is a CR at the end of the string that is causing the problem.

    Lloyd Sheen

    • Marked as answer by Justair07 Friday, August 9, 2019 10:30 AM
    Wednesday, August 7, 2019 2:22 PM
  • Hello, 

    In your command for selection data use - TRIM(SavingType) as SavingType - my expectation is that at end of the line with problem is x0A or/and x0D chars.


    Sincerely, Highly skilled coding monkey.

    Wednesday, August 7, 2019 2:34 PM
  • Hi   Justair07,

    I use the System.Environment.NewLine and can reproduce your issue.

    ItemDescription = "Materials - Expense" + System.Environment.NewLine + "  " 


    Thank you for your understanding.

    Best regards

    Yong Lu


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, August 8, 2019 2:20 AM
    Moderator
  • I reentered the text into the data source and it fixed it. Thank you everyone!
    Friday, August 9, 2019 10:31 AM