.NET MAUI: How to add an XAML page as the content of a Syncfusion sfTabItem - xaml

I'm using Syncfusion's sfTabView for my MAUI app and I have the content of all my tabs set as Pages from seperate files to avoid my main page being 1000+ lines long.
The problem is that sfTabItems do not directly support Pages as content so I have them wrapped in a grid, which works in debug mode, but crashes on start if I run it not in debug mode. Is there a workaround for this?
xmlns:views="clr-namespace:MyProject.Views"
xmlns:tabView="clr-namespace:Syncfusion.Maui.TabView;assembly=Syncfusion.Maui.TabView"
<tabView:SfTabView>
<tabView:SfTabView.Items>
<tabView:SfTabItem>
<tabView:SfTabItem.Content> <!-- content does not directly support ContentPages -->
<Grid>
<views:HomePage /> <!-- allowed (in debug) when wrapped in a grid -->
</Grid>
</tabView:SfTabItem.Content>
</tabView:SfTabItem>
</tabView:SfTabView.Items>
</tabView:SfTabView>
The first error in my device log is as follows:
Time Device Name Type PID Tag Message
12-20 11:32:44.439 pixel_5_-_api_29 Error 4343 * Assertion: should not be reached at /__w/1/s/src/mono/mono/mini/mini-exceptions.c:456
Followed by:
Time Device Name Type PID Tag Message
12-20 11:32:44.439 pixel_5_-_api_29 Error 4343 libc Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 4343 (.myproject), pid 4343 (.myproject)

Related

RTI DDS creating own data types

I am working on a .Net example where I define my own data type using RTI Connext DDS.
Instead of creating the application from the beginning, I got help from the source code of the hello_world_xml_dynamic example in rti_workspace directory. I have made several changes to the USER_QOS_PROFILES.xml file to create my own data type and changes its name to MY_PROFILES.xml
But when I compile the application and run it from the command line, I get the following error:
DDS_DomainParticipantFactory_create_participant_from_config_w_paramsI:ERROR: Profile library 'MyParticipantLibrary::PublicationParticipant' not found
! Unable to create DDS domain participant
The line of code that catching the error:
if (this.participant == null)
{
this.participant = DDS.DomainParticipantFactory.get_instance().
create_participant_from_config(
"MyParticipantLibrary::PublicationParticipant");
if (this.participant == null)
{
Console.Error.WriteLine("! Unable to create DDS domain participant");
return;
}
}
this is the configuration file MY_PROFILES.xml :
<!--
RTI Data Distribution Service Deployment
-->
<dds xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://community.rti.com/schema/6.0.1/rti_dds_profiles.xsd">
<!-- Qos Library -->
<qos_library name="qosLibrary">
<qos_profile name="DefaultProfile">
</qos_profile>
</qos_library>
<!-- types -->
<types>
<struct name="FlightData">
<member name="Latitude" type="double"/>
<member name="Longitude" type="double"/>
<member name="Altitude" type="double"/>
</struct>
</types>
<!-- Domain Library -->
<domain_library name="MyDomainLibrary" >
<domain name="FlightDataDomain" domain_id="0">
<register_type name="FlightDataType"
type_ref="FlightData" />
<topic name="FlightDataTopic"
register_type_ref="FlightDataType">
<topic_qos name="FlightData_qos"
base_name="qosLibrary::DefaultProfile"/>
</topic>
</domain>
</domain_library>
<!-- Participant library -->
<domain_participant_library name="MyParticipantLibrary">
<domain_participant name="PublicationParticipant"
domain_ref="MyDomainLibrary::FlightDataDomain">
<publisher name="MyPublisher">
<data_writer name="FlightDataWriter"
topic_ref="FlightDataTopic"/>
</publisher>
</domain_participant>
<domain_participant name="SubscriptionParticipant"
domain_ref="MyDomainLibrary::FlightDataDomain">
<subscriber name="MySubscriber">
<data_reader name="FlightDataReader"
topic_ref="FlightDataTopic">
<datareader_qos name="FlightData_reader_qos"
base_name="qosLibrary::DefaultProfile"/>
</data_reader>
</subscriber>
</domain_participant>
</domain_participant_library>
</dds>
where am i making a mistake?
Your XML file looks correct. From the 'not found' error message, it seems that you may not have taken the right steps to instruct your application to load that profiles-file MY_PROFILES.xml to actually learn about your desired Participant. You can easily verify that this is the case by introducing an error in your XML file (for example by incorrectly renaming one tag) and rerun your application. If it does not complain about the syntax or schema of the XML, then your file did not get loaded and this hypothesis is correct.
If that turns out to be your problem indeed, then you have several options to fix that. They are listed in the User's Manual section 18.5 How to Load XML-Specified QoS Settings.

