Click here to Skip to main content
15,900,724 members
Home / Discussions / C#
   

C#

 
QuestionMdichild form goes behind panel Pin
ronakT18-Feb-10 7:18
ronakT18-Feb-10 7:18 
AnswerRe: Mdichild form goes behind panel Pin
Abhinav S18-Feb-10 8:12
Abhinav S18-Feb-10 8:12 
GeneralRe: Mdichild form goes behind panel Pin
ronakT18-Feb-10 8:29
ronakT18-Feb-10 8:29 
GeneralRe: Mdichild form goes behind panel Pin
Abhinav S18-Feb-10 8:47
Abhinav S18-Feb-10 8:47 
GeneralRe: Mdichild form goes behind panel Pin
ronakT19-Feb-10 5:19
ronakT19-Feb-10 5:19 
GeneralRe: Mdichild form goes behind panel Pin
EliottA18-Feb-10 9:05
EliottA18-Feb-10 9:05 
GeneralRe: Mdichild form goes behind panel Pin
ronakT19-Feb-10 5:21
ronakT19-Feb-10 5:21 
QuestionValidation on Data Object in Code, not XAML? Pin
MattFunke18-Feb-10 4:25
MattFunke18-Feb-10 4:25 
My apologies for the relatively newbie-ish question -- I'm rather new to C# and WPF programming. Here's an object I'm trying to use with strong influence from Pro WPF in C# 2008 (.NET version 3.5) that's supposed to validate a text box's contents:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using System.Windows;
using System.Windows.Controls;

namespace LeanQualityTool
{
    public class ValidatedTextBox : TextBox, INotifyPropertyChanged, IDataErrorInfo
    {
        private string _TextContents = "";

        public string TextContents
        {
            get { return _TextContents; }
            set { _TextContents = value;
                  NotifyPropertyChanged("TextContents");
                }
        }

        public event PropertyChangedEventHandler PropertyChanged;

        private void NotifyPropertyChanged(string info)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(info));
            }
        }

        #region IDataErrorInfo Members

        public string Error
        {
            get { return null; }
        }

        public string this[string fieldName]
        {
            get
            {
                string result = null;

                #region For Validating Text
                if (fieldName.Contains("Title"))
                {
                    if (this._TextContents.Length == 0)
                    {
                        result = "Text should not be blank";
                        throw new ArgumentException(result);
                    }
                    else
                    {
                        // Do searches for illegal chars in here if you like
                    }
                }
                #endregion

                return result;
            }

        #endregion
        }
    }
}


And here's the relevant XAML:

xmlns:vip="clr-namespace:LeanQualityTool"

                <vip:ValidatedTextBox Height="23" x:Name="txtJobTitle" HorizontalAlignment="Left" Width="276"
                     Style="{StaticResource validatedTextBox}">
                         <TextBox.Text>
                              <Binding Path="SelectedItem.Title" UpdateSourceTrigger="PropertyChanged"
                                       ValidatesOnDataErrors="True">
                              </Binding>
                         </TextBox.Text>
                </vip:ValidatedTextBox>


I try to put a breakpoint on the IF statement in the class, but when I debug the app, changing the text in the textbox doesn't even cause the breakpoint to engage. Why isn't the new ValidatedTextBox working?
AnswerRe: Validation on Data Object in Code, not XAML? Pin
OriginalGriff18-Feb-10 4:47
mveOriginalGriff18-Feb-10 4:47 
GeneralRe: Validation on Data Object in Code, not XAML? Pin
MattFunke18-Feb-10 4:50
MattFunke18-Feb-10 4:50 
AnswerRe: Validation on Data Object in Code, not XAML? Pin
Ennis Ray Lynch, Jr.18-Feb-10 5:42
Ennis Ray Lynch, Jr.18-Feb-10 5:42 
GeneralRe: Validation on Data Object in Code, not XAML? Pin
MattFunke18-Feb-10 7:27
MattFunke18-Feb-10 7:27 
QuestionSensing data entry Pin
mbangh18-Feb-10 4:18
mbangh18-Feb-10 4:18 
AnswerRe: Sensing data entry Pin
Nicholas Butler18-Feb-10 4:25
sitebuilderNicholas Butler18-Feb-10 4:25 
GeneralRe: Sensing data entry Pin
mbangh18-Feb-10 4:27
mbangh18-Feb-10 4:27 
GeneralRe: Sensing data entry Pin
Nicholas Butler18-Feb-10 5:33
sitebuilderNicholas Butler18-Feb-10 5:33 
AnswerRe: Sensing data entry Pin
Ennis Ray Lynch, Jr.18-Feb-10 5:43
Ennis Ray Lynch, Jr.18-Feb-10 5:43 
QuestionProblems with Exchange WebService API Pin
DotNetCoderJunior18-Feb-10 3:34
DotNetCoderJunior18-Feb-10 3:34 
AnswerRe: Problems with Exchange WebService API Pin
DotNetCoderJunior21-Feb-10 22:07
DotNetCoderJunior21-Feb-10 22:07 
QuestionProblems showing another form when user activates the main form Pin
TheFoZ18-Feb-10 3:32
TheFoZ18-Feb-10 3:32 
AnswerRe: Problems showing another form when user activates the main form Pin
1.21 Gigawatts18-Feb-10 3:39
1.21 Gigawatts18-Feb-10 3:39 
GeneralRe: Problems showing another form when user activates the main form Pin
TheFoZ18-Feb-10 3:42
TheFoZ18-Feb-10 3:42 
QuestionFile I/O - New Line Character Pin
1.21 Gigawatts18-Feb-10 2:45
1.21 Gigawatts18-Feb-10 2:45 
AnswerRe: File I/O - New Line Character Pin
Luc Pattyn18-Feb-10 2:58
sitebuilderLuc Pattyn18-Feb-10 2:58 
GeneralRe: File I/O - New Line Character Pin
1.21 Gigawatts18-Feb-10 3:07
1.21 Gigawatts18-Feb-10 3:07 

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.