[ wex-alpha @ 22.11.2011. 14:23 ] @
Pokusavam da parsiram window u runtime. Kod za parsiranje Code: Window window = null; using (FileStream fs = new FileStream("MyWindow.xaml", FileMode.Open, FileAccess.Read)) { // Get the root element, which we know is a Window window = (Window)XamlReader.Load(fs); // puca ovdje greska na kraju koda } window.ShowDialog(); //greska 'Class' attribute does not exist in XML namespace 'http://schemas.microsoft.com/winfx/2006/xaml' namespace. Line '1' Position '9'. Kod samog XAML-a koji se parsira (nalazi se u fajlu) Code: <Window x:Class="WpfApplication1.MyWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MyWindow" Height="300" Width="300"> <Grid> <Button Content="Button" Height="23" HorizontalAlignment="Left" Margin="78,57,0,0" Name="button1" VerticalAlignment="Top" Width="75" /> <Label Content="BINGO" Height="28" HorizontalAlignment="Left" Margin="90,98,0,0" Name="label1" VerticalAlignment="Top" Width="107" /> </Grid> </Window> Kod MainWindows XAML-a koji se pokrece na startu aplikacije Code: <Window x:Class="WpfApplication1.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" Height="350" Width="525"> <Grid> <Button Content="Button" Height="23" HorizontalAlignment="Left" Margin="66,50,0,0" Name="button1" VerticalAlignment="Top" Width="75" Click="button1_Click" /> </Grid> </Window> Vjerujem da je neka gkupost oko namespace, ali nikako da provalim :) |