|
but in SelectionChanged you can't cancel the selection, only add stuff to when it's happening
|
|
|
|
|
Hi all,
I am planning to develop a website which have a simulator where allows users to design thier nail design online. This will be something drag and drop the design to the fingernail in 3D mode,decoration the nail and also display the nail design gallery in 3D which is fully interactive.
I do not want to choose Flash is because it just align the timeframe and simple coding. I want algorithm in my program and it is quite challenge to me to learn.
I posted on C# forum and others as well and they suggest me to use Silverlight. Do anyone have any website related to the Silverlight?Is Silverlight involved algorithm?
Thanks.
|
|
|
|
|
|
Hi all,
I am planning to develop a website which have a simulator where allows users to design thier nail design online. This will be something drag and drop the design to the fingernail in 3D mode.
I would like to ask can this implement in C# with Managed DirectX? And, how do I implement this using C# wi9th Managed DirectX?
Thanks.
|
|
|
|
|
Yes folks, this guy did indeed post this to every forum we have.
Ironically, if you use Silverlight to do this, ( and you probably will ), WPF will be involved.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hi All,
I'm still very much a newbie to a lot of C# / WPF and i'm having a bit of trouble making this 'generic' animation type work for me, but I also can't see what the problem is. I've been looking at the code for what already feels like a lifetime and I've gotten nowhere so I'm here now asking silly questions. Sorry for the stack of code below btw.
When I do this:
public void FadeElement(string ElementName, double currentOpacity, double targetOpacity)
{
Storyboard Fade = new Storyboard();
TimeSpan duration = new TimeSpan(0, 0, 0, 0, 500);
DoubleAnimation animation = new DoubleAnimation();
animation.From = currentOpacity;
animation.To = targetOpacity;
animation.Duration = new Duration(duration);
Storyboard.SetTargetName(animation, ElementName);
Storyboard.SetTargetProperty(animation, new PropertyPath(Control.OpacityProperty));
Fade.Children.Add(animation);
Fade.Begin(this);
}
All works fine.
But I wasn't to 'wrap' this up in a type in a separate library in order to enable me to re-use over and over without having this method in every app I/we make so I did this:
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media.Animation;
namespace Utils.HelperClasses.WPF
{
public sealed class OpacityAnimation : Storyboard
{
#region Fields and Properties
private Storyboard _storyboard;
public string ElementName;
public double CurrentOpacity;
public double TargetOpacity;
public OpacityAnimation()
{
}
public Storyboard CreateOpacityAnimation()
{
_storyboard = FadeElement(ElementName, CurrentOpacity, TargetOpacity);
return _storyboard;
}
private Storyboard FadeElement(string elementName, double currentOpacity, double targetOpacity)
{
Storyboard Fade = new Storyboard();
TimeSpan duration = new TimeSpan(0, 0, 0, 0, 500);
DoubleAnimation animation = new DoubleAnimation();
animation.From = currentOpacity;
animation.To = targetOpacity;
animation.Duration = new Duration(duration);
Storyboard.SetTargetName(animation, elementName);
Storyboard.SetTargetProperty(animation, new PropertyPath(Control.OpacityProperty));
Fade.Children.Add(animation);
return Fade;
}
#endregion
}
}
but then running this code does nothing but as far as I can tell its more or less the same as doing just the method in the first example with some code abstracted away in the other library:
private void button1_Click(object sender, RoutedEventArgs e)
{
OpacityAnimation oa = new OpacityAnimation();
oa.CurrentOpacity = 1;
oa.ElementName = "button2";
oa.TargetOpacity = 0.3;
oa.CreateOpacityAnimation();
oa.Begin(this);
}
Can anyone offer some insight into what I'm overlooking here?
Thanks,
Jammer
Going where everyone here has gone before!
My Blog
|
|
|
|
|
I started work on something similar using attached properties e.g <Button t:Transition.LoadedTransition="FadeIn" >Button</Button> I then found that markup extensions could not be used for events and I didn't want to create a property for each event, although I think there are a few workarounds. I haven't checked it out yet but the Transitionals project might provide similar functionality. Edit: Also see Kevin's WPF Bag-o-Tricks.
Anyway, with your code I found the problem was that you were inheriting from Storyboard and also creating another inside it and they must have got jumbled up.
public Storyboard CreateOpacityAnimation()
{
FadeElement(ElementName, CurrentOpacity, TargetOpacity);
return this;
}
private void FadeElement(string elementName, double currentOpacity, double targetOpacity)
{
TimeSpan duration = new TimeSpan(0, 0, 0, 0, 500);
DoubleAnimation animation = new DoubleAnimation();
animation.From = currentOpacity;
animation.To = targetOpacity;
animation.Duration = new Duration(duration);
Storyboard.SetTargetName(animation, elementName);
Storyboard.SetTargetProperty(animation, new PropertyPath(Control.OpacityProperty));
Children.Add(animation);
}
You could however just create a static method and reduce the amount of code needed e.g.
public static class Animations
{
public static void Fade(this UIElement control,double targetOpactity,int milliseconds)
{
control.BeginAnimation(UIElement.OpacityProperty,new DoubleAnimation(targetOpactity,new Duration(TimeSpan.FromMilliseconds(milliseconds))));
}
}
private void Button_Click(object sender, RoutedEventArgs e)
{
button2.Fade(0.3,500);
}
If your not using C# 3.0 or don't want to use an extension method thats a simple change.
modified on Friday, May 2, 2008 5:51 PM
|
|
|
|
|
Hi Dave,
Fantastic! I'm going to have a good play with this tomorrow. I still don't fully understand inheritace so I had no idea that creating my class would also create a Storyboard.
Thanks for all this info, incredibly useful.
Jammer
Going where everyone here has gone before!
My Blog
|
|
|
|
|
public static class Animations
{
public static void Fade(this UIElement control,double targetOpactity,int milliseconds)
{
control.BeginAnimation(UIElement.OpacityProperty,new DoubleAnimation(targetOpactity,new Duration(TimeSpan.FromMilliseconds(milliseconds))));
}
}
This is genius!
I take it this is also working along the lines of WPF's handoff animations in that it doesn't care what the current opacity is and will simple animate to the target opacity from its current opacity setting.
Food for thought! Thanks!
Jammer
Going where everyone here has gone before!
My Blog
|
|
|
|
|
Hi All,
I'm just creating some UI elements and I have an expander control in the UI that I wish to be able to expand ON TOP of all other content when its expanded and contract back to its 'placeholder' position when collapsed.
I've actually already done this one in another app (but that the code has been decimated by other developers ...) and I can't seem to replicated this behaviour again.
I've tried putting it into another layer and i've tried editing the ZIndex but none have worked ...
Any tips out there in WPF land?
Cheers,
Jammer
Going where everyone here has gone before!
My Blog
|
|
|
|
|
Great ... now I'm also talking to myself.
Fixed.
I was a dunce!
Caught out by an explicit height setting in the user control!!! I have now got the control working as desired!
Jammer
Going where everyone here has gone before!
My Blog
|
|
|
|
|
I have install following components in my stem
Silverlight.2.0
silverlight_sdk
VS_SilverlightTools_Alpha_Setup
now when i am opening Sliverlights project i have getting errror :
Package Load Failure......
can any one help me ?
Thanks in Advance
Best Regards
-----------------
Abhijit Jana
"Success is Journey it's not a destination"
|
|
|
|
|
my problem has been solved. my VS_SilverlightTools_Alpha_Setup vesrion was older.
Thanks @@@@@
Best Regards
-----------------
Abhijit Jana
"Success is Journey it's not a destination"
|
|
|
|
|
The source for Silverlight 2 controls has been released with thousands of unit tests along with the test framework. That said, to develop Silverlight-based applications that use the Silverlight 2 Beta 1 controls, you do not need this source code. Instead, you must install the Silverlight 2 Software Development Kit (SDK) Beta 1. The source code for the Silverlight 2 Beta 1 controls enables you to learn the inner workings of the controls. To get the source code and tests, see Source Code and Unit Tests for Silverlight 2 Beta 1 Controls on Microsoft download site.
The download is useful if you want to extend the controls or use them as a reference implementation when you implement your own controls. Complete unit tests provide additional guidance in developing polished, professional controls.
This download contains the complete source code and unit tests for the Silverlight 2 Beta 1 controls included in System.Windows.Controls.dll, System.Windows.Controls.Extended.dll, and System.Windows.Controls.Data.dll.
The source code for the Silverlight 2 Beta 1 controls includes implementations for the following controls:
- Button
- ButtonBase
- Calendar
- CheckBox
- ContentControl
- DataGrid
- DatePicker
- GridSplitter
- HyperlinkButton
- ListBox
- RadioButton
- RangeBase
- RepeatButton
- ScrollViewer
- Slider
- ToogleButton
- ToolTip
- WatermarkedTextBox
|
|
|
|
|
I wonder why MS doesn't want to show the sourcecode for Textbox.
|
|
|
|
|
Hi All;
[Edited to include link to mentioned tutorial]
I am trying out Scott Guthrie's Silverlight tutorial and got stuck in a rut. I cannot find any details around.
When I query DIGG on 'car', 'cars', 'sport'....I get an error (described later), while if I query 'space', 'baseball', 'microsoft' I get expected XML. Just does not make sense.
The Exception is:
System.Reflection.TargetInvocationException
Inner Exception: System.Exception: Download Failure.
Tnx to all
Ian
No trees were killed in the creation of this message. However, many electrons were terribly inconvenienced.
modified on Thursday, May 1, 2008 4:45 PM
|
|
|
|
|
Hi.
The DIGG service is not returning search results (which is why you can't just send it any ol' string). Rather, it's returning items that belong to a defined topic.
If you go to Digg.com, you'll see the topics divided into categories along a bar at the top of the page. You have to supply one of the sub-topic strings to get a valid response.
This is why you can use "baseball" but not "cars". There's a "baseball" topic at DIGG.com but there isn't a topic called "cars".
-Ian
|
|
|
|
|
AAAAHHHH! Somebody hit me in the ol' head.
But in my defense...I never went on Digg before today.
Tnx
Ian
No trees were killed in the creation of this message. However, many electrons were terribly inconvenienced.
|
|
|
|
|
I'm wondering if someone can help me understand the proper way to do this in Wpf databinding.
I have an object with start and end time properties that are displayed in a listview and can be edited in a bound detail area of the form. The edited values are immediately visible in the list after being edited.
The object also has a duration property that looks like this:
public TimeSpan Duration
{
get { return End - Start; }
}
But the duration will continue to display its original value in the databound listview after the start or end times have been edited.
What is the proper way to deal with this situation? How do you get calculated values to show changes in real time?
Thanks,
Art
<div class="ForumMod">modified on Wednesday, April 30, 2008 6:25 PM</div>
|
|
|
|
|
You really need to call NotifyPropertyChanged (hint - you should implement INotifyPropertyChanged on any datasource that you don't intend to use OneWay binding on).
|
|
|
|
|
I've tried doing that but nothing has changed. I used the example from INotifyPropertyChanged on MSDN for a template. Here is a snippet of my code:
public class SubtitleItem : IComparable<SubtitleItem>, INotifyPropertyChanged
{
private TimeSpan _TimeCodeStart;
public TimeSpan TimeCodeStart
{
get { return _TimeCodeStart; }
set
{
if (_TimeCodeStart != value)
{
_TimeCodeStart = value;
NotifyPropertyChanged("TimeCodeStart");
}
}
}
private TimeSpan _TimeCodeEnd;
public TimeSpan TimeCodeEnd
{
get { return _TimeCodeEnd; }
set
{
if (_TimeCodeEnd != value)
{
_TimeCodeEnd = value;
NotifyPropertyChanged("TimeCodeEnd");
}
}
}
public TimeSpan TimeCodeDuration
{
get { return TimeCodeEnd - TimeCodeStart; }
}
public event PropertyChangedEventHandler PropertyChanged;
private void NotifyPropertyChanged(String info)
{
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(info));
}
}
}
What am I missing?
<div class="ForumMod">modified on Wednesday, April 30, 2008 7:00 PM</div>
|
|
|
|
|
Can you please post the XAML so we can see what you are doing in that code.
modified 27-Feb-21 21:01pm.
|
|
|
|
|
|
Give this minor tweek a go:
private TimeSpan _TimeCode;
public TimeSpan TimeCode
{
get { return _TimeCode; }
set
{
_TimeCode = value;
NotifyPropertyChanged("TimeCode");
NotifyPropertyChanged("TimeCodeCalc");
}
}
Since TimeCodeCalc is ready only, you just need to tell the UI that it changed. Presto, you are in business.
modified 27-Feb-21 21:01pm.
|
|
|
|
|
Thanks, that's working.
I guess I misunderstood how this process worked. I thought you informed the system of what changed then it would automagically know that the whole object had changed and needed to be updated.
But the way it actually seems to work looks like there are plenty of ways for bugs to creep in. For instance, in my real project, the property IsModified will have to be notified from every field that can be changed.
Are there any solutions to just hardcoding a bunch of these NotifyPropertyChanged in every editable field?
|
|
|
|