wpf-4.0

Animating a TextBox.Foreground in WPF

可紊 提交于 2019-12-06 02:39:35
问题 Is there anyway to animate a TextBox.ForegroundProperty ? <Color x:Key="NormalColor">#FF666666</Color> <SolidColorBrush x:Key="NormalBrush" Color="{StaticResource NormalColor}" /> <Color x:Key="MouseOverColor">#FF666666</Color> <SolidColorBrush x:Key="MouseOverBrush" Color="{StaticResource MouseOverColor}" /> <ControlTemplate x:Key="RegularTextBoxTemplate" TargetType="{x:Type TextBox}"> <Grid> <VisualStateManager.VisualStateGroups> <VisualStateGroup x:Name="CommonStates"> <VisualStateGroup

Strange order of firing of Validation.Error event - Added fired before Removed

做~自己de王妃 提交于 2019-12-06 02:14:16
I am getting strange behavior as far as order of firing of Validation.Error event is concerned. According to the documentation here , the data binding engine first removes any ValidationError that may have been added to the Validation.Errors attached property of the bound element . Accordingly, the ValidationErrorEvent for Removed should be fired prior to the Added , but strangely in my case the Added event gets fired before the Removed event. Here is the code that I am using. XAML <TextBox Grid.Row="3" Grid.Column="1" Name="txtGroupsPerRow" > <TextBox.Text> <Binding Path="StandardRack

C# WPF Designer Exception: animation object cannot be used to animate property 'Foreground' [duplicate]

痴心易碎 提交于 2019-12-05 23:03:43
问题 This question already has an answer here : Color Animation ContentPresenter (1 answer) Closed 6 years ago . The following code runs and works perfectly at runtime but crashes the designer and I have NO idea why. <VisualState x:Name="Selected" > <Storyboard> <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(TextElement.Foreground).(SolidColorBrush.Color)" Storyboard.TargetName="HeaderTopSelected"> <EasingColorKeyFrame KeyTime="0" Value="White"/> </ColorAnimationUsingKeyFrames> <

Issue with x:TypeArguments and generic List class in XAML

守給你的承諾、 提交于 2019-12-05 03:05:32
I created the following markup for a loose XAML file. <StackPanel xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:sys="clr-namespace:System;assembly=mscorlib" xmlns:scg="clr-namespace:System.Collections.Generic;assembly=mscorlib"> <scg:List x:TypeArguments="sys:String"> HelloWorld </scg:List> </StackPanel> But I get this error when I run the loose XAML in IE: The tag 'List' does not exist in XML namespace 'clr-namespace:System.Collections.Generic;assembly=mscorlib'. Line '7' Position 2'. As you would know, generics

WPF DotNET Application will run in debug mode, but .EXE will not run

↘锁芯ラ 提交于 2019-12-05 01:31:45
I wrote a WPF application in C# using VS 2010. The application will run fine in debug mode using Visual Studio, but when I go to run the .EXE from the bin\release folder, nothing happens. I do not get any error messages from windows and there are no errors or warnings in VS. I have tried to build, rebuild and clean the solution (in every possible order) with no luck. My solution contains 2 projects, both of which use .NET 4.0 framework, and I have .NET 4.0 installed on my PC. I have tried on both XP and Win7 and still nothing. I also just noticed that the output from Debug when I run the

Animating a TextBox.Foreground in WPF

…衆ロ難τιáo~ 提交于 2019-12-04 07:20:58
Is there anyway to animate a TextBox.ForegroundProperty ? <Color x:Key="NormalColor">#FF666666</Color> <SolidColorBrush x:Key="NormalBrush" Color="{StaticResource NormalColor}" /> <Color x:Key="MouseOverColor">#FF666666</Color> <SolidColorBrush x:Key="MouseOverBrush" Color="{StaticResource MouseOverColor}" /> <ControlTemplate x:Key="RegularTextBoxTemplate" TargetType="{x:Type TextBox}"> <Grid> <VisualStateManager.VisualStateGroups> <VisualStateGroup x:Name="CommonStates"> <VisualStateGroup.Transitions> <VisualTransition GeneratedDuration="0:0:0.1"/> </VisualStateGroup.Transitions> <VisualState

C# WPF Designer Exception: animation object cannot be used to animate property 'Foreground' [duplicate]

为君一笑 提交于 2019-12-04 05:14:20
This question already has an answer here: Color Animation ContentPresenter 1 answer The following code runs and works perfectly at runtime but crashes the designer and I have NO idea why. <VisualState x:Name="Selected" > <Storyboard> <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(TextElement.Foreground).(SolidColorBrush.Color)" Storyboard.TargetName="HeaderTopSelected"> <EasingColorKeyFrame KeyTime="0" Value="White"/> </ColorAnimationUsingKeyFrames> </Storyboard> </VisualState> That crashes the designer with the following error: 'System.Windows.Media.Animation

[WPF]How to draw a grid on canvas?

偶尔善良 提交于 2019-12-03 21:34:54
How to draw the following chart as a background on custom canvas inherited from Canvas - system ui element? Thanks for any useful links. You can just set Canvas.Background to some DrawingBrush . This brush can just need to render a Rectangle (by using some RectangleGeometry ). Because of supporting for TileMode , we can repeat this rectangle along both horizontal and vertical axes and make the full grid for you: <Canvas> <Canvas.Background> <DrawingBrush TileMode="Tile" Viewport="-10,-10,40,40" ViewportUnits="Absolute"> <DrawingBrush.Drawing> <GeometryDrawing> <GeometryDrawing.Geometry>

Binding to a double with StringFormat on a TextBox

人走茶凉 提交于 2019-12-03 07:33:53
I am using WPF's TextBox with a binding on the Text property to a double on my ViewModel. My XAML looks like this: <TextBox Text="{Binding Path=MyDoubleValue, StringFormat=N2, UpdateSourceTrigger=PropertyChanged}" /> Unfortunately when I switch UpdateSourceTrigger to PropertyChanged and type value 12345 , I get 12,354.00 ( EDIT : notice the 5 before the 4). This is a result of keeping cursor in the same place after adding , between 2 and 3 by the .NET formatter. How can I use StringFormat with UpdateSourceTrigger set to PropertyChanged? Note: This is only happening in .NET 4. Usually you don't

Script Error in webBrowser control WPF

僤鯓⒐⒋嵵緔 提交于 2019-12-01 22:10:54
When am work on webBrowser control using wpf Getting error like "script error" even i pasted screen shot here and even some jquery UI and css not working I faced this problem too. I need to create browser application which the web has lot of Jquery, JSON etc and webbrowser control does't work as expected (I'm using Windows 10 and Visual Studio 2015) As solution, I use cefsharp.github.io which allow me to embed a full-featured standards-complaint web browser into C# or VB.NET project solution without hacking windows registry key. It based on Chromium Embedded Framework. It work like a charm!