Click here to Skip to main content
15,886,831 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi dears

I have following xml file and its designer not load:

<window x:class="SelectionMaker.Window1" xmlns:x="#unknown">
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:cv="clr-namespace:SelectionMaker"
    xmlns:wf="clr-namespace:System.Windows.Forms;assembly=System.Windows.Forms"
    Title="Selection Maker" Height="600" Width="800" WindowStartupLocation="CenterScreen" Loaded="Window_Loaded" removed="LightGray" Closing="Window_Closing" Activated="Window_Activated">
    <window.resources>
        <cv:volumeconvertor x:key="ConvertVolume" xmlns:cv="#unknown" />
        <cv:positionconverter x:key="ConvertPosition" xmlns:cv="#unknown" />
        <cv:convertpathtoimage x:key="ConvertToImage" xmlns:cv="#unknown" />
        <cv:converttofilename x:key="ConvertToFileName" xmlns:cv="#unknown" />
    </window.resources>
    <grid>
        <grid.columndefinitions>
            <columndefinition width="auto" />
            <columndefinition />
        </grid.columndefinitions>
        <grid.rowdefinitions>
            <rowdefinition />
            <rowdefinition height="25" />
        </grid.rowdefinitions>
        <grid>
            <grid.rowdefinitions>
                <rowdefinition height="auto" />
                <rowdefinition height="auto" />
                <rowdefinition height="40" />
                <rowdefinition height="auto" />
                <rowdefinition height="auto" />
            </grid.rowdefinitions>

            <stackpanel>
                <stackpanel orientation="Horizontal" margin="5">
                    <textblock verticalalignment="Center" horizontalalignment="Left" fontweight="Bold">
                           Margin="10">Source Folder:</textblock>
                    <textbox name="TextBoxSourceFolder" minwidth="100" width="150" verticalalignment="Center">
                         HorizontalAlignment="Stretch"></textbox>
                    <Button Name="ButtonSourceFolder" Content="Browse" Margin="10"
                        Width="70" Height="25" Click="ButtonSourceFolder_Click"></Button>
                </stackpanel>

                <stackpanel orientation="Horizontal" margin="5">
                    <textblock verticalalignment="Center" horizontalalignment="Left" fontweight="Bold">
                           Margin="10">Destination Folder:</textblock>
                    <textbox name="TextBoxDestinationFolder" minwidth="100" width="150" verticalalignment="Center">
                         HorizontalAlignment="Stretch"></textbox>
                    <Button Name="ButtonDestinationFolder" Content="Browse" Margin="10"
                        Width="70" Height="25" Click="ButtonDestinationFolder_Click"></Button>
                </stackpanel>

                <stackpanel orientation="Horizontal" margin="5">
                    <textblock fontweight="Bold" margin="10" verticalalignment="Center">Seach SubFolders</textblock>
                    <checkbox name="CheckBoxSearchSubFolder" verticalalignment="Center"></checkbox>
                    <!--<textblock fontweight="Bold" margin="40,0,10,0" verticalalignment="Center">Copy Async</textblock>
                    <checkbox name="ChechBoxCopyAsync" verticalalignment="Center" checked="ChechBoxCopyAsync_Checked">
                        <checkbox.tooltip>
                            <textblock>Copy several files concurrently</textblock>
                        </checkbox.tooltip>
                    </checkbox>-->
                </stackpanel>

                <stackpanel orientation="Horizontal">
                    <Button Margin="60,10,20,10" Width="70" Height="25" Name="ButtonListFiles" Click="ButtonListFiles_Click">List</Button>
                    <Button Margin="20,10" Width="70" Height="25" Name="ButtonCancel" Click="ButtonCancel_Click">Cancel</Button>
                    <Button Margin="20,10" Width="70" Height="25" Name="ButtonClear" Click="ButtonClear_Click">Clear</Button>
                </stackpanel>
            </stackpanel>

            <stackpanel grid.row="1" horizontalalignment="Center" margin="0,20">
                <slider horizontalalignment="Stretch" margin="20,5,20,0" name="SliderMediaPosition" tickfrequency="1" tickplacement="None" ismovetopointenabled="True">
                    <slider.value>
                        <binding elementname="MediaElementSelectedMedia" path="Position" converter="{StaticResource ConvertPosition}">
                                 Mode="OneWayToSource"/>
                    </binding></slider.value>
                </slider>
                <stackpanel orientation="Horizontal" margin="20,5,20,5">
                    <Button Width="30" Height="30" Margin="5,0" Name="ButtonStop" Click="ButtonStop_Click">
                        <path width="8" height="10" stretch="Fill" strokelinejoin="Round" stroke="#FF000000" fill="#FF424040" data="F1 M 320.001,191.918L 327.834,191.918L 327.834,200.585L 320.041,200.585L 320.001,191.918 Z " />
                    </Button>
                    <Button Width="30" Height="30" Margin="5,0" Name="ButtonPrev" Click="ButtonPrev_Click">
                        <stackpanel orientation="Horizontal">
                            <path width="1" height="10" stretch="Fill" strokelinejoin="Round" stroke="#FF000000" data="F1 M 352.001,191.751L 352.001,207.585" />
                            <path width="8" height="10" stretch="Fill" strokelinejoin="Round" stroke="#FF000000" fill="#FF424040" data="F1 M 320.167,199.918L 336.001,191.918L 336.001,207.918L 320.167,199.918 Z " />
                        </stackpanel>
                    </Button>
                    <Button Width="30" Height="30" Margin="5,0" Name="ButtonBackward" Click="ButtonBackward_Click">
                        <stackpanel orientation="Horizontal">
                            <path width="1" height="10" stretch="Fill" strokelinejoin="Round" stroke="#FF000000" data="F1 M 352.001,191.751L 352.001,207.585" />
                            <path width="8" height="10" stretch="Fill" fill="#FF000000" data="F1 M 320.001,207.96L 336.001,191.835L 336.001,224.085L 320.001,207.96 Z " />
                            <path width="8" height="10" stretch="Fill" fill="#FF000000" data="F1 M 335.917,208.044L 352.001,191.835L 351.917,224.085L 335.917,208.044 Z " />
                        </stackpanel>
                    </Button>
                    <!--<Button Width="30" Height="30" Margin="5,0" Name="ButtonPlayPause" Click="ButtonPlayPause_Click">
                        <path width="12" height="15" stretch="Fill" fill="#FF000000" data="F1 M 352.17,191.918L 384.667,207.876L 352.001,224.085L 352.17,191.918 Z " />
                    </Button>-->
                    <togglebutton width="30" height="30" margin="5,0" name="ButtonPlayPause">
                                  Checked="ButtonPlayPause_Checked" Unchecked="ButtonPlayPause_Unchecked">
                        <path width="12" height="15" stretch="Fill" fill="#FF000000" data="F1 M 352.17,191.918L 384.667,207.876L 352.001,224.085L 352.17,191.918 Z " />
                    </togglebutton>
                    <Button Width="30" Height="30" Margin="5,0" Name="ButtonFastForward" Click="ButtonFastForward_Click">
                        <stackpanel orientation="Horizontal">
                            <path width="8" height="10" stretch="Fill" strokelinejoin="Round" stroke="#FF000000" fill="#FF424040" data="F1 M 352.001,199.772L 336.001,191.752L 336.001,207.752L 352.001,199.772 Z " />
                            <path width="8" height="10" stretch="Fill" strokelinejoin="Round" stroke="#FF000000" fill="#FF424040" data="F1 M 335.917,199.772L 320.001,191.793L 320.084,207.752L 335.917,199.772 Z " />
                            <path width="1" height="10" stretch="Fill" strokelinejoin="Round" stroke="#FF000000" data="F1 M 352.001,191.751L 352.001,207.585" />
                        </stackpanel>
                    </Button>
                    <Button Width="30" Height="30" Margin="5,0" Name="ButtonNext" Click="ButtonNext_Click">
                        <stackpanel orientation="Horizontal">
                            <path width="8" height="10" stretch="Fill" strokelinejoin="Round" stroke="#FF000000" fill="#FF424040" data="F1 M 352.001,199.772L 336.001,191.752L 336.001,207.752L 352.001,199.772 Z " />
                            <path width="1" height="10" stretch="Fill" strokelinejoin="Round" stroke="#FF000000" data="F1 M 352.001,191.751L 352.001,207.585" />
                        </stackpanel>
                    </Button>
                    <slider width="100" margin="5,0" verticalalignment="Center" name="SliderVolume" maximum="100" autotooltipplacement="TopLeft" tickfrequency="10" tickplacement="BottomRight">
                        <slider.value>
                            <binding elementname="MediaElementSelectedMedia" path="Volume" converter="{StaticResource ConvertVolume}" />
                        </slider.value>
                    </slider>
                </stackpanel>
            </stackpanel>

            <grid grid.row="2">
                <grid.columndefinitions>
                    <columndefinition />
                    <columndefinition />
                    <columndefinition />
                </grid.columndefinitions>

                <Button Width="70" Height="25" Name="ButtonCopyFiles" Click="ButtonCopyFiles_Click">Copy</Button>
                <Button Width="70" Height="25" Grid.Column="1" Name="ButtonCut" Click="ButtonCut_Click">Cut</Button>
            </grid>

            <grid grid.row="3" margin="5">
                <groupbox>
                    <groupbox.header>
                        <textblock fontweight="Bold" margin="2,0">If same file name already exists</textblock>
                    </groupbox.header>

                    <stackpanel orientation="Horizontal">
                        <radiobutton margin="10" name="RadioButtonRename">Rename</radiobutton>
                        <radiobutton margin="10" name="RadioButtonReplace">Replace</radiobutton>
                        <radiobutton margin="10" name="RadioButtonIgnore">Ignore</radiobutton>
                    </stackpanel>
                </groupbox>
            </grid>

            <grid grid.row="4">
                <mediaelement visibility="Collapsed" name="MediaElementSelectedMedia" loadedbehavior="Manual" volume="0.5" mediaended="MediaElementSelectedMedia_MediaEnded" mediaopened="MediaElementSelectedMedia_MediaOpened"></mediaelement>
            </grid>
        </grid>

        <grid grid.column="1">
            <grid.rowdefinitions>
                <rowdefinition height="30" />
                <rowdefinition />
            </grid.rowdefinitions>

            <stackpanel orientation="Horizontal">
                <textblock fontweight="Bold" verticalalignment="Center" horizontalalignment="Stretch" margin="15,0,5,0">Search:</textblock>
                <textbox verticalalignment="Center" horizontalalignment="Stretch" margin="5,0,5,0" name="TextBoxSearch" minwidth="200" textchanged="TextBoxSearch_TextChanged"></textbox>
            </stackpanel>

            <listview virtualizingstackpanel.isvirtualizing="True" virtualizingstackpanel.virtualizationmode="Recycling">
                Grid.Row="1" Margin="10" Name="ListViewFiles" removed="LightGray" IsSynchronizedWithCurrentItem="True">
                <listview.itemcontainerstyle>
                    <Style TargetType="ListViewItem">
                        <setter property="Padding" value="0,3" />
                        <setter property="HorizontalContentAlignment" value="Stretch" />
                        <eventsetter event="MouseDoubleClick" handler="PlayCurrentSelectedItem" />
                    </Style>
                </listview.itemcontainerstyle>
                <listview.itemssource>
                    <binding />
                </listview.itemssource>
                <listview.contextmenu>
                    <contextmenu>
                        <menuitem header="Check All" name="ListViewMenuItemCheckAll" click="ListViewMenuItemCheckAll_Click" />
                        <menuitem header="Check All Selected" name="ListViewMenuItemCheckAllSelected" click="ListViewMenuItemCheckAllSelected_Click" />
                        <separator />
                        <menuitem header="Clear All" name="ListViewMenuItemClearAll" click="ListViewMenuItemClearAll_Click" />
                        <menuitem header="Clear All Selected" name="ListViewMenuItemClearAllSelected" click="ListViewMenuItemClearAllSelected_Click" />
                    </contextmenu>
                </listview.contextmenu>
                <listview.view>
                    <gridview>
                        <gridviewcolumn>
                            <gridviewcolumn.header>
                                <textblock fontweight="Bold" padding="120,0">
                                           HorizontalAlignment="Stretch" Name="TextBlockHeaderFileName">File Name</textblock>
                            </gridviewcolumn.header>

                            <gridviewcolumn.celltemplate>
                                <datatemplate>
                                    <stackpanel orientation="Horizontal" verticalalignment="Center">
                                        <Image Width="16" Height="16">
                                            <Image.Source>
                                                <binding path="FilePath" converter="{StaticResource ConvertToImage}" />
                                            </Image.Source>
                                        </Image>
                                        <textblock horizontalalignment="Left" verticalalignment="Center" padding="5,0" width="260">
                                            <textblock.text>
                                                <binding path="FilePath" converter="{StaticResource ConvertToFileName}" />
                                            </textblock.text>
                                            <textblock.tooltip>
                                                <binding path="FilePath" />
                                            </textblock.tooltip>
                                            <textblock.maxwidth>
                                                <binding elementname="TextBlockHeaderFileName" path="Width" />
                                            </textblock.maxwidth>
                                        </textblock>
                                    </stackpanel>
                                </datatemplate>
                            </gridviewcolumn.celltemplate>
                        </gridviewcolumn>

                        <gridviewcolumn>
                            <gridviewcolumn.header>
                                <textblock fontweight="Bold" padding="15,0">
                                           HorizontalAlignment="Stretch">Select</textblock>
                            </gridviewcolumn.header>
                            <gridviewcolumn.celltemplate>
                                <datatemplate>
                                    <grid horizontalalignment="Center">
                                        <checkbox>
                                            <checkbox.ischecked>
                                                <binding path="Selected" />
                                            </checkbox.ischecked>
                                        </checkbox>
                                    </grid>
                                </datatemplate>
                            </gridviewcolumn.celltemplate>
                        </gridviewcolumn>
                    </gridview>
                </listview.view>
            </listview>
        </grid>

        <statusbar grid.row="1" grid.columnspan="2">
            <textblock name="TextBlockStatus" fontweight="Bold" horizontalalignment="Left" verticalalignment="Center" />
            <textblock name="TextBlockCurrentFile" fontweight="Bold" horizontalalignment="Left" verticalalignment="Center" />
        </statusbar>
    </grid>
