XamlParseException on window initialization - c#

I am getting this error when I go to open my WPF window and I have no idea what created the error or how to get rid of it. The error is highlighting and pointing to </Border> at the bottom.
'Initialization of 'Outlook_Add_In_Test.WPFExiEvent' threw an exception.' Line number '91' and line position '11'.
My WPF Code:
<Controls:MetroWindow x:Class="Outlook_Add_In_Test.WPFExiEvent"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:Controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
xmlns:System="clr-namespace:System;assembly=mscorlib"
mc:Ignorable="d" d:DesignWidth="550" MaxHeight="640" MaxWidth="550" Title="Search for an Existing Event" ResizeMode="NoResize" WindowStartupLocation="CenterScreen" Height="340" HorizontalAlignment="Center" VerticalAlignment="Center">
<Controls:MetroWindow.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Colours.xaml" />
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml" />
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml" />
<ResourceDictionary Source="Theme/Test.xaml" />
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseLight.xaml" />
<ResourceDictionary Source="Theme/FlatButton.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Controls:MetroWindow.Resources>
<Border BorderBrush="Black" BorderThickness="1">
<Grid Margin="0,0,0,-1">
<Border BorderBrush="Black" BorderThickness="1" HorizontalAlignment="Left" Height="1" Margin="6,108,0,0" VerticalAlignment="Top" Width="524" Opacity="0.2" RenderTransformOrigin="0.5,0.5">
<Border.RenderTransform>
<TransformGroup>
<ScaleTransform ScaleY="-1"/>
<SkewTransform/>
<RotateTransform/>
<TranslateTransform/>
</TransformGroup>
</Border.RenderTransform>
</Border>
<Image x:Name="ImgDefactoLogo" HorizontalAlignment="Left" Height="36" Margin="10,10,0,0" VerticalAlignment="Top" Width="43" Source="Images/DeFactoERP.ico"/>
<Image x:Name="ImgAttachmentType" HorizontalAlignment="Left" Margin="65,10,0,0" Width="32" RenderTransformOrigin="0.143,0.778" Height="36" VerticalAlignment="Top"/>
<Label Content="Search for an Existing Event" HorizontalAlignment="Left" Height="36" Margin="97,19,0,0" VerticalAlignment="Top" Width="259" FontSize="16" FontFamily="Arial" FontWeight="Bold"/>
<TextBlock x:Name="LblInfo" HorizontalAlignment="Left" Height="47" Margin="10,60,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="524" FontSize="15" FontFamily="Arial" Text="Please search for an existing event in your De Facto ERP system that you want to use for adding the attachment to."/>
<Label Content="Event No:" HorizontalAlignment="Left" Height="43" Margin="7,126,0,0" VerticalAlignment="Top" Width="112" FontSize="16" FontFamily="Arial" FontWeight="Bold" Foreground="Black"/>
<Label Content="Event Subject:" HorizontalAlignment="Left" Height="43" Margin="7,164,0,0" VerticalAlignment="Top" Width="119" FontSize="16" FontFamily="Arial" FontWeight="Bold"/>
<TextBox x:Name="TxtEventNo" HorizontalAlignment="Left" Height="33" Margin="151,126,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="200" ToolTip="Enter Event Number..." KeyDown="TxtEventNo_KeyDown" TextChanged="TxtEventNo_TextChanged"/>
<TextBox x:Name="TxtSubject" HorizontalAlignment="Left" Height="33" Margin="151,164,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="200" KeyDown="TxtSubject_KeyDown" TextChanged="TxtSubject_TextChanged"/>
<Label Content="Event Customer:" HorizontalAlignment="Left" Height="43" Margin="7,202,0,0" VerticalAlignment="Top" Width="142" FontSize="16" FontFamily="Arial" FontWeight="Bold"/>
<TextBox x:Name="TxtCust" HorizontalAlignment="Left" Height="33" Margin="342,22,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="200" ToolTip="Enter Event Number..." TextChanged="TxtCust_TextChanged" KeyDown="TxtCust_KeyDown"/>
<CheckBox x:Name="ChkActive" Content="Active Events Only" IsChecked="True" HorizontalAlignment="Left" Height="19" Margin="13,238,0,0" VerticalAlignment="Top" Width="124" Checked="ChkActive_Checked" Unchecked="ChkActive_UnChecked"/>
<Border BorderBrush="Black" BorderThickness="1" HorizontalAlignment="Left" Height="1" Margin="7,267,0,0" VerticalAlignment="Top" Width="524" Opacity="0.2" RenderTransformOrigin="0.5,0.5">
<Border.RenderTransform>
<TransformGroup>
<ScaleTransform ScaleY="-1"/>
<SkewTransform/>
<RotateTransform/>
<TranslateTransform/>
</TransformGroup>
</Border.RenderTransform>
</Border>
<Button x:Name="BtnSearch" Click="BtnSearch_Click" HorizontalAlignment="Left" Width="100" Background="#FF333333" Foreground="White" FontWeight="Normal" FontSize="14" Margin="422,162,0,0" Height="37" VerticalAlignment="Top">
<TextBlock Text="SEARCH" VerticalAlignment="Center" TextAlignment="Right" FontSize="14" Width="73" Height="15" FontFamily="Arial" Foreground="White" RenderTransformOrigin="0.684,0.261"/>
</Button>
<ListBox x:Name="LstEvents" HorizontalAlignment="Left" Margin="10,300,0,14" Width="524" BorderBrush="Black" BorderThickness="2,2,1,1">
<ListBox.ItemTemplate>
<DataTemplate>
<Grid Height="97">
<Canvas x:Name="EventItem" HorizontalAlignment="Left" Height="97" VerticalAlignment="Top" Width="502" Background="{Binding LBackground}" Margin="0,0,0,-21">
<Label Content="Event:" HorizontalAlignment="Left" Height="33" VerticalAlignment="Top" Width="97" FontWeight="Bold" FontSize="14" Canvas.Left="1" Canvas.Top="2"/>
<Label Content="Subject:" HorizontalAlignment="Left" Height="33" VerticalAlignment="Top" Width="97" FontWeight="Bold" FontSize="14" Canvas.Left="1" Canvas.Top="23"/>
<Label Content="Body:" HorizontalAlignment="Left" Height="33" VerticalAlignment="Top" Width="97" FontWeight="Bold" FontSize="14" Canvas.Left="1" Canvas.Top="47"/>
<Button x:Name="BtnSelectEvent" Content="Select" HorizontalAlignment="Left" Height="34" VerticalAlignment="Top" Width="74" Background="#FF333333" Foreground="White" FontWeight="Normal" FontSize="14" Canvas.Left="418" Canvas.Top="33" Click="BtnSelectEvent_Click"/>
<Label Content="{Binding Lsubject}" Height="25" Canvas.Left="80" Canvas.Top="3" Width="333"/>
<Label Content="{Binding Lbody}" Height="25" Canvas.Left="80" Canvas.Top="25" Width="333"/>
<Label Content="{Binding Lbody}" Height="25" Canvas.Left="80" Canvas.Top="49" Width="333"/>
<Label Content="Customer:" HorizontalAlignment="Left" Height="33" VerticalAlignment="Top" Width="97" FontWeight="Bold" FontSize="14" Canvas.Left="1" Canvas.Top="69"/>
<Label Content="{Binding LCust}" Height="25" Canvas.Left="80" Canvas.Top="71" Width="333"/>
</Canvas>
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<Label x:Name="LblResultsReturned" Content="" HorizontalAlignment="Left" Height="27" Margin="37,273,0,-19" VerticalAlignment="Top" Width="492" FontWeight="Bold" FontFamily="Arial" FontSize="11" />
<Label x:Name="LblEventCount" Content="" HorizontalAlignment="Left" Height="27" Margin="10,273,0,-19" VerticalAlignment="Top" FontWeight="Bold" FontFamily="Arial" FontSize="11" />
<Image x:Name="ImgSearch" HorizontalAlignment="Left" Height="28" Margin="431,171,0,0" VerticalAlignment="Top" Width="22" Source="Images/Icon-Search-Big-White.png" RenderTransformOrigin="0.419,1.269"/>
<Label x:Name="LblError" Content="" HorizontalAlignment="Left" Height="27" Margin="199,273,0,-19" VerticalAlignment="Top" Width="330" FontWeight="Bold" FontFamily="Arial" FontSize="11" />
<Controls:ProgressRing x:Name="LoadingRing" IsActive="False" Margin="356,153,126,0" VerticalAlignment="Top"/>
</Grid>
</Border>
</Controls:MetroWindow>

