I'm trying to style the ComboBox control in XAML but haven't managed to style the colors in the dropdown/popup. The ComboBox seem to contain a ScrollViewer so I'm trying to style that. The items in the ScrollViewer is generated using a ContentTemplate and I guess I need to style it somehow.
Check this default system brush. You can customize these colors by adding below line in resource dictionary.
<SolidColorBrush x:Key="ComboBoxArrowForegroundThemeBrush" Color="MY_COLOR_HEX_CODE"/>
Related
I'm using Microsoft.UI.Xaml.Controls.NavigationView. For some reason, I have to change NavigationView's pane background.
So I changed in XAML.
<Page.Resources>
<SolidColorBrush x:Key="NavigationViewDefaultPaneBackground" Color="{StaticResource ViuPageBackgroundColor1}" />
</Page.Resources>
But now I want to achieve this in cs code, how to do that.
The NavigationViewDefaultPaneBackground brush is used for a property called PaneBackground of the Splitview control. The Splitview control called RootSplitView is one of the components of Navigationview.
If you want to change the PaneBackground property in code-behind, you need to search in the NavigationView's template and find the Splitview control by name -RootSplitView. Then when you get the Splitview control, you could change the PaneBackground as you want.
Using a Xamarin Forms ListView with a custom ViewCell, is it possible to have a list item expand based on an event? Please ignore the orange lines, but reference the below picture...
Regular cell not expanded
User has tapped the triple dots causing the ViewCell to expand to show additional content
Is this possible? What is the technique to make that work?
You can have containers or elements inside your viewcell whose Visibility can be controlled based on the click. You will have to re render the elements once its expanded or collapsed for the viewcell to resize. Or else you will have the Viewcell being the size it was initially rendered, but the contents inside it overflowing.
Check out the following links :
How to implement Expandable/Collapsible ListView in xamarin forms?
CollapseListView-in-xamarin.forms
ExpandableListView
I want to keep an always topmost canvas on a listview. Canvas should be stretch on window and if the user tries to scroll listview, listview must scroll but canvas must be topmost transparently and user can see listview. My XAML tree like below that:
<Grid>
<ScrollViewer>
<ListView>
</ListView>
</ScrollViewer>
<Canvas Name="DxPanel"></Canvas>
</Grid>
I am trying to make a note taking app. The reqirements like that:
Each listview has image or richeditbox control (I have already done it)
The user can draw something on image or rich text
The listview must have infinite scroll ability and data of list view must retrieve from database and data and UI recycling must be supported.
The drawing layer must be endless scroll
I know this is hard challenge. I am planning to save stroke , and text data in db and image data in disk.
First of all, I need to say, there is no need to put a ListView inside a ScrollViewer, by default ListView can be scrolled if there are many items, this is because there is a ScrollViewer inside the template of ListView, you can refer to the default ListView styles and templates.
Then, if your Canvas keeps covering the ListView, there is no way for your ListView to get focused, let alone make the ListView scrolling. So I suggest you to rethink about this, why should your Canvas be topmost transparently?
If you want your ListView can be scrolled/focused, and in the meanwhile your layout in the Canvas can be seen, then you can put the ListView above the Canvas, by default the background of ListView is transparent.
You can leave a comment to tell us what is in your Canvas, why this Canvas should be stretch and placed on the top of the ListView, maybe we can try to find other way to solve your problem.
I have created an app starting from the Grid App template (C#/XAML) of Visual Studio 2012. I'm using the Light Theme and I have customized the GridViewItem brushes so that the color blue is used when I move the mouse over an item.
Now I would like to change the foreground color of the text that is shown in the GridView when the mouse is over the item, using white to make it more readable. Is it possible, considering that the layout of GridView items is defined in a DataTemplate?
Here is an blog post which demonstrates styling of GridViewItem.
How do I change a button's background image in a Metro Style app using VS 2012?
In Windows Forms, a button has a BackgroundImage property that you can set.
Is this feature available for Metro Style apps?
In Windows Forms, I can do the following in C#:
btnImage.BackgroundImage = System.Drawing.Image.FromFile("...\Pictures\flower.png");
How can you programmatically change the button's background image in Metro Style apps ?
Pretty straightforward, actually, just modify the Button's XAML to include a closing tag, and drop an image control in between, like so:
<Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}">
<Button HorizontalAlignment="Left" Margin="532,285,0,0" VerticalAlignment="Top" Height="135" Width="283">
<Image Source="Assets/Logo.png" />
</Button>
</Grid>
In the snippet above, I'm pointing the image source to the Logo.png file that is part of the built-in templates for C#/XAML apps.
Another way to do it is to open the project in Blend for Visual Studio, drag the image from the Assets tab onto the design surface (making sure you have the desired container selected in the Objects and Timeline pane), and then right-click the image and select Make into Control..., and choose the Button control.
The only downside to this technique is that you don't get the default VisualStates that the built-in Button control has. Instead, Blend defines a style for you with empty VisualStates which you can style as desired.
Hope that helps.