wpf-controls

Command Binding to Routed Event in WPF User-control

╄→尐↘猪︶ㄣ 提交于 2019-12-11 03:43:56
问题 I want to bind Viewmodel command to Usercontrol's Routed Event. Here is the detailed explanation of what I have. I have a User Control which have one Image (which shows image) and one Button at bottom ( Button to remove Image ). I am using a Usercontrol in a ListView . In my Usercontrol's Code behind I have a RoutedEventHandler to remove the Image : public event RoutedEventHandler RemoveImage; In the window where I use this Usercontrol, I have put: <uc:ucImageListItem x:Name="ImageListItem"

Get the ListBox row object from a button that is on the DataTemplate

左心房为你撑大大i 提交于 2019-12-11 03:33:26
问题 I have a ListBox with a DataTemplate . The template has a Button on it. When the Button is clicked I want to do some logic with the object that is each row (in this case an object called WorkItemTypeMappings ). In the OnClick how can I go from the Button ( object sender ) to the object that is row that the button is on? Here is the XAML of my ListBox : <ListBox ItemsSource="{Binding Source={StaticResource WorkItemTypeMappingsCollectionView}}" HorizontalContentAlignment="Stretch" ScrollViewer

Layers issue using Z-Index

∥☆過路亽.° 提交于 2019-12-11 03:24:17
问题 I've 2 controls one on top of another: border over slider. on border user can mark a segment to appear in different color on slider. Because the border is written after slider in xaml, it appear on top of the slider. and that's ok. My problem is, the Thumb of slider also appears under the border. How can I set the Thumb element (belong to slider control and inside it) to appear on top of all, and also the border will appear on top of the slider? I tried use zIndex but without success. Any

Dynamically binding ContextMenu items to statically defined MenuItems

ⅰ亾dé卋堺 提交于 2019-12-11 03:15:18
问题 My application contains a TreeView which supports a set of commands, but the commands might move around between menus, only appear on some menus and not others, be shared across multiple menus, etc. I know the set of all commands that I support at compile time, so in theory I can define a <MenuItem> resource with an x:Key attribute for each of them in my <TreeView.Resources> section. However, for any given node that is clicked, which menu items that appear can only be determined at runtime. I

How to style the thumb of wpf slider?

只谈情不闲聊 提交于 2019-12-11 02:55:03
问题 I read about style here: http://msdn.microsoft.com/en-us/library/cc278073(v=VS.95).aspx I created a UserControl with slider and UserControl.Resources section. I paste the thumb style but some tag are not recognized like vsm:VisualStateManager (I'm using VS2010) why ? 回答1: That is the documentation for Silverlight. You probably want the documentation for WPF: Slider Styles and Templates Edit: Just to be clear, if you are using Silverlight, you should use Silverlight templates and styles; if

WPToolkit not appear in the references after successful install

女生的网名这么多〃 提交于 2019-12-11 02:47:12
问题 I installed the WPToolkit through NuGet and it was successful, but it wasn't add into project's solutions, that's why i can't add in the xaml xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit" <toolkit:AutoCompleteBox... *The name "AutoCompleteBox" does not exist in the namespace "clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit". * So what can i do? I am using: Microsoft Visual Studio Ultimate 2013 Version 12.0

How to improve performance of WPF Grid control (.NET 4.0/4.5)?

人走茶凉 提交于 2019-12-11 02:39:55
问题 Definition : Having 2D-array of string (about 10 columns, 1,600 rows, fixed length of 7-char) serving as a data source for WPF .NET 4.0 Grid control, the following code snippet has been used in order to populate the Grid with labels displaying values from array. Note : Grid was added to XAML and passed to the function PopulateGrid (see Listing 1.). The visual output is essentially a tabular data representation in read-only mode (no need for two-way binding). Problem : Performance is a key

Putting a ContentControl *inside* a WPF DataTemplate?

孤者浪人 提交于 2019-12-11 00:29:52
问题 I have a custom Expander control called SpecialExpander . It is basically just a standard Expander with a fancy header and a couple properties ( HeaderText and IsMarkedRead ). I began by creating a simple class: public class SpecialExpander : Expander { public string HeaderText { get; set; } public bool IsMarkedRead { get; set; } } Then I created a style that sets a couple properties on the expander (e.g., margins, padding, etc.) and, importantly, it also defines a custom DataTemplate for the

How can I create a button which Rectangle object filled with a color in WPF with C#?

空扰寡人 提交于 2019-12-11 00:24:24
问题 How can I create Button control which contains a Rectangle object filled with the color represented by the Colors.Aqua? I have a rectangle Rectangle rectangle = new Rectangle(); rectangle.Fill = new SolidColorBrush(Colors.Aqua); rectangle.Width = 100; rectangle.Height = 50; and I have a button: Button button = new Button(); button.Content = "Button"; I can't figure out how to combine these things. Any ideas? 回答1: button.Content = rectangle; or in XAML that would be like <Button> <Button

WPF User Control in WinFORMS: Project Structuring

南笙酒味 提交于 2019-12-11 00:19:44
问题 SCENARIO I decided to work on WPF technology for my new application. This application has to be called on Menu click from a WinForms window. So I created a WPF UserControl Library and integrate it to display in parent WinForms Form using Element Host. My Application It contains 3 child usercontrols which are encapsulated inside another usercontrol with tabContent Control. I prefered this approach as firing events from Child UserControl and handling in WinForms (subscribing events) seemed