Going on what you said in the comments it seems it is linked to the MahApps Metro Theme.
Take a look at this: https://github.com/MahApps/MahApps.Metro/issues/582
If you have referenced the Windows Interactivity dll try removing it.
In future remember to check the InnerException like SLaks said. You can learn a lot more from this and give you more to work on.

Maybe for someone it will be useful. Today I ran into the same problem:
"XamlParseException on window initialization" in project with nuget reference to MahApp.
I tryed reinstaling packages, removing references - nothithing helped.
In may case the problem was in app.config. When I removed these lines, problem disappeared:
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Windows.Interactivity" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.5.0.0" newVersion="4.5.0.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
Does anyone know why this happens?

I think you just imported the wrong dll (NET40). Try to import the latest MahApps.Metro.dll (NET45).
It worked for me.

For me, I downgraded the MahApps.Metro to version 1.6.4 and the error has gone
I was using version 1.6.5 before
And the version of MahApps.Metro.Resources is 0.6.1

Related

Windows Phone 8.1 C# Can´t acces textbox from a Hubselection

I´m working on a Windows Phone 8.1 c# app.
I´m trying to acces a textbox that is inside a tab page of a Hub. But whatever i do i can´t acces the textbox in the MainPage.xaml.cs code. Can anyone tell me why?
Here is my XAML code:
<Grid>
<Hub x:Name="Hub" Header="My Buddy!" Background="#FF303030">
<HubSection Tag="0" x:Name="HubSelection" Header="Hoofdscherm">
<DataTemplate>
<Grid>
<Button x:Name="btnAgenda" Content="Agenda" HorizontalAlignment="Left" Margin="20,17,0,0" VerticalAlignment="Top" Height="140" Width="140" RenderTransformOrigin="0.5,0.5" BorderBrush="White" Background="#FFD13535" Foreground="White" Click="btnAgenda_Click"/>
<Button x:Name="btnTaken" Content="Taken" HorizontalAlignment="Right" Margin="0,17,20,0" VerticalAlignment="Top" Height="140" Width="140" RenderTransformOrigin="0.5,0.5" BorderBrush="White" Background="#FFD13535" Foreground="White" Click="btnTaken_Click"/>
<Button x:Name="btnNieuweAfspraak" Content="Nieuwe afspraak" HorizontalAlignment="Left" Margin="20,161,0,0" VerticalAlignment="Top" Height="140" Width="140" RenderTransformOrigin="0.5,0.5" BorderBrush="White" Background="#FFD13535" Foreground="White" Click="btnNieuweAfspraak_Click"/>
<Button x:Name="btnNieuweTaak" Content="Nieuwe taak" HorizontalAlignment="Right" Margin="0,161,20,0" VerticalAlignment="Top" Height="140" Width="140" RenderTransformOrigin="0.5,0.5" BorderBrush="White" Background="#FFD13535" Foreground="White" Click="btnNieuweTaak_Click"/>
</Grid>
</DataTemplate>
</HubSection>
<HubSection Tag="1" Header="Agenda">
<DataTemplate>
<Grid>
<AppBarButton HorizontalAlignment="Left" Icon="Add" Label="Nieuwe afspraak" Margin="6,419,-2,0" VerticalAlignment="Top" Height="81" Width="337" Click="AppBarButton_Click"/>
</Grid>
</DataTemplate>
</HubSection>
<HubSection Tag="2" Header="Taken">
<DataTemplate>
<Grid>
<AppBarButton HorizontalAlignment="Left" Icon="Add" Label="Nieuwe taak" Margin="6,419,-2,0" VerticalAlignment="Top" Height="81" Width="337" Click="AppBarButton_Click_1" FontFamily="Global User Interface"/>
</Grid>
</DataTemplate>
</HubSection>
<HubSection Tag="3" x:Name="NewAfspraak" Header="Nieuwe afspraak">
<DataTemplate>
<Grid>
<TextBox x:Name="AfspraakBox" HorizontalAlignment="Left" Margin="10,10,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="321" Height="47" PlaceholderText="Naam afspraak" TextChanged="AfspraakBox_TextChanged" IsColorFontEnabled="False"/>
<DatePicker x:Name="DatumAfspraak" HorizontalAlignment="Left" Margin="10,52,0,0" VerticalAlignment="Top" Height="55" Width="157"/>
<TimePicker x:Name="BegintijdAfspraak" HorizontalAlignment="Left" Margin="172,52,0,0" VerticalAlignment="Top" Height="53" Width="159"/>
<TextBox x:Name="tbLocatieAfspraak" HorizontalAlignment="Left" Margin="10,106,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="321" PlaceholderText="Locatie" Height="42"/>
<TextBox HorizontalAlignment="Left" Margin="10,165,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Height="255" Width="321" PlaceholderText="Omschrijving"/>
<Button x:Name="btnAfspraakOpslaan1" Content="Opslaan" HorizontalAlignment="Left" Margin="172,436,0,0" VerticalAlignment="Top" RenderTransformOrigin="0.5,0.5" Width="159" Height="63" Click="btnAfspraakOpslaan1_Click"/>
<Button x:Name="btnAfspraakOpslaan" Content="Annuleren" HorizontalAlignment="Left" Margin="10,436,0,0" VerticalAlignment="Top" RenderTransformOrigin="0.5,0.5" Width="157" Height="63" Click="btnAfspraakAnnuleren_Click"/>
</Grid>
</DataTemplate>
</HubSection>
<HubSection Tag="4" Header="Nieuwe taak">
<DataTemplate>
<Grid>
<TextBox x:Name="TbNaamTaak" HorizontalAlignment="Left" Margin="10,10,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="321" Height="47" PlaceholderText="Naam taak"/>
<TextBox x:Name="tbTaakOmschrijving" HorizontalAlignment="Left" Margin="10,168,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="321" Height="254" PlaceholderText="Omschrijving"/>
<TextBlock HorizontalAlignment="Left" Margin="172,62,0,0" TextWrapping="Wrap" Text="Eindtijd:" VerticalAlignment="Top" Height="14" Width="54"/>
<TextBlock HorizontalAlignment="Left" Margin="10,62,0,0" TextWrapping="Wrap" Text="Begintijd:" VerticalAlignment="Top" Height="14" Width="98"/>
<TimePicker x:Name="BegintijdNieuweTaak" HorizontalAlignment="Left" Margin="10,71,0,0" VerticalAlignment="Top" Width="157" Height="55" ToolTipService.ToolTip="Selecteer een begintijd:" FontFamily="Global User Interface"/>
<TimePicker x:Name="EindtijdNieuweTaak" HorizontalAlignment="Left" Margin="172,71,0,0" VerticalAlignment="Top" Width="159" Height="53" ToolTipService.ToolTip="Selecteer een eindtijd:"/>
<Button x:Name="btnTaakOpslaan" Content="Opslaan" HorizontalAlignment="Left" Margin="172,436,0,0" VerticalAlignment="Top" RenderTransformOrigin="0.5,0.5" Width="159" Height="63" FontFamily="Global User Interface" Click="btnTaakOpslaan_Click"/>
<Button Content="Annuleren" HorizontalAlignment="Left" Margin="10,436,0,0" VerticalAlignment="Top" RenderTransformOrigin="0.5,0.5" Width="157" Height="63" Click="btnTaakAnnuleren" FontFamily="Global User Interface"/>
<DatePicker x:Name="DatumNieuweTaak" HorizontalAlignment="Left" Margin="10,114,0,0" VerticalAlignment="Top" Height="81" Width="321" FontFamily="Global User Interface"/>
</Grid>
</DataTemplate>
</HubSection>
</Hub>
</Grid>
And my MainPage.xaml.cs code:
private void btnTaken_Click(object sender, RoutedEventArgs e)
{
String Test = AfspraakBox.text;
Hub.ScrollToSection(Hub.Sections[2]);
}
The error that i'm getting is:
AfspraakBox does not exist in the current context.
I'm pritty sure it has something to do with the Hubs. Because in a new project without a Hub it just works fine. But i just can't figure out why and how to fix it.
You can't access a XAML control inside of a DataTemplate. That's a problem of HubSections. It uses DataTemplate, unlike PivotItem.

