wpftoolkit

How to show a loading graphic/animation when wpf data binding is taking place

我是研究僧i 提交于 2019-12-18 14:58:08
问题 I have a WPF user control that contains a DataGrid . I'm binding an ObservableCollection of view models to it. Each view model has another collection of view models that I'm using to bind another DataGrid to. So the effect is a DataGrid with a nested DataGrid contained in the row details template. Normally the binding is quite quick, but sometimes when there's a lot of data it can hang the UI while the binding/drawing is taking place. Is there a way where I can either show a loading animation

Text alignment in a WPF DataGrid

╄→尐↘猪︶ㄣ 提交于 2019-12-18 12:43:27
问题 How can I align the column data to center in a WPF DataGrid ? 回答1: It's hard to say without knowing specifics, but here's a DataGridTextColumn that is centered: <wpf:DataGridTextColumn Header="Name" Binding="{Binding Name}" IsReadOnly="True"> <wpf:DataGridTextColumn.CellStyle> <Style> <Setter Property="FrameworkElement.HorizontalAlignment" Value="Center"/> </Style> </wpf:DataGridTextColumn.CellStyle> </wpf:DataGridTextColumn> 回答2: If you are using DataGridTextColumn you can use the following

WPF toolkit DatePicker change default value 'show calendar'

放肆的年华 提交于 2019-12-18 04:04:36
问题 I'm using the latest WPF toolkit , specifically the DatePicker . Everything works fine, but when no value is provided, the default 'SHOW CALENDAR' text appears in the DatePickerTextBox. I want to be able to change this value in WPF. One told me to download the source, add a new Dependency property and recompile to dll. That's cool but what if new version is released? That's why I'd like to template this control in that way, that I'll be able to override this default string. Any idea how to do

How do I create a new row in WPF DataGrid when it is bound to an XmlDataProvider?

夙愿已清 提交于 2019-12-18 03:19:11
问题 I have a project with an XmlDataProvider bound to a WPF DataGrid control. I have the bindings on the DataGrid set up as follows: <dg:DataGrid ItemsSource="{Binding Source={StaticResource XmlData}, XPath=Root/People/Person}" AutoGenerateColumns="False"> <dg:DataGrid.Columns> <dg:DataGridTextColumn Header="ID" Binding="{Binding XPath=ID}"/> <dg:DataGridTextColumn Header="Name" Binding="{Binding XPath=Name}"/> </dg:DataGrid.Columns> </dg:DataGrid> Users can edit entries using the DataGrid

WPF (MVVM): Closing a view from Viewmodel?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-17 21:43:33
问题 Anybody come across a clever way of closing a view in a viewmodel using MVVM? Maybe there is a way of using binding to signal the view (window) to close? I would really appreciate any input anyone has. Basically i have a loginView that is bound to a loginViewModel, in the viewmodel (using binding on a command) i test to see if the login is successful and if it is i basically load up a new View (mainview) and attach its datacontext... but i still have the loginView shown - so i need to signal

I need the Expand / Collapse for RowDetailsTemplate

若如初见. 提交于 2019-12-17 18:54:09
问题 I have a WPFToolkit DataGrid. It has DataGrid.RowDetailsTemplate. I need to do like, when a button is clicked it must Expand / Collapse. <Custom:DataGrid RowDetailsVisibilityMode="VisibleWhenSelected" SelectionMode="Extended" CanUserAddRows="False" CanUserDeleteRows="False" CanUserResizeRows="False" CanUserSortColumns="False"> <Custom:DataGrid.RowDetailsTemplate> <DataTemplate> <Custom:DataGrid> <Custom:DataGrid.Columns> <Custom:DataGridTextColumn Binding="{Binding idClient, Mode=Default}"

WPF Datagrid with some read-only rows

瘦欲@ 提交于 2019-12-17 15:57:09
问题 I have the need to show some of my WPF Datagrid rows as read only or not depending on a property on my bound model. How can this be done? 回答1: I had the same problem. Using information provided in jsmith's answer and on Nigel Spencer's blog, I've come up with a solution that doesn't require changing WPF DataGrid source code, subclassing or adding code to view's codebehind . As you can see, my solution is very MVVM Friendly. It uses Expression Blend Attached Behavior mechanism so you'll need

Bind datagrid column visibility MVVM

穿精又带淫゛_ 提交于 2019-12-17 05:40:55
问题 .Net 3.5 I know that the columns doesn't inherit the datacontext and by reading other posts i thought this would work: Visibility="{Binding RelativeSource={x:Static RelativeSource.Self}, Path=(FrameworkElement.DataContext).IsColumnNameVisible, Converter={StaticResource boolToVisConverter}}" However of course it doesn't.. The output window does not complain, it seems that the resource i found but the viewmodel property is newer called. This is the entire DG : <tk:DataGrid

How can I prevent row selection in the WPF Toolkit DataGrid?

只愿长相守 提交于 2019-12-14 01:01:51
问题 I see a few options available for row selection, but 'No Selection' is not one of them. I've tried handling the SelectionChanged event by setting SelectedItem to null, but the row still seems selected. If there is no easy support for preventing this, would it be easy to just style the selected row the same as an unselected one? That way it could be selected, but the user has no visual indicator. 回答1: You have to call DataGrid.UnselectAll asynchronously with BeginInvoke to get it to work. I

WPF Toolkit - Fit datagrid height to content height

女生的网名这么多〃 提交于 2019-12-13 20:08:19
问题 I have a WPF datagrid and would like it's height to equal the sum of the heights of it's rows + header. i.e. if my datagrid header is 100px and I have 4 rows, each 50px in height the total height of my datagrid should be 300px. Is there a way of declaratively specifying that the height should match the sum of it's contents? 回答1: Could you please paste your code? Because what you are asking can be simply achieved by placing DataGrid into a panel, which will not constrain its size and arrange