gridviewcolumn

How to get x:Name value runtime

我是研究僧i 提交于 2019-12-01 09:13:57
问题 I got: <ListView.View GridViewColumnHeader.Click="ColumnHeaderClick"> <GridView> <GridViewColumn x:Name="Col" Header="Item"> private void ColumnHeaderClick(object sender, RoutedEventArgs e) { GridViewColumnHeader headerClicked = e.OriginalSource as GridViewColumnHeader; } Now, how to get the x:Name value of GridViewColumn in the method? I can't put 'Name' property for the column in xaml, and it comes like empty string in runtime. Although I am able to get the header, still need to get x:Name

How to Set a gridview column width when binding to a datatable

房东的猫 提交于 2019-12-01 03:55:15
I am binding a table to a gridview in asp.net as such grdIssues.DataSource = mdtIssues; grdIssues.DataBind(); The problem is I cannot then control the column width, asp.net seems to decided on it's own what width each column should be. Methods such as grdIssues.Columns[0].ItemStyle.Width = 100; grdIssues.Columns[1].ItemStyle.Width = 100; don't work because the columns are created dynamically. I cannot believe there isn't a way to do this short of manually creating each column and filling each row. alejandrobog You dont have to manually create the columns to set them the width, you can do this

Content alignment for Gridviewcolumn in the listview

孤街浪徒 提交于 2019-12-01 01:53:24
问题 Please see the picture below Following is the code for this :: <Grid> <ListView Style="{StaticResource listViewStyle}" Name="transactionListView" HorizontalAlignment="Stretch" VerticalAlignment="Top" ItemsSource="{Binding}" MouseDoubleClick="transactionListView_MouseDoubleClick" IsSynchronizedWithCurrentItem="True" > <ListView.View> <GridView ColumnHeaderContainerStyle="{StaticResource gridViewHeaderColumnStyle}"> <GridView.Columns> <GridViewColumn Width="70" Header="Serial"

TextBlock text wrapping in GridViewColumn.CellTemplate not working

我的梦境 提交于 2019-11-30 23:13:23
问题 I am having problems getting the TextWrapping to work in this example. Can anyone see what I am duing wrong here? <ListView Name="listViewReportedException" ItemsSource="{Binding ExceptionDetails}"> <ListView.View> <GridView> <GridViewColumn Header="Time" DisplayMemberBinding="{Binding Thrown}" Width="150" /> <GridViewColumn Header="Description" DisplayMemberBinding="{Binding Description}" Width="385"> <GridViewColumn.CellTemplate> <DataTemplate> <TextBlock TextWrapping="Wrap" Text="{Binding}

DataTemplate for each DataType in a GridViewColumn CellTemplate

梦想与她 提交于 2019-11-30 04:50:43
I have an ObservableCollection which contains view models of multiple types, and I would like to make a DataTemplate for each type within each of my GridViewColumn's CellTemplates. In this simple example I could create a base ViewModel, but I would like to be able to do this just from xaml. The xaml below shows what I am trying to do, where one of the DataTemplates would be used for each CellTemplate. If there were a GridViewColumn.Resources I would define the DataTemplates there then use a a DataTemplate with ContentPresenter in the CellTemplate, but I obviously can't do that. I'm thinking I

DataTemplate for each DataType in a GridViewColumn CellTemplate

霸气de小男生 提交于 2019-11-29 02:18:45
问题 I have an ObservableCollection which contains view models of multiple types, and I would like to make a DataTemplate for each type within each of my GridViewColumn's CellTemplates. In this simple example I could create a base ViewModel, but I would like to be able to do this just from xaml. The xaml below shows what I am trying to do, where one of the DataTemplates would be used for each CellTemplate. If there were a GridViewColumn.Resources I would define the DataTemplates there then use a a

WPF: How to hide GridViewColumn using XAML?

a 夏天 提交于 2019-11-28 20:13:34
I have the following object in App.xaml <Application.Resources> <ResourceDictionary> <GridView x:Key="myGridView" x:Shared="false"> <GridViewColumn Header="Created" DisplayMemberBinding="{Binding Path=Created}"/> ... more code ... And I use this grid view in multiple places. Example: <ListView x:Name="detailList" View="{StaticResource myGridView}" ...> In one of the usages (such as detailList above), I'd like to hide the Created column, possibly using XAML? Any ideas? Actually, I find the easiest solution is via attached properties: public class GridViewColumnVisibilityManager { static void

Where can i find the default WPF Control templates?

冷暖自知 提交于 2019-11-28 20:10:01
As per this MSDN link, There is no way to replace only part of the visual tree of a control; to change the visual tree of a control you must set the Template property of the control to its new and complete ControlTemplate . I am trying to disable the click behaviour of GridViewColumnHeader ( I need to remove some triggers in the original control template), but i am not able to find the native "ColumnHeaderContainerStyle". All those i have found seem to have already done some customization and it is being difficult to get the original look and feel. Can someone please suggest me how/where can i

WPF: How to freeze a ListView header row so that it won't scroll off the screen

ぐ巨炮叔叔 提交于 2019-11-28 12:12:55
I am new to WPF development, I have a ListView and I want to freeze the header row so that it won't scroll off the screen when the user scrolls the list. The xaml code, I have inherited, looks something like this: <ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto"> <DockPanel> <forms:BindableGrid DockPanel.Dock="Top" [code snipped] > <ListView.View> <GridView> <GridViewColumn Header="ColA" DisplayMemberBinding="{Binding ColA}" /> <GridViewColumn Header="ColB" DisplayMemberBinding="{Binding ColB}" /> [etc] The ListView already does this - it has an internal

ListView.GridViewColumn (*) width

倾然丶 夕夏残阳落幕 提交于 2019-11-28 03:56:50
I am using ListView control instead of DataGrid in my WPF application. I want to give * width to my ListView.GridViewColumn , but whenever I am providing * width to ListView.GridViewColumn , it gives me a compile time error. Kindly suggest me how can I provide * width to ListView.GridViewColumn , so that ListView.GridViewColumn can automatically fill extra space when I maximize screen. Any help on this will highly appreciated. Thanks Bilal Hashmi Please try that solution: <ListView> <ListView.View> <GridView> <GridViewColumn Header="column1" x:Name="col1"/> <!--Column that shall resize: Width