How to change the color of tab icons - maui

As you can see I have added in FlyoutItem the Tabs that have Icon property which is an svg image that I need to change the color
<FlyoutItem FlyoutDisplayOptions="AsMultipleItems" >
<Tab Title="Inicio" Icon="housesolid.svg">
<ShellContent ContentTemplate="{DataTemplate local:LoginCameraQR}" />
</Tab>
<Tab Title="Perfil" Icon="usergroupsolid.svg">
<ShellContent ContentTemplate="{DataTemplate local:LoginCameraQR}" />
</Tab>
<Tab Title="Cupones" Icon="tagssolid.svg">
<ShellContent ContentTemplate="{DataTemplate local:LoginCameraQR}" />
</Tab>
<Tab Title="Favoritos" Icon="heartsolid.svg">
<ShellContent ContentTemplate="{DataTemplate local:LoginCameraQR}" />
</Tab>
<Tab Title="Acerca de Nosotros" >
<ShellContent ContentTemplate="{DataTemplate local:LoginCameraQR}" />
</Tab>
<Tab Title="Facebook" Icon="facebook.svg">
<ShellContent ContentTemplate="{DataTemplate local:LoginCameraQR}" />
</Tab>
<Tab Title="Instagram" Icon="squareinstagram.svg">
<ShellContent ContentTemplate="{DataTemplate local:LoginCameraQR}" />
</Tab>
</FlyoutItem>
And I want to change the color of these svg icons, any ideas?
I tried with style, but it did not work, the property is not valid
<Style TargetType="Tab" Class="FlyoutItemImageStyle">
<Setter Property="Background"
Value="AliceBlue"></Setter>
</Style>

If I understand you correctly, you want to set the TintColor of the svg Image. You could just set the TintColor for the Image in csproj file:
<MauiImage Include="Resources\Images\housesolid.svg" TintColor="#66B3FF" />
Hope it works for you.

Related

how can i move hamburger menu to right side on maui android?

I am making android/ios app using maui.
I want to move my hamburger button to right side.
this is my appshell.xaml.
<?xml version="1.0" encoding="UTF-8" ?>
<Shell
x:Class="MauiSample.AppShell"
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:views="clr-namespace:MauiSample.Views"
xmlns:local="clr-namespace:MauiSample"
FlowDirection="RightToLeft">
<FlyoutItem
FlyoutDisplayOptions="AsMultipleItems">
<ShellContent Title="Dog2s"
ContentTemplate="{DataTemplate views:DogsPage}" />
<ShellContent Title="Monkeys"/>
<ShellContent Title="Elephants"/>
<ShellContent Title="Bears"/>
</FlyoutItem>
<ShellContent
Title="Home 2"
ContentTemplate="{DataTemplate local:MainPage}"
Route="MainPage" />
</Shell>
I check added supportRtl="true" in android manifest.
android:supportsRtl="true"
I used FlowDirection="RightToLeft".
but not working on android.
working on ios.
Add this in your MainActivity.cs:
public class MainActivity : MauiAppCompatActivity
{    
protected override void OnCreate(Bundle savedInstanceState)    
{        
base.OnCreate(savedInstanceState);        
Window.DecorView.LayoutDirection = Android.Views.LayoutDirection.Rtl;    
}
}

How can I hide a tab of a Shell TabBar conditionally?

I have a .Net MAUI app. In AppShell, it has a TabBar:
<TabBar>
<Tab Title="Home" Icon="{StaticResource IconHome}">
<ShellContent ContentTemplate="{DataTemplate local:MainPage}" />
</Tab>
<Tab Title="Estimator" Icon="{StaticResource IconCalculator}" >
<ShellContent ContentTemplate="{DataTemplate calculator:CoverageCalculatorPage}" />
</Tab>
<Tab Title="Distributors" Icon="{StaticResource IconLocator}">
<ShellContent ContentTemplate="{DataTemplate locator:DistributorsLocatorPage}" />
</Tab>
<Tab Title="Scan QR" Icon="{StaticResource IconQrScanner}">
<ShellContent ContentTemplate="{DataTemplate qrScanner:QrScannerPage}" />
</Tab>
<Tab Title="More" Icon="{StaticResource IconMore}">
<ShellContent ContentTemplate="{DataTemplate more:MoreFeaturesPage}" />
</Tab>
</TabBar>
I need to hide the "Scan QR" tab when run on Windows, and show only on iOS or Android. I realize that there is IsVisible property of Tab, but how can I make it conditional, based on the platform?
You can use class DeviceInfo.Platform to get the platform information. And add a bool variable to bind to property IsVisible of Tab.
Please refer to the following code:
public partial class AppShell : Shell
{
      public bool IsVisible {get;set;}
      public AppShell()
      {
            InitializeComponent();
            if (Microsoft.Maui.Devices.DeviceInfo.Platform == DevicePlatform.iOS || Microsoft.Maui.Devices.DeviceInfo.Platform == DevicePlatform.Android)
            {
                  IsVisible = true;
            }
            else
            {
                  IsVisible = false;
            }
            
            BindingContext = this;
}
}
And bind variable IsVisible to property IsVisible:
<Tab Title="Scan QR" Icon="grass.png" IsVisible="{Binding IsVisible}">
<ShellContent ContentTemplate="{DataTemplate local:QrScannerPage}" />
</Tab>

