Click here to Skip to main content
15,890,438 members
Home / Discussions / WPF
   

WPF

 
GeneralRe: How to change image at run-time corresponding time of day (24 hour format)? Pin
LAPEC14-Jun-12 1:23
LAPEC14-Jun-12 1:23 
GeneralRe: How to change image at run-time corresponding time of day (24 hour format)? Pin
Mycroft Holmes15-Jun-12 13:30
professionalMycroft Holmes15-Jun-12 13:30 
QuestionHow to draw a free hand shape (random) on wpf canvas Pin
Farhan Ghumra12-Jun-12 23:39
professionalFarhan Ghumra12-Jun-12 23:39 
AnswerRe: How to draw a free hand shape (random) on wpf canvas Pin
Pete O'Hanlon12-Jun-12 23:53
mvePete O'Hanlon12-Jun-12 23:53 
GeneralRe: How to draw a free hand shape (random) on wpf canvas Pin
Farhan Ghumra13-Jun-12 0:00
professionalFarhan Ghumra13-Jun-12 0:00 
GeneralRe: How to draw a free hand shape (random) on wpf canvas Pin
Farhan Ghumra13-Jun-12 0:38
professionalFarhan Ghumra13-Jun-12 0:38 
QuestionAdding ResourceDictionary to a WPF project gives "does not contain a static 'Main' method suitable for an entry point" error Pin
as_kannan11-Jun-12 23:43
as_kannan11-Jun-12 23:43 
QuestionDependency propertie validation Pin
columbos1492711-Jun-12 20:58
columbos1492711-Jun-12 20:58 
Hello,
Ive created a dependency property:
C#
class FrameworkElement : UIElement
    {
        public static readonly DependencyProperty NumberProperty;

        public FrameworkElement() { }

        static FrameworkElement()
        {
            FrameworkPropertyMetadata metadata =
                new FrameworkPropertyMetadata(Double.NaN,
                                              FrameworkPropertyMetadataOptions.AffectsMeasure);

            NumberProperty = DependencyProperty.Register("Number",//Propertie name
                                                          typeof(Double),//Data used by the prpertie
                                                          typeof(FrameworkElement),//The type that owns the propertie
                                                          metadata,//Meta data object
                                                          new ValidateValueCallback(FrameworkElement.IsNumberValid));//Validation callback

        }

        public Double Number
        {
            set { SetValue(NumberProperty, value); }
            get { return (Double)GetValue(NumberProperty); }
        }


        private static Boolean IsNumberValid(object value)
        {
            Double number = (Double)value;

            if ((number < 0) || (number > 100))
                return false;
            return true;
        }
    }



and i added to it a validation callback.
When i set an out of range number to that proprty i get an:ArgumentException.
How can i do that instead of an exception the propertie will get some default value when i try to set out of range number?

Thanks
QuestionGeneral question on silverlight Pin
ebrahim rajabloo10-Jun-12 0:49
ebrahim rajabloo10-Jun-12 0:49 
AnswerRe: General question on silverlight Pin
egenis10-Jun-12 5:25
egenis10-Jun-12 5:25 
QuestionLoop multiple Videos in MediaPlayer Pin
mselvaraj9-Jun-12 1:20
mselvaraj9-Jun-12 1:20 
QuestionScreen Scraping Silverlight Web Page Pin
yirgalem8-Jun-12 12:00
yirgalem8-Jun-12 12:00 
QuestionGeneral question on MVVM Pin
jesarg7-Jun-12 6:10
jesarg7-Jun-12 6:10 
GeneralRe: General question on MVVM Pin
jesarg7-Jun-12 9:06
jesarg7-Jun-12 9:06 
GeneralRe: General question on MVVM Pin
jesarg7-Jun-12 12:07
jesarg7-Jun-12 12:07 
AnswerRe: General question on MVVM Pin
Abhinav S9-Jun-12 2:18
Abhinav S9-Jun-12 2:18 
AnswerRe: General question on MVVM Pin
egenis10-Jun-12 5:27
egenis10-Jun-12 5:27 
AnswerRe: General question on MVVM Pin
Cracked-Down10-Jun-12 20:17
Cracked-Down10-Jun-12 20:17 
GeneralRe: General question on MVVM Pin
Alisaunder15-Jun-12 2:56
Alisaunder15-Jun-12 2:56 
QuestionPLEASE HELP THE WAY IT CAN BE ACHIEVED Pin
formulaone877-Jun-12 0:33
formulaone877-Jun-12 0:33 
AnswerRe: PLEASE HELP THE WAY IT CAN BE ACHIEVED Pin
Mycroft Holmes7-Jun-12 13:04
professionalMycroft Holmes7-Jun-12 13:04 
GeneralRe: PLEASE HELP THE WAY IT CAN BE ACHIEVED Pin
formulaone878-Jun-12 0:53
formulaone878-Jun-12 0:53 
QuestionCopy/Pasting excel data into the WPF Rich Textbox loses formatting Pin
sundherrajan6-Jun-12 21:17
sundherrajan6-Jun-12 21:17 
AnswerRe: Copy/Pasting excel data into the WPF Rich Textbox loses formatting Pin
Mycroft Holmes7-Jun-12 0:00
professionalMycroft Holmes7-Jun-12 0:00 
QuestionRequired field Validation in WPF Pin
User-84353845-Jun-12 5:43
User-84353845-Jun-12 5:43 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.