Questions tagged [xamlreader]
XamlReader Class reads XAML input and creates an object graph, using the WPF default XAML reader and an associated XAML object writer.
xamlreader
107
questions
0
votes
0
answers
35
views
In .NET 9, serialization of style using XamlWriter and XamlReader throws exception
In .NET 9, serialization and deserialization of style using XamlWriter and XamlReader throws exception. But in .NET 8 and other framework versions, it works fine. Please find the code below.
In .NET 9,...
0
votes
0
answers
101
views
WPF - XamlParseException using Xaml.Parse on Xaml file with custom user control type reference
I am parsing an external Xaml file at runtime using Xaml.Parse, but I am getting the following exception:
System.Windows.Markup.XamlParseException failed to create TargetType from local:DemoElement.
...
8
votes
1
answer
2k
views
Interaction triggers inside DataTemplate not working with XamlReader
I'm trying to parse with XamlReader.Load() a DataTemplate (for a WPF datagrid) created dynamically in code behind :
DataTemplate dataTemplate;
StringReader template = new StringReader($@"
<...
0
votes
1
answer
228
views
Weird Behaviour of XamlReader.Load() function
I want to create wpf controls using xml literals and xamlreader.load(). But I'm stuck trying to load xml literals containing property element notation because it keeps throwing the XamlParseException &...
0
votes
1
answer
384
views
How can I deserialize and load serialized XAML UI Elements?
My application has a feature which involves saving some UI Elements that have been creating in order to recreate them the next time the user launches the application.
To do so, it saves The UI Element ...
2
votes
0
answers
121
views
How to Read Xaml Content in WPF application and fetch all the UI Control attributes [duplicate]
I'm trying to read the property of a particular element in XAML file, For that I'm using StreamReader(from System.IO). To get the root element I'm using instance of XmlDocument(from System.Xml). After,...
0
votes
1
answer
96
views
WPF - cannot parse TextBlock element from string
I'm new in WPF
I need to get string param, create an UIElement and attach it to the view.
Parsing the element from the string is failed, I don't know why.
Here is the code:
public void ...
-1
votes
1
answer
78
views
Elements loaded via XamlReader() and from MainWindow.Xaml behave differently?
I have the following Viewbox in MainWindow.Xaml:
<Viewbox x:Name="R1C1Viewbox" Grid.Row="1" Grid.Column="2"
Grid.ColumnSpan="1" Grid.RowSpan="1">
&...
0
votes
0
answers
218
views
Trying to load Xaml element(s) at runtime using Xamlreader
This is my C#, it appears to load the Xaml just fine, all the children are in R1C3Viewbox as well as the data they contain. But nothing displays on screen.
ParserContext context = new ParserContext();...
0
votes
0
answers
924
views
How to load XAML with images using XamlReader.Load method?
Is it possible to load XAML file with images from stream into WPF
application?
And how to store this images in the files?
I've tried <x:code> part, but XamlReader.Load method can't process it.
...
0
votes
1
answer
108
views
How to access a control added from C# by name
I have added a content Control containing a telerik Chart which i have named bob.
I have used xamlReader.parse to build the content control and then place it onto a canvas.
I now want to access the ...
0
votes
1
answer
346
views
Why does data binding on a dynamically loaded control break?
Currently I'm designing an application that should at one point be able to create a report from a Xaml template File using Data Binding (involving a FlowDocument).
The idea was to simply convert a ...
0
votes
0
answers
77
views
Add textblock dynamically in c#
My code belows throw a null reference exception
// Create a string
String sb = "<TextBlock xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation' Text=\"Name (as per IC)\" ...
-1
votes
1
answer
99
views
How to create textblock in controller with XAMLReader
I want to create a textblock in controller with XAML code. Is it possible to do with this? Any other idea?
// Create a string
String sb = "<TextBlock Name='NameLabel' ...
1
vote
1
answer
84
views
How can I validate an attribute value in custom XAML supplied by the user?
My app allows users to put some custom XAML markup into a textbox. When my app loads I use XamlReader.Parse to load the tree. I then overwrite some Resources in my MergedDictionaries with these custom ...