material-ui wrapping Tab component with Link

I need to wrap the Tab components with a react-router Link compoenent. but considering the following code, when clicking on tabs yields no result. if it means the Tabs component must be direct parent of all Tab(s) component then how do I apply Link component?
<Tabs
value={tab}
onChange={(e, v) => setTab(v)}
>
<Link to={`${props.match.url}`}>
<Tab label="Content" />
</Link>
<Link to={`${props.match.url}/comment`}>
<Tab label="Comment" /
</Link>
<Link to={`${props.match.url}/create`}>
<Tab label="Create" />
</Link>
</Tabs>
you can provide Tab a component prop:
<Tabs
value={tab}
onChange={(e, v) => setTab(v)}
>
<Tab component={Link} to={`${props.match.url}`} label="Content" />
<Tab component={Link} to={`${props.match.url}/comment`} label="Comment" />
<Tab component={Link} to={`${props.match.url}/create`} label="Create" />
</Tabs>

Hidden anchor of functions in the treeview of doxygen

I use doxygen to generate documentation for my C# codes and enabled the treeview. However, the treeview in the left included the anchor of functions. How could I disable them? Thanks for any suggestion.
See an example below
I have solved this question by myself. Firstly I created a DoxygenLayout.xml and specified LAYOUT_FILE = DoxygenLayout.xml in the Doxyfile.
In the DoxygenLayout.xml, you need an empty child for memberdef. This is my own DoxygenLayout.xml:
<doxygenlayout version="1.0">
<navindex>
<tab type="mainpage" visible="yes" title=""/>
<tab type="pages" visible="yes" title="" intro=""/>
<tab type="modules" visible="yes" title="Groups" intro=" "/>
<tab type="namespaces" visible="yes" title="">
<tab type="namespacelist" visible="yes" title="" intro=""/>
<tab type="namespacemembers" visible="yes" title="" intro=""/>
</tab>
<tab type="classes" visible="yes" title="Functions">
<tab type="classlist" visible="yes" title="Function list" intro=""/>
<tab type="classindex" visible="$ALPHABETICAL_INDEX" title="Function index"/>
<tab type="hierarchy" visible="yes" title="" intro=""/>
<tab type="classmembers" visible="yes" title="" intro=""/>
</tab>
<tab type="files" visible="yes" title="">
<tab type="filelist" visible="yes" title="" intro=""/>
<tab type="globals" visible="yes" title="" intro=""/>
</tab>
<!-- <tab type="dirs" visible="yes" title="" intro=""/> -->
<tab type="examples" visible="yes" title="" intro=""/>
</navindex>
<!-- Layout definition for a class page -->
<class>
<briefdescription visible="yes"/>
<includes visible="$SHOW_INCLUDE_FILES"/>
<inheritancegraph visible="$CLASS_GRAPH"/>
<collaborationgraph visible="$COLLABORATION_GRAPH"/>
<allmemberslink visible="yes"/>
<memberdecl>
<!--
<nestedclasses visible="yes" title=""/>
<publictypes title=""/>
<publicslots title=""/>
<signals title=""/>
<publicmethods title=""/>
<publicstaticmethods title=""/>
<publicattributes title=""/>
<publicstaticattributes title=""/>
<protectedtypes title=""/>
<protectedslots title=""/>
<protectedmethods title=""/>
<protectedstaticmethods title=""/>
<protectedattributes title=""/>
<protectedstaticattributes title=""/>
<packagetypes title=""/>
<packagemethods title=""/>
<packagestaticmethods title=""/>
<packageattributes title=""/>
<packagestaticattributes title=""/>
<properties title=""/>
<events title=""/>
<privatetypes title=""/>
<privateslots title=""/>
<privatemethods title=""/>
<privatestaticmethods title=""/>
<privateattributes title=""/>
<privatestaticattributes title=""/>
<friends title=""/>
<related title="" subtitle=""/>
<membergroups visible="yes"/>
-->
</memberdecl>
<detaileddescription title=""/>
<memberdef>
<!--
<inlineclasses title=""/>
<typedefs title=""/>
<enums title=""/>
<constructors title=""/>
<functions title=""/>
<related title=""/>
<variables title=""/>
<properties title=""/>
<events title=""/>
-->
</memberdef>
<usedfiles visible="$SHOW_USED_FILES"/>
<authorsection visible="yes"/>
</class>
</doxygenlayout>