</window>


how I can fix it?

thanks
Posted
Updated 9-Aug-15 2:15am
v4
Comments
Jochen Arndt 9-Aug-15 8:17am    
I have added code block formatting. For some reason using HTML / XML formatting does not work. So I have choosen plain text which looks at least better than the original post.

1 solution

If that is exact XAML (note that it is XAML not XML) then Visual Studio would not load it. Error message may be, "Invalid Markup".

Window is the actual control, not window. The markup is case-sensitive (unlike HTML).

XML
<Window x:Class="SelectionMaker.Window1">
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:cv="clr-namespace:SelectionMaker"
    xmlns:wf="clr-namespace:System.Windows.Forms;assembly=System.Windows.Forms"
    Title="Selection Maker" Height="600" Width="800" 
    WindowStartupLocation="CenterScreen"  
    Loaded="Window_Loaded" Removed="LightGray" Closing="Window_Closing" 
    Activated="Window_Activated">
</window>


What is that Removed attribute? Maybe that would also cause a trouble with this valid markup. You may want to learn Windows Presentation Foundation[^] from beginning.
 
Share this answer
 
v2
Comments
[no name] 9-Aug-15 9:33am    
Is it not like this that xml defines the syntax and xaml uses the syntax and adds some grammar? Just a question from a beginner.
Afzaal Ahmad Zeeshan 9-Aug-15 9:36am    
Indeed, XML is the base of XAML. But, XAML has some of its own characteristics. XML is a base for HTML too, which is case-insensitive. However XAML on other hand is case-sensitive. That is the problem.
[no name] 9-Aug-15 9:44am    
Wow, thank you very much for this Information. But XML itself is also case-sensitive or am I wrong?
[Edit]
Just recognized, I mixed up the things. Sorry.
Afzaal Ahmad Zeeshan 9-Aug-15 10:47am    
No worries. Everyone makes mistakes, glad you made it to the right side. :-)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900