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" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation " xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc=" http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" Title="MainWindow" Height="350" Width="525" xmlns:local="clr-namespace:WpfTest"> <Window.Resources> <local:SetForeground x:Key="SetForeground" /> <Style TargetType="ListBoxItem"> <Setter Property="Foreground" Value="Blue"/> <Style.Triggers> <Trigger Property="IsSelected" Value="true"> <Setter Property="Foreground" Value="{Binding Converter={StaticResource SetForeground}}"/> </Trigger> </Style.Triggers> </Style> </Window.Resources> <Grid> <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"/> </ListBox> </Grid> </Window> 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 the problem of what namespace to write in the following XAML statement (In the window header) xmlns:local="clr-namespace:WpfTest" can you help ? are there any other adjustments that have to be made in transforming the solution to IronPython? Ilan Hindy e-mail : hindy.i...@gmail.com celular : +972-54-4292112 home : +972-9-9570521
_______________________________________________ Ironpython-users mailing list Ironpython-users@python.org https://mail.python.org/mailman/listinfo/ironpython-users