Click here to Skip to main content
15,177,966 members
Home / Discussions / WPF
   

WPF

 
QuestionToggleButton with Images [SOLVED - sort of] Pin
#realJSOP14-Apr-09 10:58
mva#realJSOP14-Apr-09 10:58 
AnswerRe: ToggleButton with Images Pin
Eslam Afifi14-Apr-09 12:05
MemberEslam Afifi14-Apr-09 12:05 
AnswerRe: ToggleButton with Images [SOLVED - sort of] Pin
DemonPT30-Aug-11 6:07
MemberDemonPT30-Aug-11 6:07 
QuestionVisual Studio 2008/Expression Blend Wierdness [SOLVED!!!] Pin
BlitzPackage14-Apr-09 8:23
MemberBlitzPackage14-Apr-09 8:23 
AnswerRe: Visual Studio 2008/Expression Blend Wierdness Pin
BlitzPackage14-Apr-09 8:53
MemberBlitzPackage14-Apr-09 8:53 
QuestionCanvas or Grid inside Viewport3D? Pin
emptythetill14-Apr-09 6:38
Memberemptythetill14-Apr-09 6:38 
AnswerRe: Canvas or Grid inside Viewport3D? Pin
sivaddrahcir20-Apr-09 9:17
Membersivaddrahcir20-Apr-09 9:17 
QuestionReading a XML file from IsolatedStorage ? [modified] Pin
Mohammad Dayyan13-Apr-09 19:00
MemberMohammad Dayyan13-Apr-09 19:00 
Hi.
I'm reading a XML file that has been stored in IsolatedStorage.
But this Exception was occurring Root element is missing.
I'm dead sure that there isn't any troubles in the XML file, So I don't the know the result of the Exception Frown | :(

Could you guide me ?
Thank you.

This is my snippet code :
using (IsolatedStorageFile isoStore = IsolatedStorageFile.GetUserStoreForApplication())
{
	.
        .
        .
   
    string SettingFilePath = "CodeColorizer\\setting.xml";
    using (IsolatedStorageFileStream isoStream = new IsolatedStorageFileStream(SettingFilePath, FileMode.Create, isoStore))
    {
        isoStream.Position = 0;
        XmlReader xmlReader;
        xmlReader = XmlReader.Create(isoStream);
        //Moves the reader to the root element.                        
        <code>xmlReader.MoveToContent();</code>//Exception was occurring here
        string value;
        while (xmlReader.Read())
        {
            switch (xmlReader.NodeType)
            {
                case XmlNodeType.Element:
                    {
                        if (xmlReader.Name == "IsVB")
                        {
                            value = (string)xmlReader.ReadContentAs(Type.GetType("String"), null);
                            if (value == "True") { this.IsVB.IsChecked = true; this.IsCsharp.IsChecked = false; }
                            else if (value == "False") { this.IsVB.IsChecked = false; this.IsCsharp.IsChecked = true; }
                        }
                        else if (xmlReader.Name == "IsCsharp")
                        {
                            value = (string)xmlReader.ReadContentAs(Type.GetType("String"), null);
                            if (value == "True") { this.IsVB.IsChecked = false; this.IsCsharp.IsChecked = true; }
                            else if (value == "False") { this.IsVB.IsChecked = true; this.IsCsharp.IsChecked = false; }
                        }
                        else if (xmlReader.Name == "IsStriped")
                        {
                            value = (string)xmlReader.ReadContentAs(Type.GetType("String"), null);
                            if (value == "True") { this.IsStriped.IsChecked = true; }
                            else if (value == "False") { this.IsStriped.IsChecked = false; }
                        }
                        else if (xmlReader.Name == "HasLineNumber")
                        {
                            value = (string)xmlReader.ReadContentAs(Type.GetType("String"), null);
                            if (value == "True") { this.HasLineNumber.IsChecked = true; }
                            else if (value == "False") { this.HasLineNumber.IsChecked = false; }
                        }
                        else if (xmlReader.Name == "AddDefaultStylesWithinPreTags")
                        {
                            value = (string)xmlReader.ReadContentAs(Type.GetType("String"), null);
                            if (value == "True") { this.addDefaultStylesWithinPreTags.IsChecked = true; }
                            else if (value == "False") { this.addDefaultStylesWithinPreTags.IsChecked = false; }
                        }
                        else if (xmlReader.Name == "CssClassName")
                        {
                            value = (string)xmlReader.ReadContentAs(Type.GetType("String"), null);
                            this.cssClassName.Text = value;
                        }
                        else if (xmlReader.Name == "AddPreTag")
                        {
                            value = (string)xmlReader.ReadContentAs(Type.GetType("String"), null);
                            if (value == "True") { this.AddPreTag.IsChecked = true; }
                            else if (value == "False") { this.AddPreTag.IsChecked = false; }
                        }
                        else if (xmlReader.Name == "AddBGColor")
                        {
                            value = (string)xmlReader.ReadContentAs(Type.GetType("String"), null);
                            if (value == "True") { this.AddBGColor.IsChecked = true; }
                            else if (value == "False") { this.AddBGColor.IsChecked = false; }
                        }
                        else if (xmlReader.Name == "TextBoxColor")
                        {
                            value = (string)xmlReader.ReadContentAs(Type.GetType("String"), null);
                            this.TextBoxColor.Text = value;
                        }
                        break;
                    }
            }
        }
    }   
 

}


