listviewitem

ListView CellFactory - How to remove cells correctly?

萝らか妹 提交于 2020-01-11 13:19:31
问题 I have a ListView that I am working to add a ContextMenu to. I have the ContextMenu working find but have another issue. My setCellFactory code, used to setup the context menus: lvAppetites.setCellFactory(lv -> { ListCell<Appetite> cell = new ListCell<>(); ContextMenu contextMenu = new ContextMenu(); MenuItem editAppetiteMenu = new MenuItem(); editAppetiteMenu.textProperty().bind(Bindings.format("Edit ...")); editAppetiteMenu.setOnAction(event -> { // Code to load the editor window

Convert object to ListViewItem

為{幸葍}努か 提交于 2020-01-06 12:52:12
问题 I am trying to convert my Winforms application to WPF format, I am trying to convert the double click of my listview at the moment. I have done this so far: private void listView1_DoubleClick(object sender, MouseButtonEventArgs e) { ListViewItem item = this.listView1.SelectedItems[0]; if (item.Tag != null) { ControllerInfo controllerInfo = (ControllerInfo)item.Tag; if (controllerInfo.Availability == Availability.Available) { if (controllerInfo.IsVirtual) { this.controller = ControllerFactory

WPF Button doesn't execute Command

允我心安 提交于 2020-01-06 08:22:05
问题 I have a ListViewItem which has an Eventhandler attatched and inside the ControlTemplate of the ListViewItem is a Button which does something different. But if I click the Button , the Behaviour is like I clicked on the ListViewItem . AppointmentOverview.xaml: <Window.Resources> <Style TargetType="{x:Type ListViewItem}" BasedOn="{StaticResource NormalListViewItem}"> <EventSetter Event="PreviewMouseLeftButtonDown" Handler="ListViewItem_PreviewMouseLeftButtonDown" /> </Style> </Window.Resources

Windows 8 - Customizing ListView swipe offset?

自古美人都是妖i 提交于 2020-01-03 03:20:09
问题 I am very new to Windows 8 so please bear with me. I am styling a ListView in xaml for a Windows 8.1 Store app. I would like to customize the offset distance that a ListViewItem can be swiped horizontally to select it. I have looked through the ListViewItem and ListView styles in the generic.xaml file and edited them in my App.xaml file... but I haven't been able to find any settings that made the correct change. In the ListViewItem style with the key ListViewItemExpanded, I tried changing

ContextMenu for ListViewItem only

杀马特。学长 韩版系。学妹 提交于 2020-01-01 05:27:08
问题 I have a context menu - problem is I need it to only open when a listviewitem is clicked. Right now it will open if I click anywhere in the listview or in the header. <ListView> <ListView.ContextMenu> <ContextMenu> <MenuItem Header="More Info" Command="{Binding MoreInfo}" /> </ContextMenu> </ListView.ContextMenu> <ListView.View> <GridView> <!-- columns and stuff here --> </GridView> </ListView.View> </ListView> I have tried adding the ContextMenu as a resource and applying it as a style, but

How to handle ItemClick For Nested ListView In MVVM Pattern?

倖福魔咒の 提交于 2019-12-31 07:18:11
问题 Xaml code: <Page x:Class="DemoTestApp.MainPage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="using:DemoTestApp" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" Background="{ThemeResource ApplicationPageBackgroundThemeBrush}" xmlns:vm="using:ViewModels" > <Page.DataContext> <vm:TestViewModel/> </Page

How can I set an icon for a ListViewSubItem?

☆樱花仙子☆ 提交于 2019-12-28 05:52:34
问题 In a ListView you can have icons on each item. When viewing in Details-mode, the icon is shown in the left-most column. Can I show an icon in some other column? 回答1: The ListView control does not support images in sub-items natively. The easiest thing to do is switch to a DataGridView and use a DataGridViewImageColumn . If that is not possible, then you'll need to draw the icons yourself using the custom draw support in the ListView control. To do this set ListView.OwnerDraw = true and handle

How can I achieve a dashed or dotted border in WPF?

十年热恋 提交于 2019-12-28 05:07:06
问题 I have a ListViewItem that I am applying a Style to and I would like to put a dotted grey line as the bottom Border . How can I do this in WPF? I can only see solid color brushes. 回答1: This worked great in our application, allowing us to use a real Border and not mess around with Rectangles: <Border BorderThickness="1,0,1,1"> <Border.BorderBrush> <DrawingBrush Viewport="0,0,8,8" ViewportUnits="Absolute" TileMode="Tile"> <DrawingBrush.Drawing> <DrawingGroup> <GeometryDrawing Brush="Black">

How can I achieve a dashed or dotted border in WPF?

◇◆丶佛笑我妖孽 提交于 2019-12-28 05:07:05
问题 I have a ListViewItem that I am applying a Style to and I would like to put a dotted grey line as the bottom Border . How can I do this in WPF? I can only see solid color brushes. 回答1: This worked great in our application, allowing us to use a real Border and not mess around with Rectangles: <Border BorderThickness="1,0,1,1"> <Border.BorderBrush> <DrawingBrush Viewport="0,0,8,8" ViewportUnits="Absolute" TileMode="Tile"> <DrawingBrush.Drawing> <DrawingGroup> <GeometryDrawing Brush="Black">

Listview empty after insert a field in db?

感情迁移 提交于 2019-12-25 05:15:12
问题 I was looking for an example/tutorial to insert datas in a sqlLite db and display the datas in a listview. Well this is a good example: http://androidsolution4u.blogspot.it/2013/09/android-populate-listview-from-sqlite.html And it works. I implemented the code in mine and works. The problem is that if i want insert another one filed nothing appears in the listview and the activity is empty.I added a field called address as string like the others and in every part of code i added what is need