Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

Binding ComboBox SelectedIndex to Method in wpf

$
0
0

hello guys

How can I binding a method from class to ComboBox SelectedIndex?

This is my method in a class:

    public static class myClass
    {
        private static int tempComboIndex = 0;
        public static int ComboIndex
        {
            get { return tempComboIndex ; }
            set { tempComboIndex = value; }
        }
    }

And I've tried this xaml code to binding:

<ComboBox SelectedIndex="{Binding Path=myClass.ThemeIndex,Mode=TwoWay}">

<ComboBoxItem Content="1"/>
<ComboBoxItem Content="2"/>

</ComboBox>

But its doesn't work for me.



:)


Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>