I create a demo app by Net MAUI, using Flyout to navigate to three Shell page. In Windows is good, but in android, the page goes to blank.
first
go in again
and debug output says MODE_SCROLLABLE + GRAVITY_FILL is not supported, GRAVITY_START will be used instead
in AppShell.xaml
<?xml version="1.0" encoding="UTF-8" ?>
<Shell
x:Class="NexDroid.AppShell"
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:NexDroid"
xmlns:pages="clr-namespace:NexDroid.Pages"
xmlns:debug="clr-namespace:NexDroid.Pages.Debug"
xmlns:parametes="clr-namespace:NexDroid.Pages.Parameters"
FlyoutBehavior="Flyout">
<ShellContent ContentTemplate="{DataTemplate pages:Connect}" />
<FlyoutItem Title="操作" Route="MainPage">
<ShellContent ContentTemplate="{DataTemplate local:MainPage}" />
</FlyoutItem>
<FlyoutItem Title="调试">
<ShellContent ContentTemplate="{DataTemplate debug:DebugShell}" />
</FlyoutItem>
<FlyoutItem Title="参数">
<ShellContent ContentTemplate="{DataTemplate parametes:ParametersShell}" />
</FlyoutItem>
</Shell>
in MainPage.xaml
<?xml version="1.0" encoding="UTF-8" ?>
<Shell
x:Class="NexDroid.MainPage"
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:pages="clr-namespace:NexDroid.Pages"
xmlns:operation="clr-namespace:NexDroid.Pages.Operation"
>
<TabBar>
<Tab Title="点动" Route="Operation/Jog">
<ShellContent ContentTemplate="{DataTemplate operation:Jog}" />
</Tab>
<Tab Title="拖拽" Route="Operation/Drag">
<ShellContent ContentTemplate="{DataTemplate operation:Drag}" />
</Tab>
</TabBar>
</Shell>
is there something wrong?
is there i using wrong?
In AppShell.xaml, you can change to this:
...
<Shell.TabBarIsVisible>false</Shell.TabBarIsVisible>
<FlyoutItem Title="操作">
<Tab Title="点动">
<ShellContent Title="点动" ContentTemplate="{DataTemplate operation:Jog}" />
<ShellContent Title="拖拽" ContentTemplate="{DataTemplate operation:Drag}" />
</Tab>
<ShellContent Title="调试" ContentTemplate="{DataTemplate debug:DebugShell}" />
<ShellContent Title="参数" ContentTemplate="{DataTemplate parametes:ParametersShell}" />
</FlyoutItem>
...
I suppose that your mainpage must be a ContentPage and not a Shell as you already have a shell in your app.
If you need different tabs to mainpage, and at the same time you need to get rid off the initial tabs you have to think about how the user will go back to the initial tabs. But if you want all the tabs to be visible both the initial tabs and the additional tabs of the mainpage, maybe is better to redesign the ui and include bottom and top tabs, so all the tabs will be visible to the user. Check the docs here.
Related
I have:
<FlyoutItem
FlyoutDisplayOptions="AsMultipleItems"
</FlyoutItem>
I would like to have a TabBar in one of the contentPages but I can't get it.
You can use the below.
<Shell FlyoutBehavior="Flyout">
<FlyoutItem Title="Home">
<Tab Title="Tab1">
<ShellContent ContentTemplate="{DataTemplate pages:Tab1}"/>
</Tab>
<Tab Title="Tab2">
<ShellContent ContentTemplate="{DataTemplate pages:Tab2}"/>
</Tab>
</FlyoutItem>
</Shell>
but I can't put it inside my existing FyloutItem, what you put me will
be separated by a gray line and below my menu and it will do a strange
effect replacing all the content.
I did a test, and there is no gray line.
Please refer to the following code:
<?xml version="1.0" encoding="UTF-8" ?>
<Shell
x:Class="MauiApp1205.AppShell"
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:MauiApp1205"
Shell.FlyoutBehavior="Flyout">
<FlyoutItem Route="animals"
FlyoutDisplayOptions="AsMultipleItems">
<Tab Title="Domestic"
Route="domestic"
>
<ShellContent Route="cats"
Title="Cats"
ContentTemplate="{DataTemplate local:CatsPage}" />
<ShellContent Route="dogs"
Title="Dogs"
ContentTemplate="{DataTemplate local:DogsPage}" />
</Tab>
</FlyoutItem>
<ShellContent
Title="Test"
ContentTemplate="{DataTemplate local:MainPage}"
Route="MainPage" />
</Shell>
This is my first time I try to implement the flyouts menu in Xamarin forms. I created first a blank page and followed the documentation but for some reason the menu is not showing. The tabbar in case you are wondering will be added dynamically that is why it is empty. What might be the problem? Thanks in advance.
<?xml version="1.0" encoding="utf-8" ?>
<Shell xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:Bufib.Tools"
xmlns:views="clr-namespace:Bufib.Views.FlyoutPages"
x:Class="Bufib.MainPage">
<Shell.ToolbarItems>
<ToolbarItem x:Name="audioOptn" IconImageSource="{local:ImageResource Bufib.Logos.audio.png}" />
</Shell.ToolbarItems>
<!-- NAVIGATION -->
<Shell.FlyoutHeader>
<StackLayout Padding="10">
<Label x:Name="flyoutHeaderLbl" Text="Bufib" FontSize="Header" />
</StackLayout>
</Shell.FlyoutHeader>
<FlyoutItem x:Name="syllabusPage" >
<Tab>
<ShellContent Route="SyllabusPage" ContentTemplate="{DataTemplate views:SyllabusPage}" />
</Tab>
</FlyoutItem>
<FlyoutItem x:Name="historyPage">
<Tab>
<ShellContent Route="HistoryPage" ContentTemplate="{DataTemplate views:HistoryPage}" />
</Tab>
</FlyoutItem>
<FlyoutItem x:Name="managePage">
<Tab>
<ShellContent Route="ManagePage" ContentTemplate="{DataTemplate views:ManagePage}" />
</Tab>
</FlyoutItem>
<FlyoutItem x:Name="errorPage">
<Tab>
<ShellContent Route="ErrorPage" ContentTemplate="{DataTemplate views:ErrorPage}" />
</Tab>
</FlyoutItem>
<FlyoutItem x:Name="aboutPage">
<Tab>
<ShellContent Route="AboutPage" ContentTemplate="{DataTemplate views:AboutPage}" />
</Tab>
</FlyoutItem>
<FlyoutItem x:Name="callUsPage">
<Tab>
<ShellContent Route="CallUsPage" ContentTemplate="{DataTemplate views:CallUsPage}" />
</Tab>
</FlyoutItem>
<!-- END NAVIGATION TABS -->
<!--- TABS -->
<TabBar x:Name="tabBar"></TabBar>
<!--- END TABS -->
</Shell>
The problem was that it was a navigation page. I navigated to it using MainPage = new Navigation(new MainPage()) which causes the problem. So the solution was changing it to MainPage = new MainPage()
I am developping a windows 8.1 application and since few days I am struggling with a problem.
Here is my probem:
I have a tfs project and via my application I want to follow it (displaying the state, created by, changed by,etc) using tfs odata.
Here is the xml file obtained :
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<feed xml:base="https://tfsodata.visualstudio.com/DefaultCollection/" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns="http://www.w3.org/2005/Atom">
<title type="text">WorkItems</title>
<id>https://tfsodata.visualstudio.com/DefaultCollection/Projects('project1')/WorkItems/</id>
<updated>2014-05-02T14:52:17Z</updated>
<link rel="self" title="WorkItems" href="WorkItems" />
<entry m:etag="W/"datetime'2014-03-12T19%3A54%3A38.193%2B00%3A00'"">
<id>https://tfsodata.visualstudio.com/DefaultCollection/WorkItems(1)</id>
<title type="text">ProjetTest</title>
<summary type="text"></summary>
<updated>2014-03-12T19:54:38Z</updated>
<author>
<name />
</author>
<link rel="edit" title="WorkItem" href="WorkItems(1)" />
<link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Attachments" type="application/atom+xml;type=feed" title="Attachments" href="WorkItems(1)/Attachments" />
<link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Links" type="application/atom+xml;type=feed" title="Links" href="WorkItems(1)/Links" />
<category term="Microsoft.Samples.DPE.ODataTFS.Model.Entities.WorkItem" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
<content type="application/xml">
<m:properties>
<d:Id m:type="Edm.Int32">1</d:Id>
<d:Project>project1</d:Project>
<d:Type>Product Backlog Item</d:Type>
<d:WebEditorUrl>https://xxxx.visualstudio.com/web/wi.aspx?pcguid=f2ba9200-f167-43e8-a92e-d36b1bc1b561&id=1</d:WebEditorUrl>
<d:AreaPath>ptoject1</d:AreaPath>
<d:IterationPath>project1</d:IterationPath>
<d:Revision m:type="Edm.Int32">2</d:Revision>
<d:Priority m:null="true" />
<d:Severity m:null="true" />
<d:StackRank m:type="Edm.Double">0</d:StackRank>
<d:AssignedTo></d:AssignedTo>
<d:CreatedDate m:type="Edm.DateTime">2014-03-12T19:54:25.783+00:00</d:CreatedDate>
<d:CreatedBy>xxxxx</d:CreatedBy>
<d:ChangedDate m:type="Edm.DateTime">2014-03-12T19:54:38.193+00:00</d:ChangedDate>
<d:ChangedBy>xxxxx</d:ChangedBy>
<d:ResolvedBy m:null="true" />
<d:Title>ProjetTest</d:Title>
<d:State>New</d:State>
<d:Reason>New backlog item</d:Reason>
<d:CompletedWork m:type="Edm.Double">0</d:CompletedWork>
<d:RemainingWork m:type="Edm.Double">0</d:RemainingWork>
<d:Description></d:Description>
<d:ReproSteps m:null="true" />
<d:FoundInBuild m:null="true" />
<d:IntegratedInBuild></d:IntegratedInBuild>
<d:AttachedFileCount m:type="Edm.Int32">0</d:AttachedFileCount>
<d:HyperLinkCount m:type="Edm.Int32">0</d:HyperLinkCount>
<d:RelatedLinkCount m:type="Edm.Int32">0</d:RelatedLinkCount>
<d:Risk m:null="true" />
<d:StoryPoints m:type="Edm.Double">0</d:StoryPoints>
<d:OriginalEstimate m:type="Edm.Double">0</d:OriginalEstimate>
<d:BacklogPriority m:type="Edm.Double">1000000000</d:BacklogPriority>
<d:BusinessValue m:type="Edm.Int32">0</d:BusinessValue>
<d:Effort m:type="Edm.Double">0</d:Effort>
<d:Blocked m:null="true" />
<d:Size m:type="Edm.Double">0</d:Size>
</m:properties>
</content>
</entry>
<entry m:etag="W/"datetime'2014-03-24T12%3A07%3A56.397%2B00%3A00'"">
<id>https://tfsodata.visualstudio.com/DefaultCollection/WorkItems(2)</id>
<title type="text">test2</title>
<summary type="text"></summary>
<updated>2014-03-24T12:07:56Z</updated>
<author>
<name />
</author>
<link rel="edit" title="WorkItem" href="WorkItems(2)" />
<link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Attachments" type="application/atom+xml;type=feed" title="Attachments" href="WorkItems(2)/Attachments" />
<link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Links" type="application/atom+xml;type=feed" title="Links" href="WorkItems(2)/Links" />
<category term="Microsoft.Samples.DPE.ODataTFS.Model.Entities.WorkItem" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
<content type="application/xml">
<m:properties>
<d:Id m:type="Edm.Int32">2</d:Id>
<d:Project>project1</d:Project>
<d:Type>Product Backlog Item</d:Type>
<d:WebEditorUrl>https://xxxxx.visualstudio.com/web/wi.aspx?pcguid=f2ba9200-f167-43e8-a92e-d36b1bc1b561&id=2</d:WebEditorUrl>
<d:AreaPath>project1</d:AreaPath>
<d:IterationPath>project1</d:IterationPath>
<d:Revision m:type="Edm.Int32">4</d:Revision>
<d:Priority m:null="true" />
<d:Severity m:null="true" />
<d:StackRank m:type="Edm.Double">0</d:StackRank>
<d:AssignedTo></d:AssignedTo>
<d:CreatedDate m:type="Edm.DateTime">2014-03-12T20:16:49.827+00:00</d:CreatedDate>
<d:CreatedBy>xxxx</d:CreatedBy>
<d:ChangedDate m:type="Edm.DateTime">2014-03-24T12:07:56.397+00:00</d:ChangedDate>
<d:ChangedBy>xxxx</d:ChangedBy>
<d:ResolvedBy m:null="true" />
<d:Title>test2</d:Title>
<d:State>Committed</d:State>
<d:Reason>Additional work found</d:Reason>
<d:CompletedWork m:type="Edm.Double">0</d:CompletedWork>
<d:RemainingWork m:type="Edm.Double">0</d:RemainingWork>
<d:Description></d:Description>
<d:ReproSteps m:null="true" />
<d:FoundInBuild m:null="true" />
<d:IntegratedInBuild></d:IntegratedInBuild>
<d:AttachedFileCount m:type="Edm.Int32">0</d:AttachedFileCount>
<d:HyperLinkCount m:type="Edm.Int32">0</d:HyperLinkCount>
<d:RelatedLinkCount m:type="Edm.Int32">0</d:RelatedLinkCount>
<d:Risk m:null="true" />
<d:StoryPoints m:type="Edm.Double">0</d:StoryPoints>
<d:OriginalEstimate m:type="Edm.Double">0</d:OriginalEstimate>
<d:BacklogPriority m:type="Edm.Double">999968378</d:BacklogPriority>
<d:BusinessValue m:type="Edm.Int32">0</d:BusinessValue>
<d:Effort m:type="Edm.Double">0</d:Effort>
<d:Blocked m:null="true" />
<d:Size m:type="Edm.Double">0</d:Size>
</m:properties>
</content>
</entry>
</feed>
my class:
paste special as xml classes (from the xml above)
my function :
public IEnumerable<TfsEntitiesXml.feed> Deserialize()
{
string xml = "https://tfsodata.visualstudio.com/DefaultCollection/Projects('xxxx')/WorkItems".Trim();
XmlSerializer serilaizer = new XmlSerializer(typeof(TfsEntitiesXml.feed));
//string xml = "";
byte[] buffer = Encoding.UTF8.GetBytes(xml);
var stream = new MemoryStream();
stream.WriteAsync(buffer, 0, buffer.Length);
IEnumerable<TfsEntitiesXml.feed> result = (IEnumerable<TfsEntitiesXml.feed>)serilaizer.Deserialize(stream);
return result;
}
and the xaml
<ListView x:Name="itemsListView"
SelectionMode="None"
ItemsSource="{Binding TfsList}" >
<ListView.ItemTemplate>
<DataTemplate>
<TextBlock
Foreground=
"{StaticResource ListViewItemOverlayForegroundThemeBrush}"
Style="{StaticResource TitleTextStyle}" Height="60"
TextWrapping="Wrap"
Margin="15,5,15,0">
<Run Text="{Binding Title}" ></Run>
<Run Text="{Binding State}" ></Run>
</TextBlock>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
var projects = tfsConnector.Deserialize();
DefaultViewModel["TfsList"] = projects;
When I run I get this exception
An exception of type 'System.InvalidOperationException' occurred in System.Xml.dll but was not handled in user code
Additional information: There is an error in XML document (0, 0).
I am struggling with this problem since few days now.
Can someone help me please?
Thank you
You should simply make a service reference to the tfsodata service, this way you will get a typed reference and don't have to mess with the xml.
See this blogpost
I have
Web.sitemap like this :
<?xml version="1.0" encoding="utf-8" ?>
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
<siteMapNode url="" title="" description="">
<siteMapNode url="~/Home.aspx" title="Home" description=" this is the home page" />
<siteMapNode url="~/ProjectList.aspx" title="Project List" description="Approved projects" />
<siteMapNode url="" title="Project Choices" description="">
<siteMapNode url="~/StudentChoices.aspx" title="Student Project Choices" description="" />
<siteMapNode url="~/StaffChoices.aspx" title="Supervisor Project Choices" description="" />
</siteMapNode>
<siteMapNode url="~/AllocationList.aspx" title="Project Allocation List" description="" />
<siteMapNode url="" title="Submit Proposal" description="" >
<siteMapNode url="~/submit.aspx" title="New Proposal" description="new proposal" />
<siteMapNode url="~/reSubmit.aspx" title="Re-Submit Proposal" description="re submit proposal"/>
</siteMapNode>
<siteMapNode url="~/StaffRecords.aspx" title="Staff Records" description="" >
<siteMapNode url="~/addStaff.aspx" title="Add new Staff" description="" />
</siteMapNode>
<siteMapNode url="~/StudentRecords.aspx" title="Student Records" description="" />
<siteMapNode url="~/Administration.aspx" title="Administration" description="" />
</siteMapNode>
</siteMap>
I used this sitemap for creating menu items : like following :
<asp:Menu ID="Menu1" runat="server" Orientation="Horizontal"
BackColor="#33CCFF" Font-Overline="False" DataSourceID="SiteMapDataSource1"
Font-Size="Larger" ForeColor="Black" ItemWrap="True" StaticDisplayLevels="2"
StaticSubMenuIndent="60px" Width="100%" OnMenuItemDataBound="Menu1_MenuItemDataBound">
<DynamicHoverStyle BackColor="#9999FF" ForeColor="Black" />
<DynamicMenuItemStyle BackColor="#0099FF" ForeColor="Black" />
<DynamicMenuStyle BackColor="#0099FF" />
<DynamicSelectedStyle BackColor="#0099FF" ForeColor="Black" />
</asp:Menu>
<asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" />
on code be-hide i wrote following things :
protected void Menu1_MenuItemDataBound(object sender, MenuEventArgs e)
{
//string role = Session["Roles"].ToString();
string AdminRole = ConfigurationManager.AppSettings["AdminRole"];
string StaffRole = ConfigurationManager.AppSettings["StaffRole"];
string StudentRole = ConfigurationManager.AppSettings["StudentRole"];
if (StaffRole == "Staff")
{
if (e.Item.Text == "Project Choices" ||
e.Item.Text == "Staff Records" ||
e.Item.Text == "Student Records")
{
Menu1.Items.Remove(e.Item);
}
}
}
and web config like this
<appSettings>
<add key="AdminRole" value="Admin"/>
<add key="StaffRole" value="Staff"/>
<add key="StudentRole" value="Student"/>
</appSettings>
but I am still able to see those menus, I am not able find out why it's not removing, Can anyone tell me why? Show me sample code.
The siteMapNode already provide an attribute called roles. This attribute hold the roles that can access that area of the site.
For exemple, the Project list should looks like:
<siteMapNode url="~/ProjectList.aspx"
title="Project List"
description="Approved projects"
roles="AdminRole"/>
Theres a Security trimming that in conjuction with ASP.NET Membership can manage the access based on user roles.
You should take a look here: ASP.NET Site-Map Security Trimming
The easiest way to use a SiteMapProvider is to configure with SecurityTrimmingEnabled = true.
Add this under Web.Config file
<siteMap enabled="true" defaultProvider ="AspNetXmlSiteMapProvider" >
<providers>
<clear/>
<add siteMapFile="Web.sitemap" name="AspNetXmlSiteMapProvider" type="System.Web.XmlSiteMapProvider" securityTrimmingEnabled="true" />
</providers>
</siteMap>
try to add the roles to the site map like this
<siteMapNode url="~/StaffRecords.aspx" title="Staff Records" description="" roles="StaffRole">
<siteMapNode url="~/addStaff.aspx" title="Add new Staff" description="" />
</siteMapNode>
///This is my Agent.sitemap
<siteMapNode url="default.aspx#" title="Start" description="Start">
<siteMapNode url="~/dirCommon/default.aspx" title="Home" description="Home" />
<siteMapNode url="dirAgent/profile.aspx#" title="Agent" description="Agent">
<siteMapNode url="dirAgent/profile.aspx" title="My Profile" description="Agent:My Profile" />
<siteMapNode url="dirUser/account.aspx" title="My Account" description="Agent:My Account" />
<!--<siteMapNode url="dirUser/downloads.aspx" title="Downloads" description="Agent:Downloads" />-->
</siteMapNode>
<siteMapNode url="dirAgent/default.aspx" title="Calls" description="Calls">
<siteMapNode url="dirAgent/CallQueue.aspx" title="Call Queue" description="Agent:Call Queue" />
<siteMapNode url="dirAgent/myCalls.aspx" title="My Calls" description="Agent:My Calls" />
<siteMapNode url="dirAgent/followupcalls.aspx" title="Follow-Up" description="Agent:Follow-Up" />
<siteMapNode url="dirAgent/calls.aspx" title="Call History" description="Agent:Call History" />
</siteMapNode>
<siteMapNode url="dirAgent/default3.aspx" title="Environment" description="Environment">
<siteMapNode url="dirAgent/facilities.aspx" title="Facilities" description="Agent:Facilities" />
<!-->
<siteMapNode url="dirAgent/contacts.aspx" title="Contacts" description="Agent:Contacts" />
<!-->
</siteMapNode>
</siteMapNode>
//This Web.sitemap
<siteMapNode url="~/dirCommon/default.aspx" title="Home" description="Home" />
//when i run application from iis getting an error "AGENT.sitemap required by XmlSiteMapProvider does not exist."
Looks like your XmlSiteMapProvider is configured in the web.config (or code) to use your Agent.sitemap instead of the default ~/web.sitemap. check if that reference and the actual location of the Agent.sitemap are correct!