We're working on an Android application using Xamarin for Android and MvvmCross 4.0.0-beta3.
I've run into an issue I can't quite understand. I have a dialog, hosted inside a MvxDialogFragment. We're overriding the OnCreateDialog-method and returning a Dialog build using the AltertDialog.Build. The View is set to the dialog using a view created by calling this.BindingInflate in the dialog (the class deriving from MvxDialogFragment).
The view we're inflating is containing a MvxListView, and the MvxItemTemplate contains a MvxFrameControl. When running the app I get the following exception:
InnerException was MvxException: The owning Context for a MvxFrameControl must implement LayoutInflater
If I remove the MvxFrameControlfrom the item template, and include something like a TextView the dialog renders correctly (and the databound text is displayed).
We have other cases in our app where the MvxFrameControl is used from an item template, which renders just fine, and we have dialogs containing MvxFrameControl. It seems the problem only occurs when the structure is MvxDialogFragment -> MvxListView -> MvxItemTemplate -> MvxFrameControl.
Looking at the code for the MvxFrameControl you can see that it throws the exception we're receiving if the context doesn't implement IMvxLayoutInflaterHolder.
So; my question is something like this: what ends up beeing the "owning context" when the MvxFrameControl is hosted like mentioned above?
Related
I am using ASP.NET Core 2.0 and Visual Studio 2017.
I want to create a Razor partial view to display the menu of our application. The menu is created dynamically as each user will only have menu items for which they have the necessary permissions (so the menu will be different for each user).
The problem I'm having is persisting the menu in the Razor partial view. There is no PageModel code-behind in a Razor partial view, so the problem I'm having is that the menu disappears when you click onto another page. I've persisted the menu in session storage, but I can't figure out how to load the menu from session storage into the Razor partial view.
I've tried loading the session storage menu into ViewData but this is wiped out when you click on another page.
How do I persist data in my Razor partial views?
Instead of using partial view, consider using a view component.
public class MenuComponent : ViewComponent
{
SomeDependency userDetails;
public MenuComponent(SomeDependency userDetails)
{
//store this userDetails data to extract profile info in Invoke method
this.userDetails = userDetails;
}
public IViewComponentResult Invoke()
{
//check for logged in user profile here and return appropriate view
return View(viewName,ModelObjectForView);
}
}
1.Create required menu views
Create the appropriate views for displaying menu for each role or use
conditional rendering.
Please note view for view components will be looked in to
/Views/ControllerName/Components/ViewComponentName/ViewName.cshtml this
location instead of /Views/ControllerName/ViewName.cshtml.
2.Define Layout Page
Now, since you need to display menu for all the pages user navigates to, you
need to extract this view component in a layout page. Create a _Layout.cshthml
file and make sure views that need to show menu item uses this layout page.
In the _Layout.cshtml , you can now render the view component defined above by calling
#await Component.InvokeAsync(nameof(MenuComponent))
3.Using ViewComponent instead of PartialView
I am suggesting use of ViewComponent over PartialView in this case because
ViewComponent will allow you to have its own model (RoleDetails for user in
your case) in comparison to PartialView
where you will have to pass some child data from view model and hence will have
to keep that data in each of your view model. Otherwise , you can even use PartialView. The important thing here is layout page that will help you keep menu across all views presented to user.
I'm working on a personal project, it's a simple blog app using ReactJS. I have 1 screen for the entry list page, and 1 for the entry details page.
Now, I'm trying to follow the best practices, so I laid out my components as this:
Entry List Container: container component. Handles fetching entries retrieval and updating application state by dispatching redux actions.
Entry List: presentational component. Receives an Array of Entry objects and shows a list of them
Entry Details Container: container component. Handles more application state update logic, fetching, etc. Receives an Entry object
Entry Details: presentational component. Displays the entry.
Basically both containers renders their presentational counterpart.
Now, the problem is the navigation. In my App component I'm rendering a couple of Route components, one is rendering the EntryListContainer, and another one should render the EntryDetailContainer.
Problem is, how do I navigate from EntryList ?
My hierarchy is something like this:
EntryListContainer
EntryList
EntryRow -----> This contains a button to navigate.
EntryDetailsContainer
EntryPage
I suppose I could render a Link inside EntryRow, something like
<Link to={`${match.url}/{entry.id}`} />
But then I'd have to pass down the match object down from EntryListContainer to EntryList to `EntryRow, and it feels smelly.
How do I navigate properly?
I have the following situation. We are building a new intranet for our company and, being a charity, accomplishing AA accessibility is a must. I am a SharePoint developer and we are getting the design from a third party company. That said, designers made a custom design in a way that it is barely recalling SharePoint at all, like a kind of mixture between a completely different design like if it was a publishing site and at the same time, the idea is to work with as much out of the box functionality as possible.
That means that if I create a list, all the look and feel will be the customized one while the functionality must be kept. So I would get a settings page for the list whose functionality should be kept as is but the design should be the new design. A custom list (custom but created in SharePoint) would have a new, editing and display form which should be out of the box... but with the new design.
The problem comes with this out of the box forms. The design is using divs for displaying all the HTML controls that are linked to each of the columns of a custom list. Unfortunately, SharePoint 2013 out of the box list forms tabulate the fields using HTML tables.
Apparently there is a limit of 30000 characters in this post, so I can't paste the code from the out of the box form to show the tables, but what I did is to create a form with an example of each of the possible fields in SharePoint and then look at how many tables I was getting there. And I can't add a screenshot because I need 10 reputation...
I have removed in previous projects the tables in SharePoint webparts using a control adapter, which, by the way, I am using in this website too. But I am struggling with how I can change this HTML tables in the forms. I have tried to render the form same way that I did with the webpart zones but it is not working in a similar way.
Here you have the code for the Control Adapter for webpart zones:
public class WebpartControlAdapter : System.Web.UI.Adapters.ControlAdapter
{
protected override void Render(HtmlTextWriter writer)
{
var wpz = Control as Microsoft.SharePoint.WebPartPages.WebPartZone;
if (wpz != null)
{
WebPartCollection wpColl = new WebPartCollection(wpz.WebParts);
foreach (System.Web.UI.WebControls.WebParts.WebPart wp in wpColl)
{
wp.RenderControl(writer);
}
}
}
}
And here what I tried based on that, which is basically destroying my page completely:
public class PageControlAdapter : System.Web.UI.Adapters.PageAdapter
{
protected override void Render(HtmlTextWriter writer)
{
var currentPage = Control as Page;
if (currentPage != null)
{
System.Web.UI.HtmlControls.HtmlForm form = new System.Web.UI.HtmlControls.HtmlForm();
form = currentPage.Form;
form.RenderControl(writer);
}
}
}
So my question are if anyone has a solution or way to achieve this.
Thanks for any possible help.
P.D.: before you propose that, changing the .aspx files coming OOTB from SharePoint is not an option because we hold other web applications in the same farm and making changes there would provoke changes in all other websites.
I'am not sure what you want to acomplish.
If you are creating totally custom list and want a New, Display and Edit forms completly different then you can define which forms to use in contentType:
https://msdn.microsoft.com/en-us/library/office/aa543825.aspx
Example:
<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<!-- Parent ContentType: Workflow Task (0x010801) -->
<ContentType ID="0x010100AF4E4BE6CF8048959C4172F4298CE42A"
Name="MyName"
Group="MyGroup"
Description="MyDescription"
Version="0">
<FieldRefs>
</FieldRefs>
<XmlDocuments>
<XmlDocument NamespaceURI ="http://schemas.microsoft.com/sharepoint/v3/contenttype/forms/url">
<FormUrls xmlns="http://schemas.microsoft.com/sharepoint/v3/contenttype/forms/url">
<New>_layouts/MyFolder/New.aspx</New>
<Display>_layouts/MyFolder/New.aspx</Display>
<Edit>_layouts/MyFolder/Edit.aspx</Edit>
</FormUrls>
</XmlDocument>
</XmlDocuments>
</ContentType>
</Elements>
In code behind you get current item:
SPListItem item = SPContext.Current.ListItem;
Other possibility is to add script editor webpart on NewFrom, DisplayForm and EditForm. In script use jquery to change look of fields.
To auto populate scriptEditorWebparts you can make eventhandler fired on ListAdded event
Does anybody know how to get image data from inside custom report item?
I want to enable users of my component to set image (background image for example) for the component to use. I've managed to create property with ImageSource type, but I reason that I need to read Source and Value, and than retrive the image data itself(since there is nothing in the ImageSource interface to access it).
I suspect that there should be a common interface for all types of sources, but if I need to use something like EmbeddedImageCollection that is also fine.
Thanks!
in Short : View Code and copy and paste the tag into the embedded images tag
I created a Qt4 Gui application. I have the main window. I put a QStackedWidget and two QPushButtons on the MainWindow's central widget. I am using QtCreator as my IDE.
In the attached image the shown stacked widget has two pages and the two pushButtons 1 and 2 are for navigation to firstPage and SecondPage of the stacked widget respectively.
Problem 1:
When I opened signal/slot editor I selected sender=button1 and signal=clicked, then receiver=stackedWidget and slot=? . It supposed to be setCurrentIndex() but its not listed in the drop down list.
Problem 2:
In the right object panel of QtCreator there is marked the "Denied Symbols". I don't know why those symbols are there? Is there any problem ?
I am attaching the screenshot below. If any more details are required please let me know.
I too am learning QT and QT Designer, and ran into the same problem. A determined search of the Internet revealed several other people with the same question, and no answers. You'd think someone out there would have explained it by now. Sigh.
Anyway, the problem is that the signals sent by the push-buttons don't match the signature of the "setCurrentIndex(int)" slot on the stacked-widget, so "setCurrentIndex(int)" doesn't show up in the menu when one tries to use a push-button "clicked()" signal. That is, "clicked()" has no parameters, and "setCurrentIndex(int)" has a single integer parameter, therefore they have different signatures.
In my project, I was trying to connect menu items to a stacked widget, so that one of the contained widgets would be displayed when the menu item was selected. The menu items only have the "triggered()" signal, there's no "triggered(int)" signal, and QStackedWidget's "setCurrentIndex(int)" slot is expecting a signal that has a single integer parameter in its signature.
In other words, you can't do what you want, directly.
Here's how I solved it in my code. Keep in mind that I'm writing my Qt app in C#, using MonoDevelop (to do C# development under Linux) and Qyoto (which is a C# interface to Qt).
After creating my main window (and assiging it to a variable called "layout"), I did this:
QObject.Connect (layout.someMenuItem, SIGNAL("triggered()"), showSomeView);
This causes my menu item to call the showSomeView() function whenever it's triggered.
I then wrote
public void showSomeView()
{
layout.stackedWidget.SetCurrentWidget(layout.someView);
}
Now it does what I mean!
The solution in your project's language should be similar to this. It's unfortunate that the signal/slot connections have to be set up in code, instead of in QT Designer's GUI, but I don't know how else to do it.