When using views:BasePage.Background or views:BasePage.Resources and I run the project and changed something on XAML, I got an error saying this:
Code behind code of the said xaml:
ViewModel code:
Looking at the said namespace and custom content page that I inherit, I can verify that the class there is existing:
But when changing those two lines with errors to ContentPage, hot reload seems working fine and changes what I see on my emulator. Any solutions? I tried removing the abstract keyword on BasePage class and adding xmlns:views="clr-namespace:SpellingWiz.Templates.Pages.Base;assembly=SpellingWiz" in the said XAML but still got the same error.
I can't say exactly why ContentPage.Background and ContentPage.Resources are the correct syntax for the child element markup of an inheriting page/view, but that syntax always works for me in similar scenarios as yours.
Related
I've got a rather weird scenario going on here. I am trying to add tooltips to an existing ASP.Net MVC application in which I'm upgrading Bootstrap to 4.6.2. The upgrade was very smooth with no complications; I just want to replace the default display of titles with the nicer looking tooltips, but for some reason they're not appearing. I tried to simplify things by creating a new view to isolate the problem, and still no tooltip. I tried again with completely new solution, and wouldn't you know it, it works! So my question isn't "how do I create tooltips", but "how can I debug what's going on in the failing project?"
Here's what I've discovered so far. I believe you can see everything that's relevant in this screenshot of the nearly-empty view. All the included script files are there in the right order, my script is there, initializing the tooltip, and there are no messages in the console. When I hover over the link, a new <div> element is added to the DOM. In DevTools, I use the arrows to expand the tree, showing everything in the tooltip. The .fade:not(.show) CSS selector is the reason I don't see it. In the working solution, the show class is properly added to the tooltip's <div>.
So, could there be some setting in the existing application preventing the addition of the show class? Is something failing in the tooltip code,causing it to never add the show class without reporting errors? How should I continue debugging this? I tried stepping through the bootstap.js file, but being a JS noob, I'm getting a little lost. The screenshot is from Chrome, but I see the same behavior in Firefox.
This turned out to be one of those embarrassing oversights. My BundleConfig.cs file was still pointing to old Javascript files that were still hanging around after the upgrade. I should have seen it in the version numbers in the <script> tags.
I was able to get Aurelia-validation working on a dynamically created form when using the compose element, but I've switched to custom elements for better encapsulation and reuse of the custom controls. However, now my validation seems to be half-broken.
https://gist.run/?id=6e97538c3888cae0f6134faed9d67362
Issue 1: The ValidateBindingBehavior is not doing anything. I suspect it's not finding the controller or matching the rules since the property name is not easily visible in the binding (due to dynamic controls).
Issue 2: For some reason validate() on submit actually only shows the first error instead of all of them. That indicates a problem but I don't know what.
Can anyone get the attached GistRun to work properly?
I have a UserControl that I'm using as a template for two classes. This works fine because they both have the same property names. However, one of them has a few properties that the other one doesn't. This leads to binding errors in my Output window when binding to the class without the extra properties. It still works fine and the user can't even tell there was an error, but my question is: Are there any undesirable side effects caused by this?
(For the record, I plan to use x:DeferLoadStrategy to just not render the fields if not necessary. I'm merely curious about this.)
I am using struts 1.3 and my data on the jsp page gets reset if my validation fails.
It displays the error messages coming from the ActionForm from the validate method, but resets my entire jsp. i tried using struts tags instead of html but it is not helping out.
I even tried looking at this https://stackoverflow.com/a/20499877/1771406 but i dint clearly understand what exactly he is trying to say. can anyone one help me by showing some implemented code please.
the reason why my code was not working inspite of seting getters and setters and html strut tags was only due to this silly mistake of mine
<html:text property="abc" value=""/>
when that value attribute was removed it then worked perfectly fine.
correct code:
<html:text property="abc"/>
I'm trying the MVVM pattern and I've run into a problem.
Here's how I instantiate my model:
<common:LayoutAwarePage
...
...(omitted boiler plate generated lines here)
...
...
mc:Ignorable="d">
<common:LayoutAwarePage.DataContext>
<local:TextGameClientModel x:Name="textGameClientModel"/>
</common:LayoutAwarePage.DataContext>
But when I try to use it, I get a NullReferenceException because this.textGameClientModel is NULL:
public MainPage()
{
this.InitializeComponent();
this.textGameClientModel.runsPublished += textGameClientModel_runsPublished;
}
I've also tried the same line in the Page's OnNavigateTo handler, and also in the OnLoaded handler, but with the same result.
Where is the right place to hook up my event handler?
(Please don't let my code-behind in an MVVM project distract you from the question. My use of a RichTextBox has forced me to color outside the lines a little.)
I actually wrote an answer about the WPF Creation Steps fairly recently, however that's not the problem in this case.
In this case, you are setting the DataContext in your XAML, however that's not the same as setting the textGameClientModel property
You need to do something like this to set the property equal to your DataContext first
this.textGameClientModel = this.DataContext as GameClientModel;
or simply cast your DataContext as your class to setup the event
((GameClientModel)this.DataContext).runsPublished += textGameClientModel_runsPublished;
As a side note, I never recommend hardcoding the DataContext into a UserControl like you have. By doing so, you are preventing any other DataContext from getting passed to the UserControl, which kind of defeats one of the biggest advantages of WPF/MVVM, which is having separate UI and data layers.