wpf-controls

WPF control frozen in Visual Studio 2010

和自甴很熟 提交于 2020-01-17 02:20:16
问题 I did a custom button control in WPF and I am trying to implement it in WinForms (c#). Now, the control is working and it compiles well, but I can't seem to access the elementhost - the control was not shown in the toolbox, and afterwards I saw it's frozen, i.e. I can't add it to the form. Since the project build process went without errors or warnings, I don't know what is causing the problem. Any help would be appreciated, thanks. EDIT: Here's the code of the xaml file: <Button x:Class=

Using WPF controls in a Surface application

一曲冷凌霜 提交于 2020-01-17 01:21:14
问题 I'm needing a TreeView control in our surface application. Situation is ive already created a TreeView implementation using infragistics XamlDataTree . Im wondering whether this control set can be used in a Surface application (being that it is a WPF app under the hood)? Question also in general can you reuse standard WPF controls in the surface environment? Also is there a tool already in the Surface SDK suite that would suit a TreeView style layout? Thanks in advance 回答1: Don't know about

ListViewItem override default style break gridviews

◇◆丶佛笑我妖孽 提交于 2020-01-15 07:44:32
问题 I was wondering if anyone has ever run into this situation. Basically what I'm trying to do is override the default listviewitem to customized the the selected background/foreground. I got that working all fine and dandy. Problem is, I noticed that on listviews where I have implemented gridviews the columns are broken. I'm not sure what's going on to break this. My approach to override the default style is used blend to get the full style by editing a copy of template. Modified it as needed.

Animate a WPF Window left and right with a shake effect?

本秂侑毒 提交于 2020-01-14 14:57:04
问题 Could someone please show me how to animate a window from its current position. I am looking for a shake effect which simply shakes the window left and right say 5 to 6 times. I understand that I need to use Animation.By. This is something I have started but am not getting far. This However does not work. <Storyboard x:Key="sbShake1" FillBehavior="Stop"> <DoubleAnimation Storyboard.TargetName="W1" Storyboard.TargetProperty ="(Window.Left)" By="10" Duration="0:0:1"> </DoubleAnimation > <

Dynamically creating List of Buttons in WPF application [closed]

筅森魡賤 提交于 2020-01-14 14:56:46
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 5 years ago . I'm about to develop my first WPF. I want to get a list of buttons. The buttons get generated by ONE "Add"-button at the top of the WPF. So when i press "Add" a new buttons comes up in the list. First how i create the list? With a ListBox or a StackPanel? I think for the look a

WTF WPF TabControl?

a 夏天 提交于 2020-01-14 13:42:09
问题 I believe this to be a bug in WPF (v4.0 if it matters), but it is late, and maybe I'm missing something. I am binding to a fake example for illustrative purposes: <x:Array x:Key="SampleItems" Type="sys:String"> <sys:String>Foo</sys:String> <sys:String>Bar</sys:String> <sys:String>Baz</sys:String> </x:Array> This works and displays three tabs with the same header and content: <TabControl ItemsSource="{StaticResource SampleItems}"> <TabControl.ItemContainerStyle> <Style TargetType="TabItem">

determine a textbox's previous value in its lost focused event? WPF

大城市里の小女人 提交于 2020-01-14 13:39:09
问题 I have a textbox and have an onlostfocus event on it. Inside the lostfocus method, is there a way I can determine if the user has actually changed the value in it? i.e how do i get hold of any previous value in it? Thanks 回答1: What comes to mind for me is a two stage approach. Handle the TextChanged event on the textbox and flag it. Then when the textbox OnLostFocus occurs you can simply check your flag to see if the text has been changed. Here is a code snippet on how you could handle the

Changing dynamically created button's background in WPF

こ雲淡風輕ζ 提交于 2020-01-14 03:16:08
问题 I have the following code to dynamically create and add a button to a panel: StackPanel topPanel=...; Button button=new Button(); button.Content="New Button "+topPanel.Children.Count; // Set button background to a red/yellow linear gradient // Create a default background brush var bgBrush=new LinearGradientBrush(new GradientStopCollection( new GradientStop[] {new GradientStop(Color.FromRgb(255,255,200),0.5), new GradientStop(Color.FromRgb(255,200,200),0.5)})); // Create a more intense mouse

The difference between GotFocus and GotKeyboardFocus

一世执手 提交于 2020-01-13 07:57:13
问题 What is the difference(s) between GotFocus and GotKeyboardFocus -and similarly LostFocus and LostKeyboardFocus ? Sorry for the simple question, but, I googled it and read a lot of blog posts, but I'm still confused. It seems nobody knows exactly what is the difference ): UPDATE: My usage: I am creating a custom control by extending Control class. Something like ComboBox but with some other effects. I'm trying to open and close a Popup by setting a property: IsDropDownOpen just like a ComboBox

Binding SelectedValue of ComboBox to enum in WPF

允我心安 提交于 2020-01-12 10:12:09
问题 I want to show list of products in ListView where one of the columns is a ComboBox that I want to bind. This is my enum: public enum SelectionMode { One, Two } And Product class: public class Product { public SelectionMode Mode { get; set; } public string Name { get; set; } } In ViewModel class I have an ObservableCollection of Product 's: private ObservableCollection<Product> _productList; public ObservableCollection<Product> ProductList { get { return _productList; } set { _productList =