Page 1 of 1

[SOLVED] comboboxitem problem

Posted: Wed Oct 19, 2016 3:00 am
by 08tjlys
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

Re: comboxitem problem

Posted: Wed Oct 19, 2016 5:55 pm
by 08tjlys
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?

Re: comboboxitem problem

Posted: Thu Oct 20, 2016 2:09 am
by JS-Support @Userware
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

Re: comboboxitem problem

Posted: Thu Oct 20, 2016 6:44 pm
by 08tjlys
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 9468 times

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


ProblemScreenShot2.png
ProblemScreenShot2.png (4.98 KiB) Viewed 9468 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 !

Re: comboboxitem problem

Posted: Thu Oct 20, 2016 7:35 pm
by 08tjlys
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 9465 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 9465 times


again thank you

Re: comboboxitem problem

Posted: Tue Oct 25, 2016 12:27 am
by JS-Support @Userware
Thanks. I'll keep you updated.

Re: comboboxitem problem

Posted: Sat Mar 04, 2017 7:38 pm
by JS-Support @Userware
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