xaml

UWP XAML add data binding outside datatemplate

丶灬走出姿态 提交于 2020-02-07 02:36:23
问题 I'm trying to add button to this datatemplate but I cannot access the ICommand EditTripClick Command from the ViewModel. So I am wondering is it possible to access it although I am in a datatemplate? Example code of what I want to do <CommandBar OverflowButtonVisibility="Auto"> <AppBarButton Label="Add trip" Icon="Add" Command="{x:Bind ViewModel.NewTripClickCommand}"/> <AppBarButton Label="Refresh" Icon="Refresh" Command="{x:Bind ViewModel.RefreshClickCommand}"/> </CommandBar> <controls

Creating Xamarin.Forms view that shows paragraph where each sentence is clickable

不羁岁月 提交于 2020-02-06 07:49:05
问题 I have a requirement to create a view on Xamarin.Forms that displays an array of strings in a paragraph. Each sentence should be: 1. Free flowing one after the other on the same line 2. Clickable so that it can be navigated upon click Also, it is desirable to have such a paragraph justify aligned. Here is the envisioned wireframe of the requirement. I have highlighted each string with alternating colors to illustrate how the list of strings (sentences) must ingest into a free flowing

Silverlight multiple line textbox

限于喜欢 提交于 2020-02-06 05:38:25
问题 I have looked at several code snippets where people suggest that the AcceptsReturn property of a textbox in Silverlight will enable multiple lines. My problem however is when I add a textbox with said property and explicity set the height or allow it to fill the container, the text sits vertically in the middle of the textbox. <Grid x:Name="LayoutRoot" > <TextBox TextWrapping="Wrap" Text="TextBox" AcceptsReturn="True"/> </Grid> I need the text to anchor to the top of the textbox. 回答1: Ensure

System.NotSupportedException: SVG element “style” is not supported with Xamarin Forms

余生颓废 提交于 2020-02-06 04:59:10
问题 I am builidng a XAML UI, with Xamarin.Forms, using this nuget plugin. I have followed the guide and have the following layout: <Grid VerticalOptions="Center" HorizontalOptions="Center" BackgroundColor="#3DBEAF" > <Grid.RowDefinitions> <RowDefinition Height="10" /> <RowDefinition Height="Auto" /> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition Width="10" /> <ColumnDefinition Width="Auto" /> </Grid.ColumnDefinitions> <abstractions:SvgImage Grid.Row="0" Grid.Column="0"

WPF MenuItem.Icon dimensions

浪尽此生 提交于 2020-02-06 03:58:12
问题 So I have a MenuItem (within a ContextMenu, if it really makes a difference, don't think it does). I want to display an icon within the MenuItem using the MenuItem.Icon property. Here is XAML code that does this: <MenuItem Header="MenuItem1"> <MenuItem.Icon> <Image Source="[pathtoimage]"/> </MenuItem.Icon> </MenuItem> This works. But what if I want to specify the size of the icon with Height and Width ? Search on the web reveals that it should be 32, some say it should be 20. 20 works the

InvalidOperationException delegation UI Thread C#

梦想与她 提交于 2020-02-06 03:31:15
问题 I'm getting InvalidOperationException . This code is running in a thread. I've delegate it to the UI thread to handle the UI. Is the problem occuring because of my resources? BitmapImage logo = new BitmapImage(); logo.BeginInit(); logo.UriSource = new Uri("pack://application:,,,/LiarDice;component/" + imagePath); logo.EndInit(); currentGuessDice.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { currentGuessDice.Source = logo; })); I changed my code

wpf path xaml写法和c#写法对比

谁说我不能喝 提交于 2020-02-06 00:22:42
转载自:https://www.c-sharpcorner.com/UploadFile/mahesh/path-in-wpf/ wpf path的c#写法,没有找到很多案例,对于很多需要代码去生成 路径点集合 的需求,可能还需要了解一下 path的c#写法。 xaml <Window x:Class="_1_5GraphicsWpf.Window3" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:_1_5GraphicsWpf" mc:Ignorable="d" Title="Window3" Height="800" Width="1200"> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="*"><

重新想象 Windows 8 Store Apps (30) - 信息: 获取包信息, 系统信息, 硬件信息, PnP信息, 常用设备信息

谁说胖子不能爱 提交于 2020-02-05 14:58:28
[源码下载] 重新想象 Windows 8 Store Apps (30) - 信息: 获取包信息, 系统信息, 硬件信息, PnP信息, 常用设备信息 作者: webabcd 介绍 重新想象 Windows 8 Store Apps 之 信息 获取包信息 获取系统信息 获取硬件信息 获取即插即用(PnP: Plug and Play)的设备的信息 获取常用设备信息 示例 1、演示如何获取 app 的 package 信息 Information/PackageInfo.xaml.cs /* * 演示如何获取 app 的 package 信息 */ using System; using Windows.ApplicationModel; using Windows.UI.Xaml.Controls; using Windows.UI.Xaml.Navigation; namespace XamlDemo.Information { public sealed partial class PackageInfo : Page { public PackageInfo() { this.InitializeComponent(); } protected override void OnNavigatedTo(NavigationEventArgs e) { Package

RadioButton TwoWay Binding Issues

天大地大妈咪最大 提交于 2020-02-05 09:24:50
问题 Consider the below simplified application, which allows you to select between two elements, each of which has A and B boolean properties that are bound to radio buttons. The idea is that you should be able to set A/B independently for each element and if you switch between elements, the radio buttons should reflect the flags for that element. This isn't what happens however. ViewModel: using System; using System.Collections.Generic; using System.ComponentModel; using System.Linq; using System

How to find dynamically created XAML component by Name in C#?

别等时光非礼了梦想. 提交于 2020-02-05 08:16:06
问题 How to find dynamically created XAML component by Name in C#? I created next button and put it into the Stack Panel. var nextButton = new Button(); nextButton.Name = "NextBtn"; next.Children.Add(nextButton); then tried to find it with this.FindName("NextBtn") and it always comes null. What am I doing wrong? 回答1: Use RegisterName instead of nextButton.Name = "NextBtn"; var nextButton = new Button(); RegisterName("NextBtn", nextButton); next.Children.Add(nextButton); You can then find it with: