wpf-controls

Change image after each 10seconds in WPF image box

主宰稳场 提交于 2019-12-13 23:42:10
问题 There is a requirement of updating image in image boxes of WPF. I am thinking of creating a list with all the paths and then using a timer control checking the 10 seconds. After the 10 seconds has elapsed the next id from list is taken and bound to the image box. I am new to WPF. Can any one help me with a working example. 回答1: Use a DispatcherTimer to invoke a method at regular intervalls. In this method change the bound image, remember to raise the INotifyPropertyChanged event to let WPF

A collection of StackPanel as ItemsSource of ComboBox

戏子无情 提交于 2019-12-13 23:26:43
问题 I have a collection of StackPanel which each one includes a dynamic set of controls (based on database values), I want to set them as ItemsSource of some ComboBox for example i have two database values which should be generated: In DB i have these: row 1=>Class [a] p [B] , [AB]vb row 2=>Class tpy rbs=[sdfg],kssc[h] hm and each one should generate as a ComboBox column like the fallowing: In ComboBox I wanna generate these : ComboBoxItem 1 :Class [a textBox] p [a textBox] , [a textBox]vb

WPF Toolkit - Fit datagrid height to content height

女生的网名这么多〃 提交于 2019-12-13 20:08:19
问题 I have a WPF datagrid and would like it's height to equal the sum of the heights of it's rows + header. i.e. if my datagrid header is 100px and I have 4 rows, each 50px in height the total height of my datagrid should be 300px. Is there a way of declaratively specifying that the height should match the sum of it's contents? 回答1: Could you please paste your code? Because what you are asking can be simply achieved by placing DataGrid into a panel, which will not constrain its size and arrange

WPF DataGrid - Can't Use Mouse To Scroll Because Of Drag Drop

孤者浪人 提交于 2019-12-13 18:03:29
问题 I am using a datagrid that is allowing to drag its rows. My problem is that when i try to scroll down on my grid using the mouse on the side scroller, i get the 'no enterance' sign that means that "drag and drop is not allowed here, dude...". How can i modify my drag and drop function to recognize that this is not a drag and drop action, but a scroll mouse action? private new void MouseMove(object sender, MouseEventArgs e) { if (e.LeftButton == MouseButtonState.Pressed) { Point

Alternative of blur effect on DrawingVisual

喜你入骨 提交于 2019-12-13 15:40:16
问题 I want to give a blur effect to my DrawingVisual . I can do this using BitmapEffect properties like: DrawingVisual drawingVisual = new DrawingVisual(); DrawingContext drawingContext = drawingVisual.RenderOpen(); var effect = new System.Windows.Media.Effects.BlurBitmapEffect(); effect.Radius = 10; drawingVisual.BitmapEffect = effect; But the compiler give me a warning that Bitmap effect properties is obsolete. What other alternative I can use to achive the effect on DrawingVisual ? 回答1: Effect

Moving buttons in a Canvas

南笙酒味 提交于 2019-12-13 15:06:17
问题 The following code is supposed to move UIElements in a canvas, when the mouse hovers over them, and the user hits Ctrl. void keydown(Object sender, KeyEventArgs e) { if (e.Key == Key.LeftCtrl || e.Key == Key.RightCtrl) { control++; if (control == 1) { drag = true; elem = (UIElement)Mouse.DirectlyOver; } else drag = false; control %= 2; } } void mousemove(object sender, MouseEventArgs e) { Point p = e.GetPosition(canvas); if (drag) { if (elem == null) return; //Canvas.SetLeft(myButton, p.X); <

Showing a new Window right next to a DataCell in DataGrid (WPF)

本小妞迷上赌 提交于 2019-12-13 12:21:23
问题 I want a scenario when a user clicks on a cell in DataGrid in WPF, I want to open NumPad next to it (This is basically for touch based input). The NumPad, I understand is a separate window. 1) How can I know which Cell is selected 2) how can I show the NumPad next to the cell? 3) How can I find the coordinates of cell to position my NumPad? 4) How can I set the value of cell based on NumPad entry? NumPad is a WPF User Control in the same application. DataGrid is a .NET 4 Control. It's a

WPF style for buttons

北战南征 提交于 2019-12-13 12:16:29
问题 I haven't used WPF for a very long time (close to 4 years). But now started to use it again for some usage, you can see one of my top asked questions is in WPF. The reason I mention is this because I do have some knowledge about WPF and how it works. My latest project invovlves using BLEND to achieve a very good UI. So here I have a Photoshop layout, and I am trying to get this layout design, And so far I only have this, So really would appreciate if someone could point me on the following

How to display caret in custom WPF text box

我只是一个虾纸丫 提交于 2019-12-13 08:01:58
问题 I have designed my own text box in WPF by creating my own custom control template. However, I cannot seem to get the caret to show up. Here is my TextBox style: <Style TargetType="{x:Type TextBox}"> <Setter Property="SnapsToDevicePixels" Value="True"/> <Setter Property="OverridesDefaultStyle" Value="True"/> <Setter Property="KeyboardNavigation.TabNavigation" Value="None"/> <Setter Property="FocusVisualStyle" Value="{x:Null}"/> <Setter Property="AllowDrop" Value="True"/> <Setter Property=

Grid View or ListView Binding or Rendering of Collection of Collection

社会主义新天地 提交于 2019-12-13 07:56:13
问题 A complete new bee in XAML and WPF shifted from MVC 1 week back Requirement: Display Customer Name and all corresponding Brands 1 Customer can have Many Brands Issue Unable to display the corresponding brands Reference Similar SO Thread Code public partial class MainWindow : Window { public MainWindow() { DataContext = new MyDeviceList(); InitializeComponent(); } } public class MyDeviceList { Entities ent = new Entities(); public ObservableCollection<myCustomers> Customers { get; set; }