itemssource

How to setup a grid as template for an Items control?

大兔子大兔子 提交于 2021-01-20 19:01:06
问题 I'm trying to create an ItemsControl that uses a grid as its ItemsPanel in such a way that it has two columns, where the first columns width is the width of the widest item in that column, and has as may rows needed to display all the items Basically, I want the following, but somehow within an ItemsControl so that I can bind to a collection of objects: <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="auto"/> <ColumnDefinition Width="*"/> </Grid.ColumnDefinitions> <Grid.RowDefinitions

How to setup a grid as template for an Items control?

与世无争的帅哥 提交于 2021-01-20 18:57:48
问题 I'm trying to create an ItemsControl that uses a grid as its ItemsPanel in such a way that it has two columns, where the first columns width is the width of the widest item in that column, and has as may rows needed to display all the items Basically, I want the following, but somehow within an ItemsControl so that I can bind to a collection of objects: <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="auto"/> <ColumnDefinition Width="*"/> </Grid.ColumnDefinitions> <Grid.RowDefinitions

How to bind index of item in nested BindableLayout.ItemsSource to CommandParameter - Xamarin

和自甴很熟 提交于 2021-01-07 06:58:08
问题 I'm trying to figure out how you can get the index from a list inside XAML. Context A product has multiple specification categories/groups which contain the specification details. Product & Ingrediënten are the specification groups. Land van afkomst : Nederland are the specs details In the XAML code, I'm using a nested list. The application needs to pass the Index so the users can delete and add specifications correctly. The index at Binding Source="0" /> & CommandParameter="0" needs to be

WPF: how to bind ComboBox ItemsSource in code?

自闭症网瘾萝莉.ら 提交于 2021-01-04 07:17:10
问题 I need to convert this following XAML into code-behind: <ComboBox SelectedItem="{Binding Level}" ItemsSource="{Binding Levels}" /> However, this code doesn't compile: new ComboBox() { SelectedItem = new Binding("Level"), ItemsSource = new Binding("Levels") } The error: "Cannot implicitly convert type 'System.Windows.Data.Binding' to 'System.Collections.IEnumerable'. An explicit conversion exists (are you missing a cast?)". How do I cast? 回答1: ComboBox cbo=new ComboBox(); cbo.SetBinding

WPF BindingListCollectionView to ListCollectionView for DataTable as ItemsSource

你离开我真会死。 提交于 2020-01-24 21:00:07
问题 I want to do custom sorting on a ListView which has a DataTable as ItemsSource: myListView.ItemsSource = (data as DataTable); And this are the first lines of my sorting function: DataView view = (myListView.ItemsSource as DataTable).DefaultView; ListCollectionView coll = (ListCollectionView)CollectionViewSource.GetDefaultView(view); The second line throws an execption like: Unable to cast "System.Windows.Data.BindingListCollectionView" to "System.Windows.Data.ListCollectionView" Has anyone a

COMBOBOX filtering in WPF with MVVM

安稳与你 提交于 2020-01-23 02:09:05
问题 I am developing an application using WPF mvvm approach. I have a requirement where I have to show a list of items in a combo box for selection. Based on some flag I need to filter out few items from the combo box for selection. I tried to use two different items sources one with full list and another with filtered list and based on the flag I wanted to change the items source. This does not seem to be working well. Is there any easy way to apply filters on the existing list based on some flag

COMBOBOX filtering in WPF with MVVM

醉酒当歌 提交于 2020-01-23 02:08:27
问题 I am developing an application using WPF mvvm approach. I have a requirement where I have to show a list of items in a combo box for selection. Based on some flag I need to filter out few items from the combo box for selection. I tried to use two different items sources one with full list and another with filtered list and based on the flag I wanted to change the items source. This does not seem to be working well. Is there any easy way to apply filters on the existing list based on some flag

WPF - set the ItemsSource of List View based on some condition

倖福魔咒の 提交于 2020-01-17 04:58:06
问题 Is it possible to set the ItemsSource of a list view based on Some condition. I tried the following, but it didn't work. <ListView ItemsSource="{Binding FirstTypeOfSource}" .....> <ItemsControl.ItemContainerStyle> <Style > <Style.Triggers> <DataTrigger Binding="{Binding Category}" Value="All"> <Setter Property="ItemsSource" Value="SecondTypeOfCategory"/> </DataTrigger> </Style.Triggers> </Style> </ItemsControl.ItemContainerStyle> </ListView> Can someone help to figure out the solution ? 回答1:

How to access ItemsSource property of a DataGrid defined in UserControl from main xaml file?

只谈情不闲聊 提交于 2020-01-17 00:37:17
问题 I have declared a DataGrid in UserControl. Now I have included the UserControl in my main xaml file. I am trying to set the ItemsSource property of DataGrid from main.xaml; but I am getting an error "The property ItemsSource doesnot exist in the namespace". I am able to set the other properties like Background,Foreground, etc. My UserControl has this : <wpfkit:DataGrid Name="DataGrid1" AutoGenerateColumns="True" Width="Auto"> </wpfkit:DataGrid> In main.xaml : <usercontrol:MultiStepProcessGrid

How to access ItemsSource property of a DataGrid defined in UserControl from main xaml file?

▼魔方 西西 提交于 2020-01-17 00:36:47
问题 I have declared a DataGrid in UserControl. Now I have included the UserControl in my main xaml file. I am trying to set the ItemsSource property of DataGrid from main.xaml; but I am getting an error "The property ItemsSource doesnot exist in the namespace". I am able to set the other properties like Background,Foreground, etc. My UserControl has this : <wpfkit:DataGrid Name="DataGrid1" AutoGenerateColumns="True" Width="Auto"> </wpfkit:DataGrid> In main.xaml : <usercontrol:MultiStepProcessGrid