Print Page | Close Window

Another ComboBox Markup Issue

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Controls
Forum Description: Topics Related to Codejock Controls
URL: http://forum.codejock.com/forum_posts.asp?TID=13331
Printed Date: 22 November 2024 at 3:36pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Another ComboBox Markup Issue
Posted By: ScottW
Subject: Another ComboBox Markup Issue
Date Posted: 04 February 2009 at 10:54am
I can send an actual sample project if necessary, but to replicate this, just create a form with an ImageManager control and a ComboBox with DropdownList style. Add a single Icon to the ImageManager with ID 101. It should be a 16x16 icon. Then paste in this code and run. In the dropdown, it all looks great, but the selected item has the text clipped at the bottom. I tried using VerticalAlignment tag to bring the text up, but it doesn't seem to do anything. How can I fix this?

Private Sub Form_Load()

    SuiteControlsGlobalSettings.Icons.AddIcons ImageManager1.Icons

    With ComboBox1
        .EnableMarkup = True
   
        .AddItem "<TextBlock><Image Width='16' Height='16' Source='101' />Item 1</TextBlock>"
        .AddItem "<TextBlock><Image Width='16' Height='16' Source='101' />Item 2</TextBlock>"
        .AddItem "<TextBlock><Image Width='16' Height='16' Source='101' />Item 3</TextBlock>"
       
        .ListIndex = 0
    End With

End Sub




Replies:
Posted By: Oleg
Date Posted: 04 February 2009 at 1:51pm
Hi,
try to move Image from TextBlock:
 
 .AddItem "<StackPanel Orientation="Hirizontal"><Image Width='16' Height='16' Source='101'/><TextBlock>Item 1</TextBlock></StackPanel>"


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: jpbro
Date Posted: 04 February 2009 at 2:07pm
I think that this happens because the ComboBox height is locked to the font height, regardless of the markup size (try changing the height of the combobox and you'll see that it always snaps back to a certain size). You can workaround this by setting the font size of the ComboBox to something larger than you are using for your markup text, and then explicitly declare you TextBox font size as the smaller font size that you actually want...

For example:


    SuiteControlsGlobalSettings.Icons.AddIcons ImageManager1.Icons



    With ComboBox1
        .EnableMarkup = True
        .Font.Size = 12
  
        .AddItem "<TextBlock FontSize='8pt' VerticalAlignment='Center'><Image Width='16' Height='16' Source='101' /><Run BaselineAlignment='Center'>Item 1</Run></TextBlock>"
        .AddItem "<TextBlock FontSize='8pt' VerticalAlignment='Center'><Image Width='16' Height='16' Source='101' /><Run BaselineAlignment='Center'>Item 2</Run></TextBlock>"
        .AddItem "<TextBlock FontSize='8pt' VerticalAlignment='Center'><Image Width='16' Height='16' Source='101' /><Run BaselineAlignment='Center'>Item 3</Run></TextBlock>"
      
        .ListIndex = 0
    End With


Note that I've also added the Run tag with a center Baseline alignment to keep the text aligned nicely with the image.


-------------
Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows XP - SP3

Language: Visual Basic 6.0 SP6



Posted By: jpbro
Date Posted: 04 February 2009 at 2:09pm
Or Oleg's method seems to work ;)

Just change "Hirizontal" to "Horizontal"


-------------
Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows XP - SP3

Language: Visual Basic 6.0 SP6



Posted By: Oleg
Date Posted: 05 February 2009 at 6:08am

:)



-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net