wpf-controls

Which WPF control suite is best suited to MVVM? [closed]

狂风中的少年 提交于 2019-12-10 10:26:08
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 5 years ago . It seems that the only way to really evaluate a UI control suite is to download the trial and invest many hours in understanding its limitations and design flaws. However, with so many to choose from, I am trying to shorten this process by ruling out those that fail to meet a key criterion - MVVM compatibility.

WPF Broken edges

不想你离开。 提交于 2019-12-10 09:53:09
问题 I’m experiencing a rather strange problem with WPF. When I place buttons on a form they look fine in design time, they look fine on windows XP but when the application is run on windows 7 the edges become broken. Here is a screen shot of the normal icons (XP and design time) And here is one with the broken edges (windows 7) Any ideas? EDIT: As requested here is the code I use for the button <Button Height="38" HorizontalAlignment="Center" Name="cmdChange_dataset" VerticalAlignment="Center"

WPF - TabControl - Prevent Selection Change

守給你的承諾、 提交于 2019-12-10 09:00:26
问题 It seems that the WPF TabControl doesn't support the ability to cancel a selection change, since there is no SelectionChanging() event, only a SelectionChanged event. Has anyone figured out a way to do this? The only way I have found is to attach to the PreviewMouseLeftButtonDown() event on each TabItem and set e.Handled to true if I don't want that particular page selected. This seems to work but is clunky. 回答1: I found a way do do this using a style for a TabItem and then binding the

Numbered lists in WPF

家住魔仙堡 提交于 2019-12-10 05:51:11
问题 I'm trying to create a numbered list (with sub-lists) in a WPF based UI. I'm aware of BulletDecorator for creating bullet lists and I was hoping there might be something similar for numbered lists. I'm hoping to achieve something like: List item List item a) Sub list item b) Sub list item List item Ideally I'd also like to have some control over the numbering format to enable use of lettering (such as shown for the sub-items). 回答1: Use FlowDocument with List. The FlowDocument/List example on

WPF - change global font size at runtime

馋奶兔 提交于 2019-12-10 04:35:38
问题 I need to add one functionality to my simple application - to allow user to change font size for whole aplication. Is it easy to do? Can you give me any hint how to start? It's required to have only 3 predefined font sizes but the first and only solution which came to my mind is to create 3 different themes. Is it possible to make it simplier? 回答1: Luckily, FontSize uses Property Value Inheritance. That means that so long as don't override it, FontSize will be automatically propagated to all

(WPF Datagrid) How do I determine the Column Index of an Item

妖精的绣舞 提交于 2019-12-10 04:06:29
问题 How do i return the column index of an item within a WPF Datagrid, when I click on a cell I'm using Visual Studio 2010/VB.Net 回答1: You can use below code directly to get selected cells column index. int index = datagrid.SelectedCells[0].Column.DisplayIndex; 回答2: You tried use this at the Event Click for Column Index? int columnIndex = dataGrid.CurrentColumn.DisplayIndex; I'm using this code in MouseDoubleClick Event or PreviewKeyUp and works perfectly. 回答3: DataGridCells do not have a Click

WPF. How to show only part of big canvas?

拜拜、爱过 提交于 2019-12-10 04:03:19
问题 Lets say I have a canvas defined to be 1000x1000 big. Is it possible to only show a 100x100 part of it in a Viewbox(or a rectangel)? Any help is apreciated..... 回答1: If you work with Brushes, you might want to take a look at Viewbox and Viewport in WPF Edit: I just realised that Viewbox and Viewport are used for Brushes This is not really appropiate in your situation. I looked it up, and I think you will like the Clip property on UIElement. Since Canvas is also a UIElement, you can use the

WPF - Adding dynamic controls to dynamically added Tabitem?

浪子不回头ぞ 提交于 2019-12-10 02:58:19
问题 I am dynamically adding Tabitems to a Tab Control at runtime (in C#) and that works OK, but how can I then dynamically add controls to the new Tabitems? The Tabitems need to be dynamic because they depends on how many rows of data are read from a database. The layout of each Tabitem will be identical. Thanks 回答1: If each TabItem is going to have the same layout I would simply create a UserControl which encompasses what you need from a layout and control stance and then place that within the

How to set x, y coordinates of WPF canvas children through code?

时光总嘲笑我的痴心妄想 提交于 2019-12-10 02:21:27
问题 How to set x, y coordinates of WPF canvas children through code? Below is my sample code. Canvas root = new Canvas(); double y = 5; for (int i=0; i< 10; i++) { Ellipse e = new Ellipse(); e.Height=10; e.Width=10; e.Stroke =Brushes.Black; root.Children.Add(e); y +=10; } MyRootCanvas = root; MyRootCanvas is a property of type Canvas bound to WPF UserControl's content. 回答1: Use Canvas.SetLeft and Canvas.SetTop methods to set x, y coordinate for child : for (int I=1; I<= 10; I++) { Ellipse e = new

Styled MenuItem on WPF

a 夏天 提交于 2019-12-10 00:05:23
问题 I'm developing a menu on WPF. I have this menu til now: When the menu is hovered, it looks like Users menuItem. This is the code behind: <Menu Grid.Column="0" Name="menuNavigation" > <MenuItem Header="Users" > <MenuItem Header="Register user"> <MenuItem ToolTip="Register new user on database." /> </MenuItem> <MenuItem Header="Admin users"> <MenuItem ToolTip="Update or delete a user." /> </MenuItem> </MenuItem> <MenuItem Header="Identify"> <MenuItem ToolTip="Start an identification." /> <