Rectangle_MouseLeftButtonUp事件,因为矩形Fill属性为null,没有填充,相当于透明,所以鼠标点击穿透矩形,点到下面的东西上去了 解决办法:设置Fill="#00000000" 即设置一个完全透明的颜色 d:DesignWidth...=640,d:DesignHeight=480,这二个标记在blend中特别有用 <UserControl x:Class="MsShowCase.NavItem" xmlns="http://schemas.microsoft.com...schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" Height="Auto" Width="Auto" d:DesignWidth...=640 d:DesignHeight=480 ...
在web开发中,带checkbox的tree是一个很有用的东东,比如权限选择、分类管理,如果不用sl,单纯用js+css实现是很复杂的,有了SL之后,就变得很轻松了 解决方案一: 利用Silvelright...this, new PropertyChangedEventArgs(propertyName)); } } } } 好了,开始干正事儿了: toolkit中的...xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" d:DesignHeight...="300" d:DesignWidth="400" xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/...="300" d:DesignWidth="400" xmlns:common="clr-namespace:BusinessObject;assembly=BusinessObject"
实际开发中控件的数据源肯定是动态绑定的,不可能在xaml里写死item项。...IsSelected属性在绑定时自动转换成CheckBox的CheckState,需要写一个转换器 using System; using System.Windows.Automation; using...default: break; } return result; } } } 然后需要定义数据模板...RadContextMenu.ContextMenu> 这里面用到了几个资源,定义在全局...="300" d:DesignWidth="400" xmlns:local="clr-namespace:Telerik.Sample" xmlns:telerik="http:
自学WP7做的第一个程序:时钟 做的很山寨,没用素材 用TextBlock做的表盘和指针,放在一个Canvas上 RotateTransform类来控制偏移角度 MainPage.xaml <phone..." xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" d:DesignWidth...="480" d:DesignHeight="768" FontFamily="{StaticResource PhoneFontFamilyNormal}" FontSize="{StaticResource...PhoneFontSizeNormal}" Foreground="{StaticResource PhoneForegroundBrush}" SupportedOrientations...Grid.Row="0" Margin="12,17,0,28"> StaticResource
Common.Silverlight" xmlns:bo ="clr-namespace:BusinessObject;assembly=BusinessObject" mc:Ignorable="d" d:DesignHeight...="300" d:DesignWidth="400"> StaticResource cboItemTemplate}" 数据项模板--> StaticResource objCollection}" 数据源--> <!...cboItemTemplate}" ItemsSource="{StaticResource objCollection}
码云链接[2]:https://gitee.com/WPFDevelopersOrg/WPFDevelopers 框架支持.NET4 至 .NET8; Visual Studio 2022; 逻辑实现 在本篇将介绍如何在...TabControl 中为每个 TabItem 添加一个关闭按钮。...将使用一个附加属性来控制关闭按钮的显示和隐藏。通过自定义 ControlTemplate,可以为 Tab 页提供关闭操作。 TabItem 逻辑如下 在每个 TabItem 的右侧添加一个关闭按钮。...使用附加属性来控制关闭按钮的显示和隐藏。 1. 定义 TabItem 样式 通过 XAML 中的样式为 TabItem 设置外观,并添加一个关闭按钮。...="450" d:DesignWidth="800" mc:Ignorable="d"> <UniformGrid Margin="0,10" Columns
Drawer 的自定义控件,继承自 HeaderedContentControl,允许用户在应用程序中创建可展开和收起的抽屉。...抽屉的显示和隐藏动画通过 Storyboard 实现,支持从不同方向(左、上、右、下)展开和收起。...1.定义模板 使用 TemplatePart 特性定义了两个模板:BorderHeaderTemplateName 和 BorderMarkTemplateName,分别代表抽屉的头和蒙板部分。..._exitStoryboard.Begin(); } } } 5.模板应用 OnApplyTemplate 方法在控件模板应用时调用,获取模板中的 Border 部件并注册...Loaded 和 MouseDown 事件。
UI 的卡住不同于 IO 操作或者密集的 CPU 计算,WPF 中的 UI 卡顿时,我们几乎没有可以让 UI 响应的方式,因为 WPF 一个窗口只有一个 UI 线程。 No!...WPF 一个窗口可以不止一个 UI 线程,本文将设计一个异步加载 UI 的容器,可以在主线程完全卡死的情况下显示一个加载动画。...="450" d:DesignWidth="800" FontSize="48" FontFamily="Monaco"> StaticResource...由于这两棵树不在同一个线程中,于是主线程即便卡死,也不影响后台用来播放加载动画的线程。
Telerik.Windows.Controls.TransitionEffects;assembly=Telerik.Windows.Controls" mc:Ignorable="d" d:DesignHeight...="313" d:DesignWidth="500" > <!...PhotosCollection}" ItemsPanel="{StaticResource HorizontalItemPanel}" ItemTemplate="{StaticResource...HorizontalAlignment="Right" Margin="5" SelectedIndex="0" ItemContainerStyle="{StaticResource...PhotoListItemStyle}" Style="{StaticResource PhotoListStyle}"/> </Grid
如何去做这个控件,我们可以用自定义控件 新建一个用户控件,可以按 ctrl+shift+a 打开后,选用户控件 我们可以用 Rectangle 做圆形边 只要 Rectangle RadiusX>0... 我们做10个 Rectangle 使用 RectangleStyle1 在...Rectangle 使用 style="{StaticResource RectangleStyle1}" 可以看到我们除了中间,其他都和原来一样。...xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" d:DesignHeight...="300" d:DesignWidth="400">
调用initAutoLayoutConfig方法,初始化 懒汉单例的AutoLayoutConifg对象 ---- 剩下的 2个前面用到的方法 在AutoXXXLayout中 都只是通过 关联和依赖...() generateLayoutParams(AttributeSet attrs)中 调用的静态内部类,接口的实现,其实是构造中 mAutoLayoutInfo = AutoLayoutHelper.getAutoLayoutInfo...array.recycle(); L.e(" getAutoLayoutInfo " + info.toString()); return info; } 这里类中定义了很多静态的...int值,用于switch, 也有定义的LL静态数组,对应android中常用的属性 ?...Paste_Image.png 这里获得这些常用属性以后,for循环会通过int的静态值,switch对应的地方 在添加到 容器类 AutoLayoutInfo 的对象中 (也就是 前面提到的接口实现返回的
看到一个圆形好像微软 ProgressRing 控件 如何去做这个控件,我们可以用自定义控件 新建一个用户控件,可以按 ctrl+shift+a 打开后,选用户控件 我们可以用 Rectangle...Rectangle 使用 style="{StaticResource RectangleStyle1}" 可以看到我们除了中间,其他都和原来一样。...注意 local 是我们的命名空间,我们的控件就放在方案的目录,不放在其他文件夹,命名空间也是和方案默认一样。...xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" d:DesignHeight...="300" d:DesignWidth="400">
看到一个圆形好像微软 ProgressRing 控件 如何去做这个控件,我们可以用自定义控件 新建一个用户控件,可以按 ctrl+shift+a 打开后,选用户控件 我们可以用 Rectangle... 我们做10个 Rectangle 使用 RectangleStyle1 在...Rectangle 使用 style="{StaticResource RectangleStyle1}" 可以看到我们除了中间,其他都和原来一样。...xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" d:DesignHeight...="300" d:DesignWidth="400">
ListBox是一个很有用的控件,其功能直逼Asp.Net中的Repeater,它能实现自定义数据项模板,纵向/横向排列Item(如果扩展一下实现自行折行,几乎就是SL版的Repeater了--实际上WrapPanel...已经实现了,不过没有默认集成在SL3中). ...}" ItemContainerStyle="{StaticResource ItemStyle}"> 这段代码中,...ListBox本身空空如也(除了几个样式和模板的应用),最终的呈现内容和外观,全部在UserControl.Resource中定义了,运行后界面肯定是空的,因为没有数据绑定,我们给它加上后端代码: Xaml.cs...="640" d:DesignHeight="480"> <!
MVVM设计模式是指模型(Model)-视图(View)-视图模型(ViewModel),MVVM设计模式能够将程序的UI设计和逻辑设计分开,这样能够节省开发人员的大量时间,也可以使代码更容易维护和升级等...View是指UI,是用来展示的,Model可以定义一些数据访问的实体类,ViewModel是连接model层和view层的桥梁,它是中间层,主要用来一些业务逻辑的设计,这里包括与数据库的交互。...2.在Model中添加类Questionnaire 1 /// 2 /// 定义Model,如果需要监听属性的变化,需要继承INotifyPropertyChanged...文件夹中添加QuestionView,用来显示 d:DesignHeight="300" d:DesignWidth="400"> 在MainPage主页面添加已经设计好的页面。
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 10 mc:Ignorable="d" d:DesignWidth...="480" d:DesignHeight="768" 11 FontFamily="{StaticResource PhoneFontFamilyNormal}" 12 FontSize...="{StaticResource PhoneFontSizeNormal}" 13 Foreground="{StaticResource PhoneForegroundBrush}" 14...Margin="10" Foreground="{StaticResource PhoneAccentBrush}" FontSize="24" TextAlignment="Center"/> 57...Margin="10" Foreground="{StaticResource PhoneAccentBrush}" FontSize="24" TextAlignment="Center"/> 59
TemplatedControl 在UWP中自定义控件常常会遇到这个问题:使用UserControl还是TemplatedControl来自定义控件。...1.2 使用CustomControl自定义控件 继承自Control或其派生类。 代码和XAML分离,可以没有XAML。 可以使用ControlTemplate。...控件库中的控件通常都是CustomControl。 优点: 更加灵活,容易扩展。 UI和代码分离。 缺点: 较高的上手难度。 使用场景: 需要一个可以扩展功能的灵活的控件。 需要定制UI。...可以直接访问XAML中的元素。 ? 当然坏处也不少: 不可以通过ControlTemplate修改UI。 难以继承并修改。 UI和代码高度耦合。...然后用普通的方式新建一个UserControl,在XAML和CodeBehind中将基类改成DateTimeSelectorBase,如下所示: <local:DateTimeSelectorBase
在制作UWP个人项目时需要用到数据绑定,网上的教程大都不全,特此记录下自己使用的方法。 绑定源 指定一个类用来保存数据,以我自己的项目为例,需要定义“邮件”类。...文件头定义命名空间 由于我的Email类在MailSystem_UWP.Bean下,因此定义该命名空间为local xmlns:local="using:MailSystem_UWP.Bean" 在xaml...408"/> {x:Bind name}指向绑定源的name属性,你需要实现name的get和set..." xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" d:DesignWidth...="744" d:DesignHeight="532"> <DataTemplate x:Key="EMAIL" x:DataType="local
在 Web 项目中,我们免不了使用一些诸如图片、音频、视频、字体之类的在我们的程序中非可执行的数据文件,习惯称之为资源文件。...在Silverlight中,使用这些资源文件的方法有很多,比如官方的说法: 作为应用程序包中的单个文件。 作为按需检索的单个文件。 作为嵌入应用程序包的程序集中的文件。...对于 Silverlight 来说,我们可以将资源发布到 xap 的包中,也可以部署到其所在的网站,控制这个的一个重要的选项就是我们在 Build 工程时的一个 build action 属性。...1.png 下面讨论三种在工程中引用资源的方法:资源 Resource、内容 content 和 none。 ...Margin="250,50,0,0" Width="200"> 虽然引用的方式没有变化,但是此时我们必须将 jpg 和
Avalonia使用默认弹窗 在Avalonia中使用官方默认弹窗WindowNotificationManager Views\MainWindow.axaml相关代码 <Window xmlns="...xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" d:DesignWidth...="800" d:DesignHeight="450" x:Class="ApplicationDemo.Views.MainWindow" Icon="/Assets/..., NotificationType.Error)); } } 效果如图 图片 在组件中使用WindowNotificationManager 修改Views\MainWindow.axaml...="800" d:DesignHeight="450" x:Class="ApplicationDemo.Views.MainWindow" Icon="/Assets/