Skip to content

Commit 89ca8f6

Browse files
Merge pull request #1 from SyncfusionExamples/AddChanges
897248 - Update the README.md file.
2 parents c50459e + 50b3217 commit 89ca8f6

File tree

2 files changed

+155
-2
lines changed

2 files changed

+155
-2
lines changed

NavigationDrawerTabbed/NavigationDrawerTabbed/NavigationDrawerTabbed.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@
6464
<PackageReference Include="Microsoft.Maui.Controls" Version="$(MauiVersion)" />
6565
<PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="$(MauiVersion)" />
6666
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="8.0.0" />
67-
<PackageReference Include="Syncfusion.Maui.Core" Version="100.2.745" />
68-
<PackageReference Include="Syncfusion.Maui.NavigationDrawer" Version="100.2.92" />
67+
<PackageReference Include="Syncfusion.Maui.Core" Version="*" />
68+
<PackageReference Include="Syncfusion.Maui.NavigationDrawer" Version="*" />
6969
</ItemGroup>
7070

7171
<ItemGroup>

README.md

Lines changed: 153 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,155 @@
11
# .NET-MAUI-NavigationDrawer-with-TabbedPage
22
This sample demonstrates how to add a navigation drawer to a TabbedPage.
3+
4+
## Adding a .NET MAUI NavigationDrawer reference
5+
Syncfusion .NET MAUI controls are available in Nuget.org. To add .NET MAUI Tab View to your project, open the NuGet package manager in Visual Studio, search for Syncfusion.Maui.NavigationDrawer and then install it.
6+
7+
## Creating the project
8+
Create a new .NET MAUI application in Visual Studio.
9+
10+
## Create a Tabbed Page with Two Tab Items
11+
12+
Prepare the Tabbed Page with two tab items, named First Page and Second Page. Add the Navigation Drawer to each page.
13+
14+
**XAML**
15+
16+
```
17+
<TabbedPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
18+
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
19+
x:Class="NavigationDrawerTabbed.TabbedPageWithNavigationDrawer"
20+
xmlns:navigationdrawer="clr-namespace:Syncfusion.Maui.NavigationDrawer;assembly=Syncfusion.Maui.NavigationDrawer"
21+
Title="TabbedPageWithNavigationDrawer">
22+
<NavigationPage Title="First Page">
23+
<x:Arguments>
24+
<ContentPage>
25+
<navigationdrawer:SfNavigationDrawer x:Name="navigationDrawer1">
26+
<navigationdrawer:SfNavigationDrawer.DrawerSettings>
27+
<navigationdrawer:DrawerSettings DrawerWidth="200"
28+
TouchThreshold="100"
29+
DrawerHeaderHeight="50"
30+
DrawerFooterHeight="50">
31+
<!-- Drawer Header View -->
32+
<!-- ... -->
33+
<navigationdrawer:DrawerSettings.DrawerContentView>
34+
<Grid>
35+
<Label Text="Content View" FontSize="14" TextColor="Black" VerticalTextAlignment="Center" HorizontalTextAlignment="Center"/>
36+
</Grid>
37+
</navigationdrawer:DrawerSettings.DrawerContentView>
38+
<!-- Drawer Footer View -->
39+
<!-- ... -->
40+
</navigationdrawer:DrawerSettings>
41+
</navigationdrawer:SfNavigationDrawer.DrawerSettings>
42+
43+
<navigationdrawer:SfNavigationDrawer.ContentView>
44+
<Grid x:Name="mainContentView1"
45+
BackgroundColor="White" RowDefinitions="Auto,*">
46+
<HorizontalStackLayout BackgroundColor="#6750A4" Spacing="10" Padding="5,0,0,0">
47+
<ImageButton x:Name="hamburgerButton1"
48+
HeightRequest="50"
49+
WidthRequest="50"
50+
HorizontalOptions="Start"
51+
Source="hamburgericon.png"
52+
BackgroundColor="#6750A4"
53+
Clicked="hamburgerButton1_Clicked"/>
54+
<Label x:Name="headerLabel"
55+
HeightRequest="50"
56+
HorizontalTextAlignment="Center"
57+
VerticalTextAlignment="Center"
58+
Text="Home" FontSize="16"
59+
TextColor="White"
60+
BackgroundColor="#6750A4"/>
61+
</HorizontalStackLayout>
62+
63+
<Label Grid.Row="1"
64+
Text="First Page"
65+
VerticalOptions="Center"
66+
HorizontalOptions="Center" />
67+
</Grid>
68+
</navigationdrawer:SfNavigationDrawer.ContentView>
69+
</navigationdrawer:SfNavigationDrawer>
70+
</ContentPage>
71+
</x:Arguments>
72+
</NavigationPage>
73+
<NavigationPage Title="Second Page">
74+
<x:Arguments>
75+
<ContentPage>
76+
<navigationdrawer:SfNavigationDrawer x:Name="navigationDrawer2">
77+
<navigationdrawer:SfNavigationDrawer.DrawerSettings>
78+
<navigationdrawer:DrawerSettings DrawerWidth="150"
79+
TouchThreshold="100"
80+
DrawerHeaderHeight="100"
81+
DrawerFooterHeight="100">
82+
<!-- Drawer Header View -->
83+
<!-- ... -->
84+
<navigationdrawer:DrawerSettings.DrawerContentView>
85+
<Grid>
86+
<Label Text="Content View" FontSize="14" TextColor="Black" VerticalTextAlignment="Center" HorizontalTextAlignment="Center"/>
87+
</Grid>
88+
</navigationdrawer:DrawerSettings.DrawerContentView>
89+
<!-- Drawer Footer View -->
90+
<!-- ... -->
91+
</navigationdrawer:DrawerSettings>
92+
</navigationdrawer:SfNavigationDrawer.DrawerSettings>
93+
94+
<navigationdrawer:SfNavigationDrawer.ContentView>
95+
<Grid x:Name="mainContentView2"
96+
BackgroundColor="White" RowDefinitions="Auto,*">
97+
<HorizontalStackLayout BackgroundColor="#6750A4" Spacing="10" Padding="5,0,0,0">
98+
<ImageButton x:Name="hamburgerButton2"
99+
HeightRequest="50"
100+
WidthRequest="50"
101+
HorizontalOptions="Start"
102+
Source="hamburgericon.png"
103+
BackgroundColor="#6750A4"
104+
Clicked="hamburgerButton2_Clicked"/>
105+
<Label x:Name="headerLabel2"
106+
HeightRequest="50"
107+
HorizontalTextAlignment="Center"
108+
VerticalTextAlignment="Center"
109+
Text="Home" FontSize="16"
110+
TextColor="White"
111+
BackgroundColor="#6750A4"/>
112+
</HorizontalStackLayout>
113+
114+
<Label Grid.Row="1"
115+
Text="Second Page"
116+
VerticalOptions="Center"
117+
HorizontalOptions="Center" />
118+
</Grid>
119+
</navigationdrawer:SfNavigationDrawer.ContentView>
120+
</navigationdrawer:SfNavigationDrawer>
121+
</ContentPage>
122+
</x:Arguments>
123+
</NavigationPage>
124+
</TabbedPage>
125+
```
126+
127+
**C#**
128+
129+
```
130+
private void hamburgerButton1_Clicked(object sender, EventArgs e)
131+
{
132+
navigationDrawer1.ToggleDrawer();
133+
}
134+
135+
private void hamburgerButton2_Clicked(object sender, EventArgs e)
136+
{
137+
navigationDrawer2.ToggleDrawer();
138+
}
139+
```
140+
141+
## Project pre-requisites
142+
143+
Make sure that you have the compatible versions of Visual Studio with .NET MAUI workloads and .NET SDK version in your machine before starting to work on this project. Refer to [System Requirements for .NET MAUI](https://help.syncfusion.com/maui/system-requirements).
144+
145+
## How to run this application?
146+
147+
To run this application, you need to first clone the .NET-MAUI-NavigationDrawer-with-TabbedPage repository and then open it in Visual Studio 2022. Now, simply build and run your project to view the output.
148+
149+
## <a name="troubleshooting"></a>Troubleshooting ##
150+
### Path too long exception
151+
If you are facing path too long exception when building this example project, close Visual Studio and rename the repository to short and build the project.
152+
153+
## License
154+
155+
Syncfusion has no liability for any damage or consequence that may arise by using or viewing the samples. The samples are for demonstrative purposes, and if you choose to use or access the samples, you agree to not hold Syncfusion liable, in any form, for any damage that is related to use, for accessing, or viewing the samples. By accessing, viewing, or seeing the samples, you acknowledge and agree Syncfusion’s samples will not allow you seek injunctive relief in any form for any claim related to the sample. If you do not agree to this, do not view, access, utilize, or otherwise do anything with Syncfusion’s samples.

0 commit comments

Comments
 (0)