I'm using WinUI 2.8, and I want change Height of PaneToggleButton from my NavigationView.
Can someone help me?
<NavigationView PaneTitle="Test" IsPaneToggleButtonVisible="True" IsBackButtonVisible="Visible"></NavigationView>
#FrozenAssassine is showing the way to edit the default style of the native NavigationView control. Actually, you just need to check the PaneToggleButtonStyle. It will be created along with the NavigationView style automatically when you follow #FrozenAssassine steps. You could also find the generic.xaml (it saves all the default styles for all the native UWP controls.) in the \(Program Files)\Windows Kits\10\DesignTime\CommonConfiguration\Neutral\UAP\<SDK version>\Generic folder
If you are using the NavigationView control from the WinUI, you could also check WinUI's generic.xaml here: C:\Users\(username)\.nuget\packages\microsoft.ui.xaml\2.8.2\lib\uap10.0\Microsoft.UI.Xaml\Themes
You have to edit the default Styling of your NavigationView. This can be done by following the steps:
Open the Document outline(Ctrl + Alt + D) and your .xaml code file
In the document outline, right click on your NavigationView in the document outline and click on "Edit Template" -> "Edit a copy"
A window will pop up, and you can give the style a name.
The custom style will be added to your code
Search for: x:Name="TogglePaneButton"
This is the line of the button, you are looking for and you can now change its properties like normal
Here is also the documentation:
https://learn.microsoft.com/en-us/windows/apps/design/style/xaml-control-templates
Related
I am having a problem to realize how to use Font Awesome icons in my Xamarin application, I want to use it with ImageButtonas icon. And most tutorials I found didn't help me understand how it works.
As explained in Microsoft Documentation:
You need to first to have the font file I believe .ttf (or .otf).
Add it to your shared project.
Right click on the file and click on "properties", then set it build action to Embedded Resource.
Export it with a friendly alias name in your AssemblyInfo.cs or App.xaml.cs:
[assembly: ExportFont("file-name.ttf", Alias = "FontAwesome")]
Consume it:
<Label FontFamily="FontAwesome" Text=""/>
For the list of icons code take a look at FontAwesome codes.
If you want to use it with click capabilities like a button, then you can use a label with GestureRecognizers:
<Label FontFamily="FontAwesome" Text="">
<Label.GestureRecognizers>
<TapGestureRecognizer Tapped="TapGestureRecognizer_Tapped"/>
</Label.GestureRecognizers>
</Label>
UPDATE
Even better use an ImageButton with a FontImageSource property instead of a label, you have click capabilities of a button also I found interesting that you can change the color of your glyph icon, weather hard-coded or dynamically depending on the selected theme, here is an example:
<ImageButton>
<ImageButton.Source>
<FontImageSource FontFamily="FontAwesome"
Glyph="{x:Static fonts:IconFont.AddressBook}"
Color="{AppThemeBinding Dark=White,
Light=Black}"/>
</ImageButton.Source>
</ImageButton>
You can also define a static class having const string properties, each one having as value the code corresponding to an icon glyph and as name a description of it that way you will need to provide only the description instead of the code like I did with Glyph="{x:Static fonts:IconFont.AddressBook}", it will looks something like this:
static class IconFont
{
public const string Ad = "\uf641";
public const string AddressBook = "\uf2b9";
...
}
I invite you to follow this video tutorial and check out this GitHub Page which generate the static c# class for you starting from a font glyph file that you submit.
FontAwesome have multiple framework supported (Vue, React, Angular, WordPress, LESS, SCSS). But I don't know why they are not providing it for Xamarin Forms and MAUI.
I have created custom control for Xamarin Forms and MAUI.
Instructions are available at
https://www.nuget.org/packages/Brushtail.FontAwesome.Mobile/
Feedbacks are welcome.
I'm creating a Word Document using OpenXML. During the creation of the document, I need to create some custom styles.
Now I've one problem left: I want to put my custom styles inside the Quick Style Gallery, but I wasn't able to do that. The way that I'm following is explained in the following code:
var info = new LatentStyleExceptionInfo
{
Name = styleid,
PrimaryStyle = true,
UnhideWhenUsed = false,
SemiHidden = false,
UiPriority = 1
};
styleDefinitionsPart.Styles.OfType<LatentStyles>().First().Append(info);
Because I've found a link that tells that is the "PrimaryStyle" attribute responsible for put a Style inside the Quick Gallery.
Another thing: opening the styles.xml file, I've noticed that all the other styles has "1" or "0" for the OnOffValue, whereas the custom styles created with that piece of code has "true" or "false".
How can I solve it?
Thanks.
The XML tag that influences appearance of the style in the quick gallery is <w:qFormat/>. The API property that corresponds is Style.QuickStyle. The Interop name is also QuickStyle (boolean).
Btw, I don't think adding a latent style is going to help you. You'll want to add a real, actual, fully-fledged style if you want it to appear in the UI and be operative.
I am developing a paint like application. I want to change cursor at some instance. So, how can I use the custom cursor in metro app ?
I have found this
Window.Current.CoreWindow.PointerCursor = new Windows.UI.Core.CoreCursor(Windows.UI.Core.CoreCursorType.Custom, uint id);
In above method, there is one enum for "Custom" cursor and the second argument is for resource ID. So how can I get that ?
The basic route to doing this:
Create your custom cursor and package it in a .res using a C++ Metro DLL
Take a note of your resource id by peeking into the resource.h file in the C++ project
In my project the resource number was 101 and I didn't adjust.
Add the .res to a CSharp XAML Metro project
Open your .csproj using a text editor
Inside the first property group add a section that points to your .res file
Switch out the cursor to the custom cursor using the function call you referenced, and the resource number you found by peeking at resource.h.
Window.Current.CoreWindow.PointerCursor = new Windows.UI.Core.CoreCursor(Windows.UI.Core.CoreCursorType.Custom, 101);
I realize this is a lot. I posted a detailed step by step walk through on my blog at http://blogs.msdn.com/b/devfish/archive/2012/08/02/customcursors-in-windows-8-csharp-metro-applications.aspx . Hope this helps.
i'm trying to create a tab called about page under the setting in the charm(right bar). I want the tab About inside the settings and when clicked , it will load the information inside the snap view itself. I'm coding in C# , anyone have any idea about this?
Regards,
Binary
Yes, you have to register your About "page" as a SettingsCommand in order to get it to show up in the Settings charm.
I think you want an about link to show up when the user brings up the settings pane - and when clicked - that should show an about page in the settings pane itself - right?
If so, have a look at the Callisto project on github: it has a SettingsFlyout which you could use as follows:
var settingsFlyout = new SettingsFlyout();
settingsFlyout.Content = new YourSettingsControl(); //this is just a regular XAML UserControl
settingsFlyout.IsOpen = true;
Now, all you need to do is execute the code above, when the user clicks on your settings link. As to how the link itself shows up in the settings pane, see the App settings sample on MSDN.
Am using RichTextBox in a C#/Winforms application.
Am showing some text in this control which has got some UNC file paths embedded into it:
for example:
filePath= "\\serverName\DirName\File"
Richtextbox shows this file path as a clickable hyperlink in the UI.
filePath= "\\serverName\DirName\File.doc"
I want to show it as plain text instead.How do i achieve this?
Thanks.
There's a property you can change named DetectUrls. It is set to true by default, set it to false to get rid of the clicking behaviour e.g.
richTextBoxName.DetectUrls = false;
Or you can simply set it to false using the properties editor in Visual Studio.
http://msdn.microsoft.com/en-us/library/system.windows.forms.richtextbox.detecturls.aspx