gridviewcolumn

Get GridViewColumn Header value from ListView?

独自空忆成欢 提交于 2019-12-10 11:13:22
问题 I have this XAML code <ListView Name="_lvContacts" ItemsSource="{Binding AccountPhonesList}" <ListView.View> <GridView> <GridViewColumn Header="{Binding Path=ColumnHeader1}" DisplayMemberBinding="{Binding Path=Home}" Width="70" /> <GridViewColumn Header="{Binding Path=ColumnHeader2}" DisplayMemberBinding="{Binding Path=Office}" Width="70" /> <GridViewColumn Header="{Binding Path=ColumnHeader3}" DisplayMemberBinding="{Binding Path=Mobile}" Width="70" /> <GridViewColumn Header="{Binding Path

Disable GridViewColumn Resize

坚强是说给别人听的谎言 提交于 2019-12-09 15:54:26
问题 Is there any way by which I can disable GridViewColumn resize in WPF? I don't want to style the control. 回答1: See this link: Fixed-Width Column in ListView: A Column that cannot be resized A fixed-width column is a column that cannot be resized by mouse dragging or double-clicks. You can find instances in outlook. Currently two methods can be used to achieve the effect. One is to restyle GridViewColumnHeader to remove the gripper inside its Template. The other is to subclass GridViewColumn to

GridViewColumn Command in HeaderTemplate

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-08 10:19:16
问题 I have a GridView with GridViewColumn, the header uses a template with a textblox to show the column name. I want a command attached to this column, basically when the user clicks the column, a command in my VM gets called ? this is for sorting purposes. Thanks 回答1: Probably too late to help you but for anyone else looking for an answer, you can do this using Attached Behaviours and the GridViewColumnHeader.Click event (see this MSDN article on sorting a GridView on header item click). My

Get GridViewColumn Header value from ListView?

时光怂恿深爱的人放手 提交于 2019-12-06 05:22:41
I have this XAML code <ListView Name="_lvContacts" ItemsSource="{Binding AccountPhonesList}" <ListView.View> <GridView> <GridViewColumn Header="{Binding Path=ColumnHeader1}" DisplayMemberBinding="{Binding Path=Home}" Width="70" /> <GridViewColumn Header="{Binding Path=ColumnHeader2}" DisplayMemberBinding="{Binding Path=Office}" Width="70" /> <GridViewColumn Header="{Binding Path=ColumnHeader3}" DisplayMemberBinding="{Binding Path=Mobile}" Width="70" /> <GridViewColumn Header="{Binding Path=ColumnHeader4}" DisplayMemberBinding="{Binding Path=Other}" Width="70" /> <GridViewColumn Header="

GridViewColumn CellTemplate Code Behind

青春壹個敷衍的年華 提交于 2019-12-06 04:16:13
问题 I have a listView that I construct at run-time, i.e. the columns are not known at compile-time. I would like to apply a DataTemplate to the cells such that the TextAlignment property is TextAlignment.Right. When creating the columns: foreach (var col in dataMatrix.Columns) { gridView.Columns.Add( new GridViewColumn { Header = col.Name, DisplayMemberBinding = new Binding(string.Format("[{0}]", count)), CellTemplate = getDataTemplate(count), }); count++; } private static DataTemplate

How to bind boolean to GridViewColumn checkboxes (have code but doesn't work)?

巧了我就是萌 提交于 2019-12-04 22:52:32
I am trying to bind a bool value to checkboxes in a GridViewColumn , but it doesn't work. I even tried just returning false, but the checkboxes still look enabled. It only works if I type "False" into the xaml. The binded property is: public bool HasPermissions { get { return this.UserPrivileges == UserPrivileges.FullAccess; } } Current value of this.UserPrivileges is not UserPrivileges.FullAccess . Xaml code: <Window x:Class="EffectsWindow.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Effects Manager

C#/WPF: Make a GridViewColumn Visible=false?

喜欢而已 提交于 2019-12-04 17:42:03
问题 Does anyone know if there is an option to hide a GridViewColumn somehow like this: <ListView.View> <GridView> <GridViewColumn Header="Test" IsVisible="{Binding Path=ColumnIsVisible}" /> </GridView> <ListView.View> Thanks a lot! Edit: For clarity Unfortunately, there is no "IsVisible" Property. I'm looking for a way to create that. Edit: The solution based on the feedback looks like: <GridViewColumn DisplayMemberBinding="{Binding Path=OptionColumn1Text}" Width="{Binding Path=SelectedEntitiy

How apply MinWidth for ListView columns in WPF in control template?

佐手、 提交于 2019-12-04 09:24:39
Following the answer to a similar question here , I was able to set the MinWidth on the XAML page. What I would like to do is accomplish this in the control template for all GridViewColumn's in all ListView's. Is this possible? Update: I tried a simple bit of sample code below, but it does not work: <Window x:Class="WpfApplication4.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" Height="350" Width="525"> <Window.Resources> <Style TargetType="{x:Type GridViewColumnHeader}" > <Setter Property=

GridViewColumn CellTemplate Code Behind

╄→гoц情女王★ 提交于 2019-12-04 07:07:10
I have a listView that I construct at run-time, i.e. the columns are not known at compile-time. I would like to apply a DataTemplate to the cells such that the TextAlignment property is TextAlignment.Right. When creating the columns: foreach (var col in dataMatrix.Columns) { gridView.Columns.Add( new GridViewColumn { Header = col.Name, DisplayMemberBinding = new Binding(string.Format("[{0}]", count)), CellTemplate = getDataTemplate(count), }); count++; } private static DataTemplate getDataTemplate(int count) { DataTemplate template = new DataTemplate(); FrameworkElementFactory factory = new

Disable GridViewColumn Resize

烂漫一生 提交于 2019-12-04 03:01:56
Is there any way by which I can disable GridViewColumn resize in WPF? I don't want to style the control. See this link: Fixed-Width Column in ListView: A Column that cannot be resized A fixed-width column is a column that cannot be resized by mouse dragging or double-clicks. You can find instances in outlook. Currently two methods can be used to achieve the effect. One is to restyle GridViewColumnHeader to remove the gripper inside its Template. The other is to subclass GridViewColumn to restrict columns' width to a fixed size. Could you explain me in detail and please give me your code. If