Specify title of a doxygen auto-gen class

Is there any way to specify the title of a class page auto generated by doxygen? So instead of "ClassName Class Reference" at the top of the page I could use my own text?
Or if not my own text I'd settle for just displaying "ClassName" (without the "Class Reference").
The screenshot below shows in green the text I am trying to get rid of ... so on this page I would like the title to simply be "WindSpeedSetting". Or even more ideally I'd like the title to be "WindSpeedSetting Table".
Here is an excerpt from my doxy file:
<navindex>
<tab type="mainpage" visible="yes" title=""/>
<tab type="classes" visible="no" title="">
<tab type="classlist" visible="no" title="" intro=""/>
<tab type="classindex" visible="no" title=""/>
<tab type="hierarchy" visible="no" title=""/>
<tab type="classmembers" visible="no" title=""/>
</tab>
<tab type="usergroup" url="[none]" visible="yes" title="Tables">
<tab type="usergroup" url="[none]" visible="yes" title="SCADA">
...
<tab type="user" title="WindSpeedSetting" url="#ref Radiance::Model::Scada::v12::WindSpeedSetting" />
</tab>
...
</tab>
</navindex>
<class>
<briefdescription visible="no"/>
<detaileddescription title="Description"/>
<memberdef>
<inlineclasses title=""/>
<typedefs title=""/>
<enums title=""/>
<constructors title=""/>
<functions title="" visible="no"/>
<related title=""/>
<variables title=""/>
<properties title="Columns"/>
<events title=""/>
</memberdef>
<allmemberslink visible="no"/>
<usedfiles visible="no"/>
<authorsection visible="no"/>
</class>
And then my C# class looks like this:
/// <summary>
/// \class WindSpeedSetting
/// A list of available anemometers in the system.
/// </summary>
public class WindSpeedSetting
{
/// <summary>
/// \property AlarmSpeed
/// \a float <br /><br />
/// </summary>
public virtual double AlarmSpeed { get; set; }
/// <summary>
/// \property AlarmTime
/// \a bigint <br /><br />
/// </summary>
public virtual TimeSpan AlarmTime { get; set; }
}
If you don't have a DoxygenLayout.xml you can create one following the steps described under Changing the layout of pages by the doxygen manual.
At the top of the file, you'll find the <navindex> tag containing the classes tab .
<navindex>
...
<tab type="classes" visible="yes" title="">
<tab type="classes" visible="no" title="THISISANEXAMPLE"/>
<tab type="classindex" visible="$ALPHABETICAL_INDEX" title="THISISMYTITLE"/>
<tab type="hierarchy" visible="yes" title=""/>
<tab type="classmembers" visible="yes" title=""/>
</tab>
...
focus on title="THISISANEXAMPLE"andvisible="no"`, to change visibility and/or title and you are finished.
I grabbed the source code of Doxygen from github and traced the "Class Reference" string to be a routine defined at line 585 of translate_en.h, specifically:
/*! used as the title of the HTML page of a class/struct/union */
virtual QCString trCompoundReference(const char *clName,
ClassDef::CompoundType compType,
bool isTemplate)
{
QCString result=(QCString)clName;
switch(compType)
{
case ClassDef::Class: result+=" Class"; break;
case ClassDef::Struct: result+=" Struct"; break;
case ClassDef::Union: result+=" Union"; break;
case ClassDef::Interface: result+=" Interface"; break;
case ClassDef::Protocol: result+=" Protocol"; break;
case ClassDef::Category: result+=" Category"; break;
case ClassDef::Exception: result+=" Exception"; break;
default: break;
}
if (isTemplate) result+=" Template";
result+=" Reference";
return result;
}
Which means the only way to make the "Class Reference" text disappear is either changing the language which will just replace "Class Reference" with a foreign language equivalent or patch the code.
To show the class name without the "Class Reference" string after it you can check the tag HIDE_COMPOUND_REFERENCE.