[SOLVED] comboboxitem problem

Please post public support tickets here. Note: for private support tickets, please send an email to support@cshtml5.com instead.
08tjlys
Posts: 4
Joined: Wed Oct 19, 2016 2:25 am

[SOLVED] comboboxitem problem

Postby 08tjlys » Wed Oct 19, 2016 3:00 am

dear JS-Support
I am using beta 10.0 now,and i met such problem for comboboxitem,i am not sure if it is a bug or i do sth wrongly
it is quite simple,i wanna a textblock as comboxitem for my combobox

Code: Select all

                <StackPanel Orientation="Horizontal">
                <ComboBox BorderThickness="0" SelectedIndex="0">
                    <ComboBoxItem>

                        <TextBlock Text="100-200" Foreground="#D93F59"></TextBlock>
                    </ComboBoxItem>
                   
                </ComboBox>
                <TextBlock Foreground="#999999" Text="筛选"></TextBlock>
            </StackPanel>
           



well,the problem is that i see everything works fine in simulator for previewing ,but when i run it on simulator or in browser, i saw nothing displayed in my combobox and my comboboxitem is not Textblock "100-200” but "Windows.UI.Controls.ComboxItem" which was really confusing to me
thanks for help in advance and it is really a great tool anyway
Last edited by 08tjlys on Wed Oct 19, 2016 10:22 pm, edited 1 time in total.

08tjlys
Posts: 4
Joined: Wed Oct 19, 2016 2:25 am

Re: comboxitem problem

Postby 08tjlys » Wed Oct 19, 2016 5:55 pm

hi again,
i found even i just set just simple string as my comboboxitem for example

Code: Select all

        <StackPanel Orientation="Horizontal">
                <ComboBox BorderThickness="0" SelectedIndex="0">
                    <ComboBoxItem>

                        hello
                    </ComboBoxItem>
                   
                </ComboBox>
                <TextBlock Foreground="#999999" Text="筛选"></TextBlock>
            </StackPanel>
 

the problem is the same,i could see it worked well in simulator for previewing, but when i run it in simulator or in browser, it still showed "windows.UI.Xaml.Controls.ComboBoxitem", did i do sth wrong here?

JS-Support @Userware
Site Admin
Posts: 1142
Joined: Tue Apr 08, 2014 3:42 pm

Re: comboboxitem problem

Postby JS-Support @Userware » Thu Oct 20, 2016 2:09 am

Hi and welcome to the forums.

Thanks for the report.

We are going to investigate.

In the meantime, please add the items programmatically (ComboBox1.Items.Add(myItem) or ComboBox1.ItemsSource = myCollection).

I'll keep you updated.
Thanks.
Regards,
JS-Support

08tjlys
Posts: 4
Joined: Wed Oct 19, 2016 2:25 am

Re: comboboxitem problem

Postby 08tjlys » Thu Oct 20, 2016 6:44 pm

hi,again, and really thanks for replaying and ur attenetion. and i currently solved the problem by directly using code to add comboboxitem as u suggested.
sorry i am new to the forum, so last time i didn't put pics here to describe my problem,here is the screenshot which may help u understand more clearly.
ProblemScreenshot.png
ProblemScreenshot.png (7.68 KiB) Viewed 9476 times

for previewing, it worded correctly,i could see my comboboxitem.


ProblemScreenShot2.png
ProblemScreenShot2.png (4.98 KiB) Viewed 9476 times

but i run it in simulator or in browser,i saw this.

and i am using Beta 10.0 under VS 2015

again thanks for team effort for bringing such great tool !

08tjlys
Posts: 4
Joined: Wed Oct 19, 2016 2:25 am

Re: comboboxitem problem

Postby 08tjlys » Thu Oct 20, 2016 7:35 pm

btw,i just found sth new which looks like new problem for comboboxitem, sorry for so many posts :D
when i used code to directly add simple string as my comboboxitem,it worked correctly, but i wanna a textblock as my comboboxitem

Code: Select all

           TextBlock tb = new TextBlock();
            tb.Text = "100-200";
            tb.TextDecorations = Windows.UI.Text.TextDecorations.Underline;
            tb.Foreground=new Windows.UI.Xaml.Media.SolidColorBrush(Windows.UI.Color.FromArgb(255,208,2,27));
            MyCombobox.Items.Add(tb);
   

when i run it, again what i saw was "Windows.UI.Xaml.Controls.TextBlock"
problem3.png
problem3.png (4.89 KiB) Viewed 9473 times


while the same code run correctly in a WPF application(of course with sightly changes due to different namespaces)

Code: Select all

            TextBlock tb = new TextBlock();
            tb.Text = "100-200";
            tb.TextDecorations = TextDecorations.Underline;
            tb.Foreground = new SolidColorBrush(Color.FromArgb(255, 208, 2, 27));
            MyCombobox.Items.Add(tb);
 

this time,when i run it,it showed correctly
correctresult.png
correctresult.png (2.87 KiB) Viewed 9473 times


again thank you

JS-Support @Userware
Site Admin
Posts: 1142
Joined: Tue Apr 08, 2014 3:42 pm

Re: comboboxitem problem

Postby JS-Support @Userware » Tue Oct 25, 2016 12:27 am

Thanks. I'll keep you updated.

JS-Support @Userware
Site Admin
Posts: 1142
Joined: Tue Apr 08, 2014 3:42 pm

Re: comboboxitem problem

Postby JS-Support @Userware » Sat Mar 04, 2017 7:38 pm

Hi,

A recent version of the product has added support for non-native-html combo boxes, which allow to display items other than strings.

Here is how to use them:

Code: Select all

<ComboBox UseNativeComboBox="False" />


Furthermore, the version Beta 10.11 has fixed the issue with the ComboBoxItem's string content not being displayed.

You can download the latest version from:
http://forums.cshtml5.com/viewforum.php?f=6

Thanks.
Regards,
JS-Support


Return to “Technical Support”

Who is online

Users browsing this forum: No registered users and 42 guests

 

 

cron