wpf-controls

WPF LISTBOX collapsible

痞子三分冷 提交于 2019-12-11 11:40:40
问题 THere are few items in My Listbox , items are completed, Active and pending ( depends on my internal logic) , i want to hide completed and Pending items , on press of listbox/button the pending or Completed items should collapse displaying the items ( like row wise collapse), would appreciate your help guys. 来源: https://stackoverflow.com/questions/10650512/wpf-listbox-collapsible

Resizing WPF Grid Column when other Columns children is collapsed?

≯℡__Kan透↙ 提交于 2019-12-11 11:35:55
问题 I have two controls in a Grid ,and need to make one to fill all the Grid space after the another one get Collapseded ,i don't know what Container can i use,i tried StackPanel and DockPanel too,but i couldn't find a good solution.here's my code: <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="auto"/> <ColumnDefinition Width="auto"/> </Grid.ColumnDefinitions> <TextBox Grid.Column="0" Visibility="{Binding Istxt1Visible}"/> <TextBox Grid.Column="1" Visibility="{Binding Istxt2Visible}"/>

Increasing or decreasing control fontsize on runtime according to Slider(WPF component) value

本秂侑毒 提交于 2019-12-11 10:53:38
问题 I want to increase or decrease font size of controls such as window, treeView, ribbon menu etc that are contained by main window. I have a font size slider create method and I want to acces all of Control and TextBlock by using visualtree helper and increase or decrease their font size according to slider value. Methods are below; private StackPanel CreateFontSizeSlider() { StackPanel fontSizePanel = new StackPanel(); fontSizePanel.Orientation = Orientation.Horizontal; Slider fontSizeSlider =

Choosing WPF controls

核能气质少年 提交于 2019-12-11 10:19:23
问题 I need to provide for users the option to change logging level of NLog rules. There are 12 rules and each one has it's own logging level. Which controls could you recommend to use to provide this option in WPF? 回答1: I'm not familiar with NLog, but I guess if you must pick between a small amount of pre-determined options then a ComboBox is the best UI element for that. You said you have 12 Log Levels, So in that case it makes most sense to use an ItemsControl to actually show these items

Dependency property default value not being overriden

ⅰ亾dé卋堺 提交于 2019-12-11 10:02:23
问题 I am trying to override the value of a dependency property but it doesn't seem to be working. In my Xaml code I have a button with the following CommandParameter : CommandParameter="{Binding State,Mode=OneWay} and here I declare my dependency property: public class MyStateControl : UserControl { public MyStateControl() { this.InitializeComponent(); } public string State { get { return (string)this.GetValue(StateProperty); } set { this.SetValue(StateProperty, value); } } public static readonly

How do I change the background of my button on mouseover?

旧时模样 提交于 2019-12-11 09:57:32
问题 I have a WPF application written in C#. I have made a button. I changed the background color. How can I change the bluish color when mouse is over my button? And how to control animation/change time? 回答1: http://msdn.microsoft.com/en-us/magazine/cc163421.aspx You will need to look into creating a 'style' for your button. This will be done in XAML, you will find Microsoft Expression Blend really simplifies the design of most aspects of your WPF projects. 回答2: <Style x:Key="StyleButton"

WPF: How to pass Content property between styles and ControlTemplate

主宰稳场 提交于 2019-12-11 09:41:48
问题 I'm trying to switch between two styles in WPF according to a property. To switch between the styles I used ControlTemplate for each style and one style with triggers that switching between the ControlTemplates. My problem is that I have a ContentPresenter inside each basic style and I cannot set it from outside (from the usages). This is my code in xaml: <Style x:Key="SecondaryButtonStyle" TargetType="{x:Type Button}"> <Setter Property="Background" Value="{StaticResource

Sorting in window datacontext in WPF

旧街凉风 提交于 2019-12-11 09:26:28
问题 Another question related to this one. I have a List<SortableObjects> that is the DataContext of my MainWindow. I use that list to populate a ListBox and a ComboBox . When I sort the items, both the ComboBox and the ListView get updated all right. But now I need the ComboBox to be sorted in a different way than the ListView . I. E. If the object were a Person, in the ComboBox , I'd need to sort them by LastName, but in the ListView , by birthday. How can I achieve this? Thanks! 回答1: Use

WPF animated GIF using MediaElement

核能气质少年 提交于 2019-12-11 08:51:09
问题 I need to get a spinning loader to show when my application is busy. I found a few posts suggesting the MediaElement is the best way to go. I have the following that displays the ajax-loader.gif on the designer. However, when I run the application, the MediaElement doesn't show anything. <MediaElement Source="file:images/ajax-loader.gif" LoadedBehavior="Play" Visibility="Visible" /> And not sure if this is a related problem, but from the designer, the Source dropdown isn't picking up my

WPF unexpected control unload

人走茶凉 提交于 2019-12-11 08:45:05
问题 I'm developing a WPF application using MVVM. Inside a Window, I have a control that inherits from UserControl, lets call it DetailView. DetailView is binded to a property in the VM (CurrentDetail) that can be of different types, UserDetail, AccountDetail, CalendarDetail, etc. All inherit from the same class I have a "ThumbnailBar" in which I can navigate between different detail instances that have been already opened, imagine AccountDetail1, AccountDetail2, etc. This navigation is handled