xaml

How to make square buttons grid in Xamarin.Forms?

时光怂恿深爱的人放手 提交于 2020-04-11 18:50:01
问题 I'm trying to create a Xamarin.Forms content page similar to an activity I created for Android: So basically I want to have a grid of square buttons, which I could easily expand by adding more rows. My content page looks like that (only 1 row so far): <?xml version="1.0" encoding="utf-8" ?> <ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="TravelGuide.MainPage"> <ContentPage.Content> <ScrollView> <Grid x:Name="MainGrid">

How to make square buttons grid in Xamarin.Forms?

我的梦境 提交于 2020-04-11 18:48:05
问题 I'm trying to create a Xamarin.Forms content page similar to an activity I created for Android: So basically I want to have a grid of square buttons, which I could easily expand by adding more rows. My content page looks like that (only 1 row so far): <?xml version="1.0" encoding="utf-8" ?> <ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="TravelGuide.MainPage"> <ContentPage.Content> <ScrollView> <Grid x:Name="MainGrid">

SilverLight学习笔记--关于Silverlight资源文件(如:图片)的放置位置及其引用

回眸只為那壹抹淺笑 提交于 2020-04-08 06:46:12
Silverlight中有许多资源文件,例如:图片,音频、视频,甚至XML和XAML等非执行数据文件,在Silverlight中根据资源所处位置的不同而有所区别。 资源文件可分布在我们Silverlight项目的多个位置,在此我们将讨论以下三种情况及其相互间的关系。 1、镶嵌入程序集内 2、在.xap压缩包内而不镶嵌入任何程序集内 3、一个程序集引用另一个程序集内的资源 在操作本文实例前请先准备两个图片,分别是A.jpg和B.jpg,下面我们进入具体实验。 一、建立实验环境 首先,启动VS2008,新建项目,Silverlight应用程序,项目名命名为ResourceLocation,点击确定,VS2008将自动为我们建好了两个项目,一个名为ResourceLocation,一个名为ResourceLocation.Web。在解决方案下添加另一个项目,项目类型为Silverlight类库,项目名为ResourceAssembly,在此项目下,删除系统为我们自动建立的文件Class1.cs,因为我们用不着它。至此,我们在此解决方案下有三个项目,分别名为: ResourceLocation, ResourceLocation.Web, ResourceAssembly 然后,编程项目ResourceLocation的Page.xaml文件,最终代码如下: < UserControl x

Nibblestutotials.net教程 – Blend & Silverlight1系列之Animations

孤街醉人 提交于 2020-04-07 13:19:54
part1: rocket up Nibble将要教您Silverlight1.0中基本的动画创作。在第一部分,我们将要制作一个火箭升空的动画。 完成此教程,你需要安装Expression Blend 2的9月预览版。 本教程配套项目文件下载: part1 , part2 创建一个新的Silverlight 1.0项目。 a.打开Expression Blend 2的9月预览版。 b.选择 文件>新项目… 打开创建新项目对话框(如图)。 c.选择Silverlight Application (JavaScript)并点击OK。新项目被创建同时Page.xaml出现在画布中。 导入并打开Rocket插图(XAML)。 a.在属性面板的"文件"的项目名上右击并选择添加已存在项目… b.浏览到项目文件夹中的rocket.xaml文件。(如图) c.点击打开按钮导入XAML文件。 这个XAML包含了我们将用来制作动画的rocket的插画。XAML文件中插画是由一系列的路径(矢量图形)组成的。 d.在属性面板的"文件"中双击刚导入的rocket.xaml文件。这样您就应该能在"舞台"中看到rocket了。 由Rocket.xaml中拷贝插画。 a.在交互面板"对象与时间轴"中选择rocket项。 b.按Ctrl+C将图像拷贝到剪切板。 粘贴插画到Page.xaml a.选择Page

深入理解MVVM模式中Silverlight的Trigger、Action和Behavior及Silverlight的继承机制

让人想犯罪 __ 提交于 2020-04-07 08:46:03
  接触Silverlight已经有两三个月了,开始一直感觉他和Winform很相似,拖拖控件就行了,所以一直把经历放在了研究后台和服务器交互和性能优化上面,很少去仔细研究Silverlight的页面。前几天,公司突然让修改一个Winform的项目,再回过头来看Winform,有种"不堪回首"的感觉。   十一长假即将来临,在这里先祝大家假期快乐。今天难得有空,抽出点时间研究了一下Silverlight的继承和触发器,拿出来和大家分享一下。Silverlight和WPF中页面布局使用的都是XAML,颇为相似,学习WPF的也可以参考一下。 一、Silverlight中的继承   那么先来说一下Silverlight中的继承吧,我们经常在后台代码中使用继承,实现代码的重用。那么在前端页面是否可以使用继承,实现代码和控件的重用呢?答案是可以的。通过学习继承,我们可以更深入的理解XAML。下面来写一个Demo,一起来看一下,首先新建一个Silverlight项目,名字就叫SLDemo吧,添加默认的网站,建完项目后目录如下: 既然要说继承,那么首先要有个父类,新加一个Class,名字就叫BaseView,添加一些属性,代码如下: using System; using System.Net; using System.Windows; using System.Windows