WPF Fit window size

I am new into WPF and i am developing a app with different images, textbox, etc. The problem is here on my screen it all looks ok according to the size of the window with the properties ive set on the window loaded:
private void Window_Loaded(object sender, RoutedEventArgs e)
{
Width = System.Windows.SystemParameters.PrimaryScreenWidth;
Height = System.Windows.SystemParameters.PrimaryScreenHeight;
}
When using the application on my screen it looks like this:
But when using it on a tablet i cant see the Calendar neither the text that says "Fecha nacimiento". Here is the WPF code i am using:
<Window x:Class="BiometricoRegistro.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="RegistrarCliente" Height="978" Width="1600" Loaded="Window_Loaded" WindowState="Maximized">
<Grid>
<Grid.Background>
<ImageBrush ImageSource="Imagenes\home_bg.jpg"/>
</Grid.Background>
<TextBox x:Name="txtbRut" HorizontalAlignment="Left" Height="51" TextWrapping="Wrap" BorderBrush="Transparent" VerticalAlignment="Top" Width="379" Margin="30,230,0,0" FontSize="35" FontWeight="Bold" PreviewTextInput="txtbRut_PreviewTextInput">
<TextBox.Background>
<ImageBrush ImageSource="Imagenes\input.png"/>
</TextBox.Background>
</TextBox>
<TextBox x:Name="txtbRutVer" HorizontalAlignment="Left" Height="51" TextWrapping="Wrap" BorderBrush="Transparent" VerticalAlignment="Top" Width="74" Margin="430,230,0,0" FontSize="35" FontWeight="Bold" TextAlignment="Center">
<TextBox.Background>
<ImageBrush ImageSource="Imagenes\input.png"/>
</TextBox.Background>
</TextBox>
<TextBox x:Name="txtbNombre" HorizontalAlignment="Left" Height="51" TextWrapping="Wrap" BorderBrush="Transparent" VerticalAlignment="Top" Width="474" Margin="30,330,0,0" FontSize="35" FontWeight="Bold">
<TextBox.Background>
<ImageBrush ImageSource="Imagenes\input.png"/>
</TextBox.Background>
</TextBox>
<TextBox x:Name="txtbApellido" HorizontalAlignment="Left" Height="51" TextWrapping="Wrap" BorderBrush="Transparent" VerticalAlignment="Top" Width="474" Margin="30,430,0,0" FontSize="35" FontWeight="Bold">
<TextBox.Background>
<ImageBrush ImageSource="Imagenes\input.png"/>
</TextBox.Background>
</TextBox>
<TextBox x:Name="txtbEmail" HorizontalAlignment="Left" Height="51" TextWrapping="Wrap" BorderBrush="Transparent" VerticalAlignment="Top" Width="474" Margin="30,530,0,0" FontSize="35" FontWeight="Bold">
<TextBox.Background>
<ImageBrush ImageSource="Imagenes\input.png"/>
</TextBox.Background>
</TextBox>
<Calendar x:Name="calendar" HorizontalAlignment="Left" Height="170" VerticalAlignment="Top" Width="260" Margin="0,720,0,57"/>
<Button x:Name="btnRegistrar" Content="Registrar" HorizontalAlignment="Center" Height="118" VerticalAlignment="Center" Width="296" Margin="775,0,221,100" Click="btnRegistrar_Click"/>
<ComboBox x:Name="cbPorcentaje" HorizontalAlignment="Left" Height="40" Margin="30,630,0,0" VerticalAlignment="Top" Width="230" HorizontalContentAlignment="Center" FontSize="35">
<ComboBoxItem Content="A" FontSize="35"></ComboBoxItem>
<ComboBoxItem Content="B" FontSize="35"></ComboBoxItem>
<ComboBoxItem Content="C" FontSize="35"></ComboBoxItem>
</ComboBox>
<TextBlock HorizontalAlignment="Left" Height="37" Margin="30,176,0,0" TextWrapping="Wrap" Text="Rut cliente" VerticalAlignment="Top" Width="474" FontFamily="/BiometricoRegistro;component/Fonts/#Alex Brush" FontSize="36" Foreground="White"/>
<TextBlock HorizontalAlignment="Left" Height="37" Margin="30,286,0,0" TextWrapping="Wrap" Text="Nombres cliente" VerticalAlignment="Top" Width="474" FontFamily="/BiometricoRegistro;component/Fonts/#Alex Brush" FontSize="36" Foreground="White"/>
<TextBlock HorizontalAlignment="Left" Height="37" Margin="30,386,0,0" TextWrapping="Wrap" Text="Apellidos cliente" VerticalAlignment="Top" Width="474" FontFamily="/BiometricoRegistro;component/Fonts/#Alex Brush" FontSize="36" Foreground="White"/>
<TextBlock HorizontalAlignment="Left" Height="37" Margin="30,486,0,0" TextWrapping="Wrap" Text="Email cliente" VerticalAlignment="Top" Width="474" FontFamily="/BiometricoRegistro;component/Fonts/#Alex Brush" FontSize="36" Foreground="White"/>
<TextBlock HorizontalAlignment="Left" Height="37" Margin="30,586,0,0" TextWrapping="Wrap" Text="Tipo Descuento" VerticalAlignment="Top" Width="474" FontFamily="/BiometricoRegistro;component/Fonts/#Alex Brush" FontSize="36" Foreground="White"/>
<TextBlock HorizontalAlignment="Left" Height="37" Margin="30,678,0,230" TextWrapping="Wrap" Text="Fecha nacimiento" VerticalAlignment="Top" Width="474" FontFamily="/BiometricoRegistro;component/Fonts/#Alex Brush" FontSize="36" Foreground="White"/>
<TextBlock x:Name="txtResult" HorizontalAlignment="Left" Height="64" Margin="501,0,0,57" TextWrapping="Wrap" Text="" VerticalAlignment="Bottom" Width="823" FontSize="46" Foreground="Red" FontFamily="PMingLiU-ExtB"/>
</Grid>
</Window>
Always use appropriate panels . I would prefer Dock and stackpanel with splitters.
assign System.Windows.Window.SizeToContent to System.Windows.SizeToContent.WidthAndHeight.
Use Resource Dictonary for consistency of margins and other values
I would not prefer to use Absolute positions. decide your margin values depending on your content .

Scrollable grid

I have been struggling with making a grid scrollable in my wpf application and the scrollviewer is not working so I need something similar to overflow:scroll in CSS so if anybody could help I would be very grateful
<Grid Margin="12,49,0,54" Name="state_settings" Width="430" Visibility="Hidden" MaxHeight="200" Height="200" HorizontalAlignment="Left" VerticalAlignment="Top">
<ScrollViewer VerticalScrollBarVisibility="Auto" CanContentScroll="True">
<Grid Height="69" HorizontalAlignment="Left" Margin="13,10,0,0" Name="state_comp" VerticalAlignment="Top" Width="406">
<Label Content="Gesture" Height="28" HorizontalAlignment="Left" Margin="6,6,0,0" Name="label1" VerticalAlignment="Top" Width="103" FontWeight="Bold" />
<ComboBox Height="23" HorizontalAlignment="Left" Margin="6,31,0,0" Name="comboBox1" VerticalAlignment="Top" Width="103" />
<TextBox Height="23" HorizontalAlignment="Left" Margin="167,31,0,0" Name="textBox1" VerticalAlignment="Top" Width="27" />
<Label Content="Min Duration" Height="28" HorizontalAlignment="Left" Margin="135,6,0,0" Name="label2" VerticalAlignment="Top" Width="89" FontWeight="Bold" />
<TextBox Height="23" HorizontalAlignment="Left" Margin="258,31,0,0" Name="textBox2" VerticalAlignment="Top" Width="27" />
<TextBox Height="23" HorizontalAlignment="Left" Margin="346,31,0,0" Name="textBox3" VerticalAlignment="Top" Width="36" />
<Label Content="Max Duration" Height="28" HorizontalAlignment="Left" Margin="230,6,0,0" Name="label3" VerticalAlignment="Top" Width="89" FontWeight="Bold" />
<Label Content="Transition" Height="28" HorizontalAlignment="Left" Margin="327,6,0,0" Name="label4" VerticalAlignment="Top" Width="71" FontWeight="Bold" />
</Grid>
</ScrollViewer>
</Grid>
I had to change a few things to make it easier to work with your code... for example, I had to remove the Visibility="Hidden", which was ridiculous of you to keep in your example. I also added a Background colour so that I could see the bounds of the Grid. I moved the ScrollViewer to be the outermost element and removed the unnecessary CanContentScroll property and some Height settings, but apart from that, you almost had it. Try this:
<ScrollViewer VerticalScrollBarVisibility="Auto">
<Grid Name="state_settings" Width="430" MaxHeight="200" Background="LightBlue" HorizontalAlignment="Left" VerticalAlignment="Top">
<Grid Height="69" HorizontalAlignment="Left" Margin="13,10,0,0" Name="state_comp" VerticalAlignment="Top" Width="406">
<Label Content="Gesture" Height="28" HorizontalAlignment="Left" Margin="6,6,0,0" Name="label1" VerticalAlignment="Top" Width="103" FontWeight="Bold" />
<ComboBox Height="23" HorizontalAlignment="Left" Margin="6,31,0,0" Name="comboBox1" VerticalAlignment="Top" Width="103" />
<TextBox Height="23" HorizontalAlignment="Left" Margin="167,31,0,0" Name="textBox1" VerticalAlignment="Top" Width="27" />
<Label Content="Min Duration" Height="28" HorizontalAlignment="Left" Margin="135,6,0,0" Name="label2" VerticalAlignment="Top" Width="89" FontWeight="Bold" />
<TextBox Height="23" HorizontalAlignment="Left" Margin="258,31,0,0" Name="textBox2" VerticalAlignment="Top" Width="27" />
<TextBox Height="23" HorizontalAlignment="Left" Margin="346,31,0,0" Name="textBox3" VerticalAlignment="Top" Width="36" />
<Label Content="Max Duration" Height="28" HorizontalAlignment="Left" Margin="230,6,0,0" Name="label3" VerticalAlignment="Top" Width="89" FontWeight="Bold" />
<Label Content="Transition" Height="28" HorizontalAlignment="Left" Margin="327,6,0,0" Name="label4" VerticalAlignment="Top" Width="71" FontWeight="Bold" />
</Grid>
</Grid>
</ScrollViewer>
You may need to reduce the Height of your Window, or add more items in order to actually see the vertical ScrollBar, but if you do, you should now see that it scrolls.
Your UI with a ScrollBar:

XAMLparse exceoption error

Please I need assistance... My program which i am using c# and post relational database but i keep getting this error it says the xaml parse exception error was unhandled , please where am i going wrong the code is
<Window x:Class="zooSystemWorking.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="442" Width="884" Loaded="Window_Loaded" ResizeMode="NoResize">
<Grid Background="#F2C1D42D" Height="405">
<Image Height="139" HorizontalAlignment="Left" Margin="1,1,0,0" Source="/zooSystemWorking;component/Images/ZooLogo.jpg" Name="image1" Stretch="Fill" VerticalAlignment="Top" Width="104" />
<Border BorderBrush="#FF0A0A09" BorderThickness="1" Height="25" HorizontalAlignment="Left" Margin="6,145,0,0" Name="border1" VerticalAlignment="Top" Width="93" CornerRadius="10" Background="#95005202">
<Button Content="Add Animal" Height="23" Name="addAnimal" Click="addAnimal_Click" Width="87" Background="#95005202" Padding="0" BorderBrush="#95005202" Foreground="#F2C1D42D" />
</Border>
<Border BorderBrush="#FF101010" BorderThickness="1" Height="25" Name="border2" Width="93" Margin="6,185,764,195" CornerRadius="10" Background="#95005202">
<Button Content="View Animal" Height="23" Name="viewAnimal" Click="viewAnimal_Click" Width="86" Background="#95005202" Foreground="#F2C1D42D" />
</Border>
<Border BorderBrush="#FF0A0A09" BorderThickness="1" Height="25" Name="border3" Width="93" Margin="6,227,764,153" CornerRadius="10" Background="#95005202">
<Button Content="Update Animal" Height="23" Name="updateAnimal" Click="updateAnimal_Click" Width="84" Background="#95005202" Foreground="#F2C1D42D" />
</Border>
<Border BorderBrush="#FF0D0D0C" BorderThickness="1" Height="25" Name="border4" Width="93" Margin="6,268,764,112" CornerRadius="10" Background="#95005202">
<Button Content="Archive Animal" Height="23" Name="archiveAnimal" Click="archiveAnimal_Click" Width="84" Background="#95005202" BorderBrush="#95005202" Padding="0" Foreground="#F2C1D42D" />
</Border>
<ContentControl Height="326" HorizontalAlignment="Left" Margin="105,-1,0,0" Name="contentArea" VerticalAlignment="Top" Width="758" />
<Image Height="72" HorizontalAlignment="Left" Margin="1,333,0,0" Name="image2" Source="/zooSystemWorking;component/Images/grass.png" Stretch="Fill" VerticalAlignment="Top" Width="145" />
<Image Height="72" HorizontalAlignment="Left" Margin="142,333,0,0" Name="image3" Source="/zooSystemWorking;component/Images/grass.png" Stretch="Fill" VerticalAlignment="Top" Width="145" />
<Image Height="72" HorizontalAlignment="Left" Margin="286,333,0,0" Name="image4" Source="/zooSystemWorking;component/Images/grass.png" Stretch="Fill" VerticalAlignment="Top" Width="145" />
<Image Height="72" HorizontalAlignment="Left" Margin="429,333,0,0" Name="image5" Source="/zooSystemWorking;component/Images/grass.png" Stretch="Fill" VerticalAlignment="Top" Width="145" />
<Image Height="72" HorizontalAlignment="Left" Margin="572,333,0,0" Name="image6" Source="/zooSystemWorking;component/Images/grass.png" Stretch="Fill" VerticalAlignment="Top" Width="145" />
<Image Height="72" HorizontalAlignment="Left" Margin="717,333,0,0" Name="image7" Source="/zooSystemWorking;component/Images/grass.png" Stretch="Fill" VerticalAlignment="Top" Width="145" />
<Border Background="#95005202" BorderBrush="#FF0D0D0C" BorderThickness="1" CornerRadius="10" Height="25" Margin="6,305,763,75" Name="border5" Width="93">
<Button Background="#95005202" BorderBrush="#95005202" Click="reportGen_Click" Content="Report" Foreground="#F2C1D42D" Height="23" Name="reportGen" Padding="0" Width="84" />
</Border>
</Grid>
</Window>