modified on Tuesday, April 14, 2009 12:08 AM

QuestionRe: Reading a XML file from IsolatedStorage ? Pin
Mark Salsbery13-Apr-09 21:08
MemberMark Salsbery13-Apr-09 21:08 
AnswerRe: Reading a XML file from IsolatedStorage ? Pin
Mohammad Dayyan13-Apr-09 22:53
MemberMohammad Dayyan13-Apr-09 22:53 
AnswerRe: Reading a XML file from IsolatedStorage ? Pin
Mohammad Dayyan13-Apr-09 23:34
MemberMohammad Dayyan13-Apr-09 23:34 
QuestionRe: Reading a XML file from IsolatedStorage ? Pin
Mark Salsbery14-Apr-09 7:24
MemberMark Salsbery14-Apr-09 7:24 
AnswerRe: Reading a XML file from IsolatedStorage ? Pin
Mohammad Dayyan14-Apr-09 11:56
MemberMohammad Dayyan14-Apr-09 11:56 
QuestionXAML - TreeView with CheckBoxes Pin
Jack Kril13-Apr-09 14:26
MemberJack Kril13-Apr-09 14:26 
AnswerRe: XAML - TreeView with CheckBoxes Pin
Eslam Afifi13-Apr-09 14:59
MemberEslam Afifi13-Apr-09 14:59 
QuestionClipping To Rounded Corners Pin
#realJSOP13-Apr-09 6:27
mva#realJSOP13-Apr-09 6:27 
AnswerRe: Clipping To Rounded Corners [modified] Pin
Eslam Afifi13-Apr-09 8:42
MemberEslam Afifi13-Apr-09 8:42 
AnswerRe: Clipping To Rounded Corners Pin
Mark Salsbery13-Apr-09 10:45
MemberMark Salsbery13-Apr-09 10:45 
AnswerRe: Clipping To Rounded Corners Pin
sivaddrahcir20-Apr-09 9:31
Membersivaddrahcir20-Apr-09 9:31 
QuestionOnRenderComplete like event for WPF controls Pin
Pankaj Chamria13-Apr-09 2:38
MemberPankaj Chamria13-Apr-09 2:38 
QuestionContext menu in Datatemplate Pin
mikla52111-Apr-09 6:39
Membermikla52111-Apr-09 6:39 
QuestionRe: Context menu in Datatemplate Pin
Mark Salsbery11-Apr-09 8:42
MemberMark Salsbery11-Apr-09 8:42 
AnswerRe: Context menu in Datatemplate [modified] Pin
mikla52111-Apr-09 20:54
Membermikla52111-Apr-09 20:54 
QuestionRe: Context menu in Datatemplate Pin
Mark Salsbery13-Apr-09 9:47
MemberMark Salsbery13-Apr-09 9:47 
AnswerRe: Context menu in Datatemplate Pin
mikla52113-Apr-09 22:11
Membermikla52113-Apr-09 22:11 

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.