wpftoolkit

How can I apply a custom sort rule to a WPF DataGrid?

拟墨画扇 提交于 2019-11-26 16:26:27
When the user does a column sort in my DataGrid , I want all null or empty cells to be sorted to the bottom, rather than the top. I wrote an IComparer<T> that makes sure blanks are always sorted downward, but I can't figure out how to apply it to the columns of my DataGrid . Note that the initial sort of the DataGrid , which I'm doing with the LINQ OrderBy() method, works great. The problem is that all subsequent sorts performed by the user sort the blanks to the top. Comparer Code public class BlankLastStringComparer : IComparer<string> { public int Compare(string x, string y) { if (string

WPF Toolkit DatePicker Month/Year Only

早过忘川 提交于 2019-11-26 16:00:03
问题 I'm using the Toolkit's Datepicker as above but I'd like to restrict it to month and year selections only, as in this situation the users don't know or care about the exact date .Obviously with the data being stored in a Datetime format there will be day stored but that doesn't concern me. Is there an easy way to tie this down? Thanks 回答1: If you can use the Calendar control instead you could do <toolkit:Calendar x:Name="_calendar" DisplayModeChanged="_calendar_DisplayModeChanged" DisplayMode

Problem binding DataGridComboBoxColumn.ItemsSource

时光总嘲笑我的痴心妄想 提交于 2019-11-26 14:17:16
问题 I have 3 tables: Item - which is the DataContext - it has a navigation column Group Group - has a navigation column Category. I want to have in the DataGrid both (Category & Group) columns and when I choose a category it should display in the group col only the Category.Groups. Here is the code I am working on: <tk:DataGrid AutoGenerateColumns="False" ItemsSource="{Binding}"> <tk:DataGrid.Columns> <!--Works--> <tk:DataGridComboBoxColumn Header="Categroy" DisplayMemberPath="Title"

How to loop over the rows of a WPF toolkit Datagrid

你。 提交于 2019-11-26 11:39:14
问题 I have the next code where I defined a WPF toolkit datagrid control called dgQuery; I filled this one with information of a dataset, then I inserted a new checkbox column in dgQuery to check/uncheck some of the rows, I show part of my C# code: dgQuery.DataContext = dS.Tables[0]; DataGridTemplateColumn cbCol = new DataGridTemplateColumn(); cbCol.Header = \"Opc\"; FrameworkElementFactory factory = new FrameworkElementFactory(typeof(CheckBox)); Binding bind = new Binding(\"IsSelected\"); bind

WPF StringFormat on Label Content

久未见 提交于 2019-11-26 10:20:56
问题 I want to format my string binding as Amount is X where X is a property bound to a label. I\'ve seen many examples but the following doesn\'t work: <Label Content=\"{Binding Path=MaxLevelofInvestment, StringFormat=\'Amount is {0}\'}\" /> I\'ve also tried these combinations: StringFormat=Amount is {0} StringFormat=\'Amount is {}{0}\' StringFormat=\'Amount is \\{0\\}\' I even tried changing the binding property\'s datatype to int , string and double . Nothing seems to work. This is a very

Changing the string format of the WPF DatePicker

爱⌒轻易说出口 提交于 2019-11-26 08:09:33
问题 I need to change the string format of the DatePickerTextBox in the WPF Toolkit DatePicker, to use hyphens instead of slashes for the seperators. Is there a way to override this default culture or the display string format? 01-01-2010 回答1: I have solved this problem with a help of this code. Hope it will help you all as well. <Style TargetType="{x:Type DatePickerTextBox}"> <Setter Property="Control.Template"> <Setter.Value> <ControlTemplate> <TextBox x:Name="PART_TextBox" Text="{Binding Path

Windows 7 theme for WPF?

徘徊边缘 提交于 2019-11-26 05:19:49
问题 Is there any way to make a WPF app look like it\'s running on Windows 7 even if it\'s running on XP? I\'m looking for some kind of theme I can just paste in. I\'m aware of the themes project on Codeplex (http://www.codeplex.com/wpfthemes), but it lacks support for DataGrid , which is something I critically need. I was thinking maybe the Windows 7 theme would just be an easy port, or exists in some file somewhere already. Any information you have (even if it\'s bad news) would be much