uwp-xaml

Xamarin forms relative layout position stacklayout at bottom

元气小坏坏 提交于 2020-01-04 03:13:30
问题 I would like to position a Stacklayout at the bottom on top of an image using a relative layout using Xamarin forms using xaml only. The xaml pretty much looks like this. <RelativeLayout> <Image /> <StackLayout Orientation="Horizontal"> <Label Text="Dark Mode" /> <Switch /> <Label Text="Light Mode" /> </StackLayout> </RelativeLayout> What X and Y constraints should my StackLayout have so that it is positioned on top of the image and at the bottom of it.Also added an image which describes the

Alternate color for listview item UWP

ぐ巨炮叔叔 提交于 2020-01-02 04:39:18
问题 I have a class to color alternate the background of item, but if I delete a item, the background color does not update. Is there a way to refresh the background color after deleting an item? The code for alterante color. class listview: public class AlternatingRowListView : ListView { protected override void PrepareContainerForItemOverride(DependencyObject element, object item) { base.PrepareContainerForItemOverride(element, item); var listViewItem = element as ListViewItem; if (listViewItem

How to find a control with a specific name in an XAML UI with C# code?

喜夏-厌秋 提交于 2020-01-01 11:47:48
问题 I have dynamic added controls in my XAML UI. How I can find a specific control with a name. 回答1: There is a way to do that. You can use the VisualTreeHelper to walk through all the objects on the screen. A convenient method I use (obtained it somewhere from the web) is the FindControl method: public static T FindControl<T>(UIElement parent, Type targetType, string ControlName) where T : FrameworkElement { if (parent == null) return null; if (parent.GetType() == targetType && ((T)parent).Name

How to find a control with a specific name in an XAML UI with C# code?

偶尔善良 提交于 2020-01-01 11:47:26
问题 I have dynamic added controls in my XAML UI. How I can find a specific control with a name. 回答1: There is a way to do that. You can use the VisualTreeHelper to walk through all the objects on the screen. A convenient method I use (obtained it somewhere from the web) is the FindControl method: public static T FindControl<T>(UIElement parent, Type targetType, string ControlName) where T : FrameworkElement { if (parent == null) return null; if (parent.GetType() == targetType && ((T)parent).Name

Center aligning GridView items in last row

我是研究僧i 提交于 2019-12-30 11:31:33
问题 I want to implement a GridView which takes 3 items in a row, and if the number of items are 2 in last row, then the last row items should be aligned center instead of being left-aligned. Here are a couple of images to explain what I want to achieve. Currently my implementation looks like . And this is what I want to achieve. Any help would be appreciated. 回答1: There are many ways realizing the feature that you mentioned. To summarize it, you need to inherit GridView and override

How to resolve the Blurness issue in print Preview of UWP?

微笑、不失礼 提交于 2019-12-26 01:04:52
问题 I am familiar with the data grid in the UWP plat form. we tried to provide the support for printing the results in sheets. we have faced the hurdles while we print the content. In the print preview panel the content looks like blurry to the view, but in the printed sheet the contents look like normal. could your share your ideas to resolve this. Thanks in advance for your updates. 回答1: It seems it is by design. In UWP, we use the PrintManager to inform Windows that an application wishes to

How to sync ui to full screen or compact mode using MediaPlayerElement

会有一股神秘感。 提交于 2019-12-25 18:43:51
问题 I'm using MediaPlayerElement , when my app window in normal size, I have a Button and a TextBox on the MediaPlayerElement . But when I click fullscreen or compact button to enter fullscreen or compact mode, they disappeared. How to show them in full screen or compact mode? A helpfull repo is here, sync the TextBox to fullscreen. 回答1: For your requirement, you could custom your MediaTransportControls and found ControlPanel_ControlPanelVisibilityStates_Border in the style. Then add your element

Display image depending on application theme

元气小坏坏 提交于 2019-12-25 18:25:01
问题 I am develop an UWP app, and I am using Template 10. I have a black image and a white image. I want when the user choose dark theme, show the white image, and when the user choose light theme show the black image, exemple: if(dark theme) { white image; } else { black image; } 回答1: You can get current RequestedTheme using this.RequestedTheme and then compare it with ElementTheme.Light or ElementTheme.Dark Method 1 if (this.RequestedTheme == ElementTheme.Light) BackgroundImage.Source = new

multiple selection on custom picker C# UWP

允我心安 提交于 2019-12-25 12:52:12
问题 I've been looking on forums and internet about a custom picker on C#, I have a picker already functional, but some of my research throw me that you are only able to select 1 item of the custom Picker, this is the code im using to deploy the picker. Picker <custom:CustomPicker x:Name="pickerCategories" ItemsSource="{Binding listCategoriesName}" SelectedIndex="{Binding SelectedCategory}" SelectedIndexChanged="pickerCategories_SelectedIndexChanged" Grid.Column="1" BackgroundColor="White"/> the

Styling for ListBox, ListView and GridView Items

こ雲淡風輕ζ 提交于 2019-12-25 12:45:17
问题 The default colors for these controls seems to be similar to the Windows theme colors. How do you change the hover, selected, selected hover and pressed colors (code or XAML)? The following isn't working for the ListView: <ListView> <ListViewItemPresenter PointerOverBackground="#99CEEA" SelectedPressedBackground="#72BFE9" SelectedBackground="#72BFE9" SelectedPointerOverBackground="#99CEEA" /> 回答1: In your VS/Blend Designer, right click on your ListView and select Edit Additional Templates >