RichTextBox Binding is broken when text is manually modified or cleared

北慕城南 提交于 2020-04-07 08:09:30
问题 I have a RichTextBox bound to a string. Using C# I generate a string that writes to it. But if I want to manually change the text by clicking into the RichTextBox and deleting it with the backspace key, or pressing Enter to make a new line, the binding becomes broken and I can no longer programmatically write to it with the string a second time. XAML <RichTextBox x:Name="rtbScriptView" Margin="11,71,280,56" Padding="10,10,10,48" FontSize="14" Grid.ColumnSpan="1" VerticalScrollBarVisibility=

Nibblestutotials.net教程 – Blend & Silverlight1系列之Button Advanced

◇◆丶佛笑我妖孽 提交于 2020-04-07 07:41:42
文中源文件下载地址: part1 , part2 creating multiple buttons: creating the key class 这一小部分(nibble)中将教您怎样使用复制同一XAML文件的方法创建多个按钮。我们将使用一个名为Key.xaml的文件制作一个数字键盘。 我们将使用提供的图像及动画开始教程。如果您对在Blend的中绘图及制作动画还有疑问请查看Buttons Basics这部分。 完成此教程,你需要安装Expression Blend 2的9月预览版及Visual Studio 2005、Orcas Beta版或以上版本。 打开提供的项目文件 用Blend打开提供的项目文件: a. 选择 文件 > 打开项目… b. 浏览到你的项目文件夹。 c. 双击 keyboard.csproj文件。 这个项目中,你会找到运行一个Silverlight程序所需的所有文件,需要注意以下两个文件: Scene.xaml:这个文件是空文件。我们将使用JavaScript来创建按钮而不是Blend。 Key.xaml:这是我们的数字键盘所需要的图片。注意这个XAML文件有两条时间轴:mouseEnter和mouseLeftButtonDown。它们将在代码的驱动下创建按钮的状态。 创建一个新的JavaScript文件(Key.js) a. 在项目面板文件区域中

DataBinding in WPF?

狂风中的少年 提交于 2020-04-06 22:11:54
问题 I'm trying to get databinding set up in WPF. I've got the class person, which is updated (oldschool-like) through the one textbox, and the other textbox is supposed to mirror the change to the person object through a databinding (it used to be a type=twoway but that threw an xamlparseexception). It doesn't work like that, and hitting the button that shows the person.name and it shows the correct name but the textbox doesn't get updated via the databinding. Is this a bad way to try to

DataBinding in WPF?

有些话、适合烂在心里 提交于 2020-04-06 22:11:08
问题 I'm trying to get databinding set up in WPF. I've got the class person, which is updated (oldschool-like) through the one textbox, and the other textbox is supposed to mirror the change to the person object through a databinding (it used to be a type=twoway but that threw an xamlparseexception). It doesn't work like that, and hitting the button that shows the person.name and it shows the correct name but the textbox doesn't get updated via the databinding. Is this a bad way to try to

【UWP】通过 MarkupExtension 实现 ValueConveter 的依赖注入

隐身守侯 提交于 2020-04-03 12:47:15
最近是真的比较闲,花了点时间算是把我自己的微博库的 nuget 包的坑填上了( https://github.com/h82258652/HN.Social.Weibo 欢迎大佬来 Star)。 dino 大佬也一直忽悠我弄动画,可惜我没啥艺术细胞而且 Composition API 也不太熟悉,就只能逃了(哈哈哈 )。闲着无事就刷刷 Github,看到 wpf repo 的一个 issue( https://github.com/dotnet/wpf/issues/499 ),确实目前的 XAML 跟控制反转这块几乎都没啥结合。控件层面由于要求无参构造函数,所以目前来看难以实现了。但 ValueConverter 这玩意,想了下,好像可以耶,于是做了下实验,成功并且写下了这篇 blog。 UWP 的 MarkupExtension 是在 16299 版本引入的,所以我们的项目必须要 target 16299 或以上。 以一般 MVVM 模式为例,创建 ViewModelLocator.cs,这里 IoC 容器我就使用最常用的 Autofac 好了,引用 Autofac.Extras.CommonServiceLocator 包。 public class ViewModelLocator { static ViewModelLocator() { var