Robot Framework - Getting a Text of a Div with no ID

I am using robot framework,
I have to verify, that a users name is the same on one page and other page,
There are multiple different users, I need to get the Text of the div the users.
Right now the name is hard coded but when the user dissapears after being assign to something, the test will fail although everything is working,
*** Settings ***
Library SeleniumLibrary
*** Variables ***
${User_Div} = //*[#id="app"]/div/div[1]/div[3]/div/div/div[1]/div[2]/div/div[1]
${User_Name} = John Doe
*** Keywords ***
//..more code here irelevant..//
Validate User Name
Click Element ${Resident_Div}
page should contain ${Resident_Name}
This is the value of the div
<span><!-- react-text: 116 -->John<!-- /react-text --><!-- react-text: 117 --> <!-- /react-text --><!-- react-text: 118 -->Doe<!-- /react-text --></span>
What I am trying to do is Get the text of ${User_Div} on load of the div and store it in this variable, to verify the next page contains the same page.
Note: The web app is designed with react, there is ID on the div.
Update:
I will try to make it clearer here
Look for ${User_Div}
Get Text value of ${User_Div}
Assign text value of ${User_Div} to ${User_Name}
the outcome should be ${User_Name} == ${User_Div} text

Xamarin Forms XamlParseException Class not found in clr-namespace

I recently purchased Grialkit and was creating a simple walkthrough for an app that I'm developing.
I'm following the examples that are included in my grialkit.
I have a page, called WalkthroughPage. The XAML of this page looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<CarouselPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="WhoseKitchenApp.Views.Walkthroughs.WalkthroughPage"
xmlns:artina="clr-namespace:UXDivers.Artina.Shared;assembly=UXDivers.Artina.Shared"
xmlns:local="clr-namespace:WhoseKitchenApp;assembly=WhoseKitchenApp">
<!-- following line is line 9 -->
<local:Views.Walkthroughs.Templates.WalkthroughStepItemTemplate BackgroundColor="#FF6600" Header="Header text 1" Text="Welcome slide 1" IconColor="#5F7DD4" ButtonBackgroundColor="#5F7DD4" ButtonText="Next" />
<!-- following line is line 11 -->
<local:Views.Walkthroughs.Templates.WalkthroughStepItemTemplate BackgroundColor="#FF6600" Header="Header text 2" Text="Hello slide 2" IconColor="#7C4ECD" ButtonBackgroundColor="#7C4ECD" ButtonText="Next" />
<local:Views.Walkthroughs.Templates.WalkthroughStepItemTemplate BackgroundColor="#FF6600" Header="Header text 3" Text="Last slide, slide 3" IconColor="#E51E61" ButtonBackgroundColor="#E51E61" ButtonText="Finish" />
</CarouselPage>
I created an template called WalkthroughStepItemTemplate which I use to display information about the app.
When running my app, I get an XamlParseException:
Position 11:6. Type local:Views.Walkthroughs.Templates.WalkthroughStepItemTemplate not found in xmlns clr-namespace:WhoseKitchenApp;assembly=WhoseKitchenApp
In the code above, I placed a comment where that line 11 is. As you can see, the first time WalkthroughStepItemTemplate is called it looks just fine, but on the second try, it generates the exception.
I tried changing the clr-namespace to WhoseKitchenApp.Views.Walkthroughs.Templates, but I still have the same exception than. Also changing line 11 in the example to
<local:WalkthroughStepItemTemplate ...
has no effect.
Linker Behavior for both iOS and Android apps is set to Don't Link - Tip from the SO question
I'm wondering why the second (and third) time I get an XamlParseException.

Generic.xaml xaml compilation gives error WMC0610 (XBF generation error code 0x3e9) on control style