How to Add Tile Icon in Windows 8 app development?

I started learning Windows 8 app development (I'm a beginner) and I'm making an app where I want to add its tile icon. When I press the window key, then our program exe icon shows as default, but I want to add my own icon. How do I do this?
How do I add an image in this sample code?
<Page
x:Class="Calculator.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Calculator"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Grid Background="Tomato">
<Button x:Name="btn0" Content="0" HorizontalAlignment="Left" Height="64" Margin="458,459,0,0" VerticalAlignment="Top" Width="120" FontSize="36" FontWeight="Bold" Click="showbtn"/>
<Button x:Name="btn1" Content="1" HorizontalAlignment="Left" Height="64" Margin="458,390,0,0" VerticalAlignment="Top" Width="120" FontSize="36" FontWeight="Bold" Click="showbtn"/>
<Button x:Name="btn2" Content="2" HorizontalAlignment="Left" Height="64" Margin="583,390,0,0" VerticalAlignment="Top" Width="120" FontSize="36" FontWeight="Bold" Click="showbtn"/>
<Button x:Name="btn3" Content="3" HorizontalAlignment="Left" Height="64" Margin="708,390,0,0" VerticalAlignment="Top" Width="120" FontSize="36" FontWeight="Bold" Click="showbtn"/>
<Button x:Name="btn4" Content="4" HorizontalAlignment="Left" Height="64" Margin="458,321,0,0" VerticalAlignment="Top" Width="120" FontSize="36" FontWeight="Bold" Click="showbtn"/>
<Button x:Name="btn5" Content="5" HorizontalAlignment="Left" Height="64" Margin="578,321,0,0" VerticalAlignment="Top" Width="120" FontSize="36" FontWeight="Bold" Click="showbtn"/>
<Button x:Name="btn6" Content="6" HorizontalAlignment="Left" Height="64" Margin="708,321,0,0" VerticalAlignment="Top" Width="120" FontSize="36" FontWeight="Bold" Click="showbtn"/>
<Button x:Name="btn7" Content="7" HorizontalAlignment="Left" Height="64" Margin="458,252,0,0" VerticalAlignment="Top" Width="120" FontSize="36" FontWeight="Bold" Click="showbtn"/>
<Button x:Name="btn8" Content="8" HorizontalAlignment="Left" Height="64" Margin="583,252,0,0" VerticalAlignment="Top" Width="120" FontSize="36" FontWeight="Bold" Click="showbtn"/>
<Button x:Name="btn9" Content="9" HorizontalAlignment="Left" Height="64" Margin="708,252,0,0" VerticalAlignment="Top" Width="120" FontSize="36" FontWeight="Bold" Click="showbtn"/>
<TextBox x:Name="Output" HorizontalAlignment="Left" Height="68" Margin="458,179,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="370" FontSize="24"/>
</Grid>
</Page>
You can replace the default tile image with your own logo image with the path in the package .appxmanifest
You can get the guidelines over here http://msdn.microsoft.com/en-us/library/windows/apps/hh465437.aspx
Hope it will solve your problem

Categories

Resources