[Ironpython-users] Binding property to method in IronPython

אילן הינדי hindy.ilan at gmail.com
Mon Oct 3 05:38:59 EDT 2016

I am working in IronPython
I am trying to bind the foreground of list box item to a method
In order to see what is the right way I created a simple c# application
In which the XAML looks like this
    <Window x:Class="WpfTest.MainWindow"
            Title="MainWindow" Height="350" Width="525"
            <local:SetForeground x:Key="SetForeground"  />
            <Style TargetType="ListBoxItem">
                <Setter Property="Foreground" Value="Blue"/>
                    <Trigger Property="IsSelected" Value="true">
                        <Setter Property="Foreground" Value="{Binding
Converter={StaticResource SetForeground}}"/>
            <ListBox x:Name="ListBox_Options"  Margin="15,15,15,0" >
                <ListBoxItem Content="Element 2"/>
                <ListBoxItem Content="Element 3"/>
                <ListBoxItem Content="Element 4"/>
                <ListBoxItem Content="Element 5"/>
                <ListBoxItem Content="Element 6"/>
I also created a class named SetForeground which looks like this
    public sealed class SetForeground : IValueConverter
        public object Convert(object value, Type targetType, object
parameter, CultureInfo culture)
            return Brushes.Brown;
            throw new NotImplementedException();

        public object ConvertBack(object value, Type targetType, object
parameter, CultureInfo culture)
            throw new NotImplementedException();
I activated the project and it worked
Now I wanted to do the same solution in IronPython but I encountered with
problem of what namespace to write in the following XAML statement (In the
window header)
can you help ?
are there any other adjustments that have to be made in transforming the
solution to IronPython?

Ilan Hindy
e-mail : Hindy.Ilan at gmail.com
celular : +972-54-4292112
home : +972-9-9570521
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20161003/de065843/attachment.html>

More information about the Ironpython-users mailing list