[Ironpython-users] Binding forground to method

אילן הינדי hindy.ilan at gmail.com
Sun Oct 2 06:02:17 EDT 2016


I am trying to bind the foreground of list box item to a method
My XAML is
<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:System="clr-namespace:System;assembly=mscorlib"

xmlns:Windows="clr-namespace:System.Windows;assembly=PresentationCore"
        Title="SelectWindow" Height="300"  SizeToContent="Width">
    <Window.Resources>
        <ObjectDataProvider x:Key="SetForeground"
        ObjectType="{x:Type Colors}" IsAsynchronous="True"
        MethodName="SetForground">
        </ObjectDataProvider>
        <!--       <local:SetForegroundColor x:Key="SetForegroundColor"/>
-->
        <Style TargetType="ListBoxItem">
            <Setter Property="Foreground" Value="Blue"/>
            <Style.Triggers>
                <Trigger Property="IsSelected" Value="true">
                    <Setter Property="Foreground" Value="{Binding
Source={StaticResource SetForeground}}"/>
                </Trigger>
            </Style.Triggers>
        </Style>
    </Window.Resources>

And in the class I have a method  named SetForeground that returns a Brush
I get an exception (but it does not say what king of exception)
Can you tell me what wrong

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/20161002/ad4cf060/attachment.html>


More information about the Ironpython-users mailing list