custom-controls

WPF - Is there a way to cause a UI element to lose focus without changing the focus to something else?

落花浮王杯 提交于 2019-12-11 12:37:29
问题 I would like to add an IsFocused property to a custom textbox that I am working on, is there any way to do this? 回答1: Unless I'm mistaken something always has to be in focus. That being said you can Focus to a label or some non-editable/non-selectable element if you need. Or you can focus another application. In general, however, something is always in focus. 来源: https://stackoverflow.com/questions/2664460/wpf-is-there-a-way-to-cause-a-ui-element-to-lose-focus-without-changing-the-fo

Child properties update calling it's parent's `OnPropertyChanged`

安稳与你 提交于 2019-12-11 12:25:18
问题 I'm trying to create a XF component whose some properties are of a type that inherits from BindableObject . For illustrating, I have class Shadow with double Radius and Color ShadowColor properties and a class MyBoxText , that have a bool IsLoading and a Shadow Ghost properties. My View and it's Bindings is working as expected, but I have an issue with it's custom renderer: When I change the Ghost properties I need to redraw the entire view (of the MyBoxText control), to visually update the

Binding a collection to a custom control property

*爱你&永不变心* 提交于 2019-12-11 12:19:05
问题 I am having no luck trying to bind a collection of data to my custom control its property. I already have implemented the mechanism for a string property of this control (with a small help from here) and expected the collection type to be as easy. However I cannot make it work again. Here is my custom control view <UserControl x:Class="BadaniaOperacyjne.Controls.Matrix" mc:Ignorable="d" Name="CustomMatrix" d:DesignHeight="300" d:DesignWidth="300"> <Grid> <Grid.RowDefinitions> <!-- ... --> <

Testing Custom Control derived from ComboBox

有些话、适合烂在心里 提交于 2019-12-11 12:08:59
问题 I've created a control derived from ComboBox, and wish to unit test its behaviour. However, it appears to be behaving differently in my unit test to how it behaves in the real application. In the real application, the Combobox.DataSource property and the .Items sync up - in other words when I change the Combobox.DataSource the .Items list immediately and automatically updates to show an item for each element of the DataSource. In my test, I construct a ComboBox, assign a datasource to it, but

Labeled ComboBox in Windows 10 Universal App

a 夏天 提交于 2019-12-11 12:04:07
问题 similar to my Labeled TextBox, which issues are resolved in: Labeled TextBox in Windows Universal App I got two issues in my Labeled Combobox, but first the Code: Generic.xaml : <Style TargetType="template:LabeledComboBox"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="template:LabeledComboBox"> <Grid> <Grid.RowDefinitions> <RowDefinition Height="*" /> <RowDefinition Height="*" /> </Grid.RowDefinitions> <TextBlock Text="{TemplateBinding Label}" FontWeight="Bold"

Delphi - Custom drawing a message list

こ雲淡風輕ζ 提交于 2019-12-11 11:16:55
问题 Please refer to my question asked at tek-tips.com: http://tek-tips.com/viewthread.cfm?qid=1663735&page=1 As I mentioned in a couple of my other threads, I'm building a control to pretty much replicate the SMS text messaging on the iPhone. This consists of simply a bubble on either side of the control containing text. I already have a working version, but need to re-build it from scratch. I'd like some advice on some things... What do you think is the best method to store the list of message

How to create horizontal menu in android?

末鹿安然 提交于 2019-12-11 10:43:47
问题 I am working on horizontal menu that will open on top of the screen. Layout is something like following, || < || Menu Item1 || Menu Item2 || Menu Item3 || > || I want to put this on top of the screen. It can have more than 3 menu item and it can traverse through previous and next arrow. I started with like this, RelativeLayout ( width - fill_parent) Gallery View ( Here i appended adapter ) There is two problem, - Gallery view contains the space before and after - While scrolling its item gets

uwp commandbar more button not showing up with DynamicOverflowEnabled

被刻印的时光 ゝ 提交于 2019-12-11 10:14:07
问题 ok so I have a UWP app in which I am using CustomMediaTransportControls . within those controls I've added some extra buttons within the commandbar PrimaryCommands and have set IsDynamicOverflowEnabled=true according to the docs it should automatically send the primary commands to the overflow menu when the screen size is not enough for all the buttons. and it should drop them out accoridng to MediaTransportControlsHelper.DropoutOrder property on each appbarButton. Problem When screen size is

Switching from GDI/WinForms to WPF for custom UI elements

☆樱花仙子☆ 提交于 2019-12-11 09:40:39
问题 I'm transitioning to using WPF after using WinForms for 6+ years. Previously, using On_Paint , and drawing with Graphics and Brushes and the like, I've created custom UI elements like the below: I'd like to duplicate this look using WPF but I'm not sure where to begin or how to do it. Thanks for any help. 回答1: The basic answer is that you need to override the ControlTemplate for the button you are styling (do this in a resource for code reuse!). The basic format would be: <Window.Resources>

Common style for different controls with the same custom properties

怎甘沉沦 提交于 2019-12-11 08:55:23
问题 I have several custom controls that have in common some custom properties and I would like to apply a common style that triggers with those properties. I put those common properties in an interface (IMyControl) and made my controls implement it, but it seems that a style can't have an interface as TargetType... My custom properties are two booleans: bMandatory and bIncomplete. The common style part is: <Style.Triggers> <Trigger Property="IsKeyboardFocusWithin" Value="True"> <Setter Property=