<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=us-ascii"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
        {font-family:Helvetica;
        panose-1:2 11 6 4 2 2 2 2 2 4;}
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#0563C1;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-US link="#0563C1" vlink="#954F72"><div class=WordSection1><p class=MsoNormal style='mso-margin-top-alt:auto;margin-bottom:12.0pt;line-height:16.8pt;background:white'><span style='font-size:10.5pt;font-family:"Helvetica",sans-serif;color:#333333'>Visual Studio Community 2013<br>IronPython<br>Windows 8.1<o:p></o:p></span></p><p class=MsoNormal style='margin-bottom:12.0pt;line-height:16.8pt;background:white'><span style='font-size:10.5pt;font-family:"Helvetica",sans-serif;color:#333333'>I have a button created using xaml. In python I'm trying to set the background using SetValue. SetValue requires the DependencyProperty and then the value I want to set. I've been searching the net and trying different values, but I can't find where/how to define the DependencyProptery.<o:p></o:p></span></p><p class=MsoNormal style='mso-margin-top-alt:12.0pt;margin-right:0in;margin-bottom:12.0pt;margin-left:0in'><span style='font-size:12.0pt;font-family:"Times New Roman",serif'><Style TargetType="Button" x:Key="ToolBarButtonStyleZ"><o:p></o:p></span></p><p class=MsoNormal style='mso-margin-top-alt:12.0pt;margin-right:0in;margin-bottom:12.0pt;margin-left:0in'><span style='font-size:12.0pt;font-family:"Times New Roman",serif'>                <Setter Property="Background" Value="Black"/><o:p></o:p></span></p><p class=MsoNormal style='mso-margin-top-alt:12.0pt;margin-right:0in;margin-bottom:12.0pt;margin-left:0in'><span style='font-size:12.0pt;font-family:"Times New Roman",serif'>                <Setter Property="Foreground" Value="White"  /><o:p></o:p></span></p><p class=MsoNormal style='mso-margin-top-alt:12.0pt;margin-right:0in;margin-bottom:12.0pt;margin-left:0in'><span style='font-size:12.0pt;font-family:"Times New Roman",serif'>                <Setter Property="HorizontalAlignment" Value="Center"/><o:p></o:p></span></p><p class=MsoNormal style='mso-margin-top-alt:12.0pt;margin-right:0in;margin-bottom:12.0pt;margin-left:0in'><span style='font-size:12.0pt;font-family:"Times New Roman",serif'>                <Setter Property="Height" Value="35"/><o:p></o:p></span></p><p class=MsoNormal style='mso-margin-top-alt:12.0pt;margin-right:0in;margin-bottom:12.0pt;margin-left:0in'><span style='font-size:12.0pt;font-family:"Times New Roman",serif'>                <Setter Property="TextBlock.FontSize" Value="20"/><o:p></o:p></span></p><p class=MsoNormal style='mso-margin-top-alt:12.0pt;margin-right:0in;margin-bottom:12.0pt;margin-left:0in'><span style='font-size:12.0pt;font-family:"Times New Roman",serif'>                <Setter Property="VerticalAlignment" Value="Center"/><o:p></o:p></span></p><p class=MsoNormal style='mso-margin-top-alt:12.0pt;margin-right:0in;margin-bottom:12.0pt;margin-left:0in'><span style='font-size:12.0pt;font-family:"Times New Roman",serif'>                <Setter Property="Width" Value="200"/><o:p></o:p></span></p><p class=MsoNormal style='mso-margin-top-alt:12.0pt;margin-right:0in;margin-bottom:12.0pt;margin-left:0in'><span style='font-size:12.0pt;font-family:"Times New Roman",serif'>                <Setter Property="Template"><o:p></o:p></span></p><p class=MsoNormal style='mso-margin-top-alt:12.0pt;margin-right:0in;margin-bottom:12.0pt;margin-left:0in'><span style='font-size:12.0pt;font-family:"Times New Roman",serif'>                    <Setter.Value><o:p></o:p></span></p><p class=MsoNormal style='mso-margin-top-alt:12.0pt;margin-right:0in;margin-bottom:12.0pt;margin-left:0in'><span style='font-size:12.0pt;font-family:"Times New Roman",serif'>                        <ControlTemplate TargetType="Button"><o:p></o:p></span></p><p class=MsoNormal style='mso-margin-top-alt:12.0pt;margin-right:0in;margin-bottom:12.0pt;margin-left:0in'><span style='font-size:12.0pt;font-family:"Times New Roman",serif'>                            <Border Background="{TemplateBinding Background}"><o:p></o:p></span></p><p class=MsoNormal style='mso-margin-top-alt:12.0pt;margin-right:0in;margin-bottom:12.0pt;margin-left:0in'><span style='font-size:12.0pt;font-family:"Times New Roman",serif'>                                <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/><o:p></o:p></span></p><p class=MsoNormal style='mso-margin-top-alt:12.0pt;margin-right:0in;margin-bottom:12.0pt;margin-left:0in'><span style='font-size:12.0pt;font-family:"Times New Roman",serif'>                            </Border><o:p></o:p></span></p><p class=MsoNormal style='mso-margin-top-alt:12.0pt;margin-right:0in;margin-bottom:12.0pt;margin-left:0in'><span style='font-size:12.0pt;font-family:"Times New Roman",serif'>                        </ControlTemplate><o:p></o:p></span></p><p class=MsoNormal style='mso-margin-top-alt:12.0pt;margin-right:0in;margin-bottom:12.0pt;margin-left:0in'><span style='font-size:12.0pt;font-family:"Times New Roman",serif'>                    </Setter.Value><o:p></o:p></span></p><p class=MsoNormal style='mso-margin-top-alt:12.0pt;margin-right:0in;margin-bottom:12.0pt;margin-left:0in'><span style='font-size:12.0pt;font-family:"Times New Roman",serif'>                </Setter><o:p></o:p></span></p><p class=MsoNormal style='mso-margin-top-alt:12.0pt;margin-right:0in;margin-bottom:12.0pt;margin-left:0in'><span style='font-size:12.0pt;font-family:"Times New Roman",serif'>                <Style.Triggers><o:p></o:p></span></p><p class=MsoNormal style='mso-margin-top-alt:12.0pt;margin-right:0in;margin-bottom:12.0pt;margin-left:0in'><span style='font-size:12.0pt;font-family:"Times New Roman",serif'>                    <Trigger Property="IsPressed" Value="True"><o:p></o:p></span></p><p class=MsoNormal style='mso-margin-top-alt:12.0pt;margin-right:0in;margin-bottom:12.0pt;margin-left:0in'><span style='font-size:12.0pt;font-family:"Times New Roman",serif'>                        <Setter Property="Background" Value="Gray" /><o:p></o:p></span></p><p class=MsoNormal style='mso-margin-top-alt:12.0pt;margin-right:0in;margin-bottom:12.0pt;margin-left:0in'><span style='font-size:12.0pt;font-family:"Times New Roman",serif'>                    </Trigger><o:p></o:p></span></p><p class=MsoNormal style='mso-margin-top-alt:12.0pt;margin-right:0in;margin-bottom:12.0pt;margin-left:0in'><span style='font-size:12.0pt;font-family:"Times New Roman",serif'>                    <Trigger Property="IsMouseOver" Value="True"><o:p></o:p></span></p><p class=MsoNormal style='mso-margin-top-alt:12.0pt;margin-right:0in;margin-bottom:12.0pt;margin-left:0in'><span style='font-size:12.0pt;font-family:"Times New Roman",serif'>                        <Setter Property="Background" Value="Gray"/><o:p></o:p></span></p><p class=MsoNormal style='mso-margin-top-alt:12.0pt;margin-right:0in;margin-bottom:12.0pt;margin-left:0in'><span style='font-size:12.0pt;font-family:"Times New Roman",serif'>                    </Trigger><o:p></o:p></span></p><p class=MsoNormal style='mso-margin-top-alt:12.0pt;margin-right:0in;margin-bottom:12.0pt;margin-left:0in'><span style='font-size:12.0pt;font-family:"Times New Roman",serif'>                </Style.Triggers><o:p></o:p></span></p><p class=MsoNormal style='mso-margin-top-alt:12.0pt;margin-right:0in;margin-bottom:12.0pt;margin-left:0in'><span style='font-size:12.0pt;font-family:"Times New Roman",serif'>            </Style><o:p></o:p></span></p><p class=MsoNormal style='mso-margin-top-alt:12.0pt;margin-right:0in;margin-bottom:12.0pt;margin-left:0in'><span style='font-size:12.0pt;font-family:"Times New Roman",serif'><o:p> </o:p></span></p><p class=MsoNormal style='mso-margin-top-alt:12.0pt;margin-right:0in;margin-bottom:12.0pt;margin-left:0in'><span style='font-size:12.0pt;font-family:"Times New Roman",serif'> <Button Name="ButtonToolbarSession"<o:p></o:p></span></p><p class=MsoNormal style='mso-margin-top-alt:12.0pt;margin-right:0in;margin-bottom:12.0pt;margin-left:0in'><span style='font-size:12.0pt;font-family:"Times New Roman",serif'>                    Click="ButtonToolbarSession_Click"<o:p></o:p></span></p><p class=MsoNormal style='mso-margin-top-alt:12.0pt;margin-right:0in;margin-bottom:12.0pt;margin-left:0in'><span style='font-size:12.0pt;font-family:"Times New Roman",serif'>                    Content="Session"<o:p></o:p></span></p><p class=MsoNormal style='mso-margin-top-alt:12.0pt;margin-right:0in;margin-bottom:12.0pt;margin-left:0in'><span style='font-size:12.0pt;font-family:"Times New Roman",serif'>                    Style="{DynamicResource ToolBarButtonStyleZ}"><o:p></o:p></span></p><p class=MsoNormal style='mso-margin-top-alt:12.0pt;margin-right:0in;margin-bottom:12.0pt;margin-left:0in'><span style='font-size:12.0pt;font-family:"Times New Roman",serif'>            </Button><o:p></o:p></span></p><div class=MsoNormal align=center style='mso-margin-top-alt:12.0pt;margin-right:0in;margin-bottom:12.0pt;margin-left:0in;text-align:center'><span style='font-size:12.0pt;font-family:"Times New Roman",serif'><hr size=4 width="100%" noshade style='color:#333333' align=center></span></div><p class=MsoNormal style='margin-bottom:12.0pt;line-height:16.8pt;background:white'><span style='font-size:10.5pt;font-family:"Helvetica",sans-serif;color:#333333'>Python:<br>import wpf<br>import clr<br>clr.AddReference('System.Drawing')<br>clr.AddReference("System.Windows")<br>clr.AddReference("WindowsBase")<br>clr.AddReference("PresentationCore")<br>clr.AddReference("PresentationFramework")<br>from System.Drawing import Color<br>from System.Windows import Application, DependencyObject, DependencyProperty, MessageBox, Window<o:p></o:p></span></p><p class=MsoNormal style='margin-bottom:12.0pt;line-height:16.8pt;background:white'><span style='font-size:10.5pt;font-family:"Helvetica",sans-serif;color:#333333'>class MyWindow(Window):<br>def <b>init</b>(self):<br>wpf.LoadComponent(self, 'Photography.xaml')<o:p></o:p></span></p><p class=MsoNormal style='background:#F7F7F7'><span style='font-size:9.0pt;font-family:Consolas;color:#333333;border:none windowtext 1.0pt;padding:0in'>def ButtonToolbarSession_Click(self, sender, e):<o:p></o:p></span></p><p class=MsoNormal style='background:#F7F7F7'><span style='font-size:9.0pt;font-family:Consolas;color:#333333;border:none windowtext 1.0pt;padding:0in'>   self.Background.SetValue(self.Background, Color.Gray)<o:p></o:p></span></p><p class=MsoNormal style='background:#F7F7F7'><span style='font-size:9.0pt;font-family:Consolas;color:#333333;border:none windowtext 1.0pt;padding:0in'>  #pass<o:p></o:p></span></p><p class=MsoNormal style='margin-bottom:12.0pt;line-height:16.8pt;background:white'><span style='font-size:10.5pt;font-family:"Helvetica",sans-serif;color:#333333'>if <b>name</b> == '<b>main</b>':<o:p></o:p></span></p><div style='mso-element:para-border-div;border:none;border-bottom:solid #EEEEEE 1.0pt;padding:0in 0in 4.0pt 0in;background:white'><p class=MsoNormal style='mso-margin-top-alt:12.0pt;margin-right:0in;margin-bottom:12.0pt;margin-left:0in;background:white;border:none;padding:0in'><b><span style='font-size:21.0pt;font-family:"Helvetica",sans-serif;color:#333333'>Application().Run(MyWindow())<o:p></o:p></span></b></p></div><p class=MsoNormal style='mso-margin-bottom-alt:auto;line-height:16.8pt;background:white'><span style='font-size:10.5pt;font-family:"Helvetica",sans-serif;color:#333333'>If this is not the correct forum, could someone direct me to one?<br>Thank you,<br>Bob K.<o:p></o:p></span></p><p class=MsoNormal><o:p> </o:p></p></div></body></html>