Увидев ответ от @ J.B.D, я отредактировал ControlTemplate для элемента управления IntegerUpDown, чтобы сменить обратную сторону.
<ControlTemplate x:Key="ControlControlTemplate1" TargetType="{x:Type Control}">
<xctk:ButtonSpinner x:Name="PART_Spinner" AllowSpin="{Binding AllowSpin, RelativeSource={RelativeSource TemplatedParent}}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" ButtonSpinnerLocation="{Binding ButtonSpinnerLocation, RelativeSource={RelativeSource TemplatedParent}}" Background="{TemplateBinding Background}" HorizontalContentAlignment="Stretch" IsTabStop="False" ShowButtonSpinner="{Binding ShowButtonSpinner, RelativeSource={RelativeSource TemplatedParent}}" VerticalContentAlignment="Stretch">
<xctk:WatermarkTextBox x:Name="PART_TextBox" AutoMoveFocus="{Binding AutoMoveFocus, RelativeSource={RelativeSource TemplatedParent}}" AutoSelectBehavior="{Binding AutoSelectBehavior, RelativeSource={RelativeSource TemplatedParent}}" AcceptsReturn="False" BorderThickness="0" ContextMenu="{TemplateBinding ContextMenu}" Foreground="{TemplateBinding Foreground}" FontWeight="{TemplateBinding FontWeight}" FontStyle="{TemplateBinding FontStyle}" FontStretch="{TemplateBinding FontStretch}" FontSize="{TemplateBinding FontSize}" FontFamily="{TemplateBinding FontFamily}" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" IsTabStop="True" IsUndoEnabled="True" MinWidth="20" MaxLength="{Binding MaxLength, RelativeSource={RelativeSource TemplatedParent}}" Padding="{TemplateBinding Padding}" TextAlignment="{Binding TextAlignment, RelativeSource={RelativeSource TemplatedParent}}" TextWrapping="NoWrap" TabIndex="{TemplateBinding TabIndex}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" WatermarkTemplate="{Binding WatermarkTemplate, RelativeSource={RelativeSource TemplatedParent}}" Watermark="{Binding Watermark, RelativeSource={RelativeSource TemplatedParent}}">
<xctk:WatermarkTextBox.Style>
<Style TargetType="{x:Type xctk:WatermarkTextBox}">
<Setter Property="Background" Value="{StaticResource DarkGreyBrush}" />
<Style.Triggers>
<Trigger Property="IsFocused" Value="True">
<Setter Property="Background" Value="{StaticResource LightGreyBrush}" />
</Trigger>
</Style.Triggers>
</Style>
</xctk:WatermarkTextBox.Style>
</xctk:WatermarkTextBox>
</xctk:ButtonSpinner>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="BorderBrush" Value="{DynamicResource {ComponentResourceKey ResourceId=ControlMouseOverBorderKey, TypeInTargetAssembly={x:Type Themes:ResourceKeys}}}"/>
</Trigger>
<MultiDataTrigger>
<MultiDataTrigger.Conditions>
<Condition Binding="{Binding IsReadOnly, RelativeSource={RelativeSource Self}}" Value="False"/>
<Condition Binding="{Binding AllowTextInput, RelativeSource={RelativeSource Self}}" Value="False"/>
</MultiDataTrigger.Conditions>
<Setter Property="IsReadOnly" TargetName="PART_TextBox" Value="True"/>
</MultiDataTrigger>
<DataTrigger Binding="{Binding IsReadOnly, RelativeSource={RelativeSource Self}}" Value="True">
<Setter Property="IsReadOnly" TargetName="PART_TextBox" Value="True"/>
</DataTrigger>
<Trigger Property="IsKeyboardFocusWithin" Value="True">
<Setter Property="BorderBrush" Value="{DynamicResource {ComponentResourceKey ResourceId=ControlSelectedBorderKey, TypeInTargetAssembly={x:Type Themes:ResourceKeys}}}"/>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
</Trigger>
<Trigger Property="IsFocused" Value="True">
<Setter Property="FocusManager.FocusedElement" TargetName="PART_TextBox" Value="{Binding ElementName=PART_TextBox}"/>
<Setter TargetName="PART_TextBox" Property="Visibility" Value="Hidden" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
Пожалуйста, посмотрите на начало шаблона элемента управления и WatermarkTextBox. WatermarkTextBox.Style - это то, что я добавил, чтобы изменить фон, когда текстовое поле сфокусировано.
Чтобы переопределить шаблон COntrolTemplate, щелкните правой кнопкой мыши элемент управления IntegerUpDown и нажмите «Изменить шаблон»
.Для поддержки IronPython 1.1 (чей синтаксис зеркально отражает CPython 2.4), я успешно создал и установил образец из Visual Studio 2008 SDK 1.0 с Professional Edition Visual Studio 2008 SP1. Это будет работать с любым выпуском из Стандарта до Комплекта Команды. Это определенно не будет работать с Express Edition из-за ограничений, встроенных к Экспрессу.
Для IronPython 2.0 (чей синтаксис зеркально отражает CPython 2.5), в настоящее время нет никакого хорошего способа записать и отладить в соответствии с Visual Studio 2008, и к сожалению, это было бы значительное обязательство адаптировать IronPython Studio для хостинга IronPython 2.0 - одно из больших обновлений в IronPython 2.0 должно было основывать его на Динамическом Времени выполнения Языка, и это повреждает приемы для включения IntelliSense, которые использовались ранее, такие как статическая компиляция.
Прямо сейчас нет никакого расширения для выполнения IronPython v2.0 на Visual Studio.
string code = @"100 * 2 + 4 / 3";
ScriptEngine engine = Python.CreateEngine();
ScriptSource source =
engine.CreateScriptSourceFromString(code, SourceCodeKind.Expression);
int res = source.Execute<int>();
Console.WriteLine(res);
Для полного учебного руководства и примера кода, проверьте следующую ссылку:
Расширение приложения C# с IronPython
Если Вы просто смотрите на использование IronPython в ASP веб-сайты.NET (проекты, не поддерживаемые), проверяете, как установить фьючерсы Microsoft ASP.NET (июль 2007)
Я новичок как в VS2008, так и в IronPython (но не в самом Python): но мне кажется, что я запускаю IronPython 2.0.1 под VS 2008 Pro, хотя и в довольно громоздкий способ.
Остальные инструкции у меня сработали: я создал простое тестовое консольное приложение, и оно сработало, как я ожидал. Однако я еще не пробовал ничего .Net.
Если бы существовал простой способ изменить sys.path для использования обычных библиотек Python ...