Getting the following error when compiling XAML in a library:
Themes\Generic.xaml(35,12): XamlCompiler error WMC0610: XBF generation
error code 0x03e9.
The XAML code it's failing on (line 35) is:
<Style TargetType="annotations:CanvasAnnotationItem" xmlns:annotations="using:ACME.Controls.CanvasAnnotation">
No extra info to help with the error.
For some reason, the XAML compiler does not know how to handle that local namespace (the one defined directly on the style). Moving it up to the top of the file solves the issue:
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:annotations="using:ACME.Controls.CanvasAnnotation"
xmlns:local="using:ACME.Controls">
And in the element itself:
<Style TargetType="annotations:CanvasAnnotationItem">

What is the suitable replacement for this.__LZtextclip.text in Open laszlo 5.0

I want to know what is the suitable replacement for this line.
this.__LZtextclip.text
I am using this to get the string present in the text node. This works fine in Openlaszlo 3.3 but in 4.9 and 5.0 it's giving a problem
I tried updating it to
this.sprite.__LZtextclip.text
And i am getting an error:
79: Error: Access of possibly undefined property __LZtextclip through a reference with static type LzSprite, in line: Debug.write(this.sprite.__LZtextclip.text);
Any idea why this problem is happening?
If you are trying to access the text content of a text field, why don't you just access the attribute text?
<canvas>
<text name="sample" id="gRead" />
<handler name="oninit">
gRead.setAttribute('text',"HI");
Debug.info(gRead.text);
</handler>
</canvas>
In OpenLaszlo 3.3 there is method getText(), which gives you the same value. Accessing mx.textfield in your code does not work for the DHTML runtime.
Edit: Added information regarding the stripping of HTML tags
The Flash Textfield class flash.text.Textfield provides an API to enable HTML tag content in a Textfield instance. There are two different properties, one called text, the other one htmlText. If you want to directly access the Flash Textfield object of an lz.text instance, it's a property of the display object of the lz.text instance:
// Flash Textfield instance
gRead.getDisplayObject().textfield
// Pure text content
gRead.getDisplayObject().textfield.text
// Formatted text
gRead.getDisplayObject().textfield.htmlText
You should be aware of the fact that Flash automatically adds HTML format to any textstring you set as content. When you do
gRead.setAttribute('text',"HI");
the textfield.htmlText value is
<P ALIGN="LEFT"><FONT FACE="Verdana" SIZE="11" COLOR="#000000" LETTERSPACING="0" KERNING="1">HI</FONT></P>
For the DHTML runtime, the text content is added as the innerHTML of a <div> tag, and there is no standardized API to retrieve the pure text content of a DOM structure for a tag with content. You could write your own function to extract the text content, or use JavaScript functions from existing frameworks - like the jQuery text() function - to achieve the same result for the DHTML runtime.
I guess the reason is that Laszlo started using the Dojo based rich text editor for text input with HTML formatting since OpenLaszlo 4.0 or 4.1.
The best approach to have consistent behavior across runtimes when stripping tags is to do the conversion on the server-side. That's especially needed if you wan to have consistent whitespace treatment in multiline text, since there differences in how browsers treat whitespace. The question how to best strip tags from strings in JavaScript has been answered before on Stackoverflow, e.g. JavaScript: How to strip HTML tags from string?
Here is a cross-runtime example which works in DHTML with Firefox, Chrome, and it should work with IE9+:
<canvas>
<text name="sample" id="gRead" />
<handler name="oninit"><![CDATA[
gRead.setAttribute("text", 'Hello <b>World</b> OL');
Debug.info("gRead.text=" + gRead.text);
if ($dhtml) {
Debug.info(gRead.getDisplayObject().textContent);
} else {
Debug.info(gRead.getDisplayObject().textfield.text);
}
]]></handler>
</canvas>
I found what is the problem. The problem is that i have to declare a variable and have to refer the property from that.
<canvas>
<library>
<text name="sample" id="gRead">
<method name="getTextFrom">
Debug.write("this.text" , this.sprite);
var mx = this.sprite;
Debug.write("this.text" , mx.textfield.text);
</method>
</text>
</library>
<handler name="oninit">
gRead.setAttribute('text',"HI");
gRead.getTextFrom();
</handler>
</canvas>