gridviewcolumn

WPF GridView Column and dynamic cell template based upon data value

丶灬走出姿态 提交于 2021-01-29 04:23:24
问题 I have a GridView where I can generate the Columns at run time based upon the configuration settings. e.g Text Column = to show the text in it Image Column = to display the graphic in there. but the problem is that the whole column would be shown either of them type. What I want to do is based upon the data of particular cell, I want (a) choose a dynamic template (b) render the contents dynamically (ideally) as FrameworkElement and set the cell content with that. This means that the each cell

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

心已入冬 提交于 2020-01-23 01:16:12
问题 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"

ObservableCollection not updating my GridViewColumns (MVVM)

前提是你 提交于 2020-01-06 05:38:08
问题 Hi please could somebody help? I have a ListView which is bound to a ObservableCollection i.e StabCollection. The data displays perfectly. I have a couple of textboxes and a combo box to enable the user to edit the columns. When those textboxes are edited the values change in the gridview as expected however I am trying to achieve a cancel feature to revert changes back to the original. Manually changing the SelectedItem of StabCollection or changing the StabCollection[SelectedIndex] doesn't

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

无人久伴 提交于 2019-12-22 01:21:27
问题 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

TreeListView with Columns generated and populated by ObservableCollection

六月ゝ 毕业季﹏ 提交于 2019-12-21 06:13:53
问题 Does anyone known (or even has an example) of a WPF based TreeListView that can generate its colums by databinding to the ObservableCollection of its tree items? For example the databound model is a tree consisting of Employee instances representing the supervisor hierarchy of a company. Each employee addtionally has a ObservableCollection of Responsibility instances (Properties: ResponsibiltyName, ResponsibleSinceDate). Now I want a separate column for each ResponsibiltyName found in any of

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

二次信任 提交于 2019-12-19 06:01:24
问题 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

WPF: How to hide GridViewColumn using XAML?

浪尽此生 提交于 2019-12-17 15:46:53
问题 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? 回答1: Actually, I find

Automatically resize columns of wpf GridView

守給你的承諾、 提交于 2019-12-11 14:12:03
问题 I've gone through a few posts with similar requirements but haven't found a fully working solution yet. I have a GridView in a ListView with a few columns <ListView x:Name="TheList" DockPanel.Dock="Top" ItemsSource="{Binding Itemlist}" SelectionMode="Extended"> <ListView.View> <GridView> .... <GridViewColumn x:Name="valueColumn" Header="Value" DisplayMemberBinding="{Binding ItemValue}" Width="150"/> </GridView> </ListView.View> </ListView> I set the model and sub to the model's property

Why is FindAncestor binding not working in GridViewColumn?

天大地大妈咪最大 提交于 2019-12-11 03:18:13
问题 I'm trying to create my own GridViewColumn and having some issus with binding. Can someone explain to me why the following Header-binding does work <GridViewColumn x:Class="interneProzesse_UebersetzungstoolNS.TranslateGridViewColumn" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:conv

WPF: GridViewColumn resize event

≯℡__Kan透↙ 提交于 2019-12-10 12:40:38
问题 I'm using ListView with GridView . Is there GridViewColumn resize event? 回答1: Have a look at MSDN DridViewColumn details. It does not appaer to have such an event, probably some workaround required, I am not sure though. have look here Hope it helps. 回答2: I will handle the PropertyChanged event instead. The PropertyChanged event is not seen in the Visual Studio intellisense, but you can trick it :) GridViewColumn column = ... ((System.ComponentModel.INotifyPropertyChanged)column)