selecteditem

Is there a way to select a text field in code without clicking on it (javafx)?

断了今生、忘了曾经 提交于 2019-12-12 09:10:07
问题 I am not sure how to or even if it is possible to select text fields in code. I could not find anything on the subject. If the is indeed a way to do so i have a template that could be modified to demonstrate how this could be done. Here is the template/sample code: Main class: package application; import javafx.application.Application; import javafx.fxml.FXMLLoader; import javafx.scene.Parent; import javafx.scene.Scene; import javafx.stage.Stage; public class Main extends Application { public

ListView SelectedItem not highlighted when set in ViewModel

此生再无相见时 提交于 2019-12-12 02:58:30
问题 I have a ListView with a ItemSource data binding and a SelectedItem data binding. The ListView is populated with a new ItemSource every time I press the Next or Previous button. The SelectedItem is updated accordingly, the items in the ItemSource have the Selected state, so it can be remembered when the user navigates back and forth. While debugging, everything seems to work perfectly. The VM updates the controls as expected, and I can also see that the ListView has the correct selected value

WPF: Clicking on a DataGrid Row inside a TreeView does not trigger TreeView.SelectedItemChanged

半城伤御伤魂 提交于 2019-12-12 00:04:44
问题 I am new to WPF, and suffering with an existing code. We have a tree, which has many branches/leaves. In one branch we have a DataGrid. If we click on the empty area of the grid (where no rows are), then TreeView.SelectedItemChanged called properly. In our case, SelectedItem = 'SelectedGridBorder' (see XAML below) But if we click on a row/cell of the grid, row gets focused, but TreeView.SelectedItemChanged is NOT called. So TreeView.SelectedItem is still the previously selected item. Is is

Selected TreeViewItem is null

落花浮王杯 提交于 2019-12-11 19:22:20
问题 I wanted to create a ContextMenu for my TreeView. TreeView XAML: <helper:ExtendedTreeView Grid.Row="5" ItemsSource="{Binding OCFrage, Mode=TwoWay}" SelectedItem_="{Binding SelectedItem, Mode=TwoWay}" SelectedItemChanged="treeView1_SelectedItemChanged" x:Name="treeView1" Height="205" Width="215"> <helper:ExtendedTreeView.Resources> <HierarchicalDataTemplate DataType="{x:Type model:T_Frage}" ItemsSource="{Binding Wertung, Mode=TwoWay}"> <TextBlock Text="{Binding Text}"/> <

Get ListView value

我是研究僧i 提交于 2019-12-11 17:54:12
问题 I am trying to get data from a listview box and have been unsuccessful. <ListView Name="lst_CallData" Width="950" Height="500" Grid.Row="1" Grid.ColumnSpan="2" ScrollViewer.VerticalScrollBarVisibility="Auto" ScrollViewer.HorizontalScrollBarVisibility="Hidden"> <ListView.View> <GridView> <GridViewColumn Header="Name" DisplayMemberBinding="{Binding Col0}" Width="150" /> <GridViewColumn Header="Num" DisplayMemberBinding="{Binding Col1}" Width="200" /> <GridViewColumn Header="ID"

How to customize the color of the currently selected item of a listbox?

纵饮孤独 提交于 2019-12-11 14:50:03
问题 This question results out of my last question here in stackoverflow. The problem to scroll automatically to a specific item is solved, but now i want to set the selected item background to transparent or white. How can i do this?? Update 1 <ListBox ItemsSource="{Binding SomeData}" SelectedIndex="{Binding SomeIndex}"> <ListBox.ItemsPanel> <ItemsPanelTemplate> <WrapPanel Orientation="Vertical" /> </ItemsPanelTemplate> </ListBox.ItemsPanel> <ListBox.ItemTemplate> <DataTemplate> <SomeChart

ListBox Selected Item

╄→尐↘猪︶ㄣ 提交于 2019-12-11 13:16:36
问题 I am developing a wpf app. I have a database like this. I have three columns(id,name,profession).listbox shows name column. When the user clicks the item in listbox, i wanna show his/her profession in textblock. listbox works well. I have bounded it to a dataview. but how can i show his/her profession in textblock? private void listBox1_SelectionChanged(object sender, SelectionChangedEventArgs e) { //What can I write here? } 回答1: You should proably just bind the text attribute of the

Xamarin.Forms ListView set SelectedItem by Code

强颜欢笑 提交于 2019-12-11 11:13:40
问题 How can I set the SelectedItem of a ListView in my Code? My problem is, that is isn't highlighted when I preselect an item in my code. The ListView is defined in the xaml file. <ListView ItemsSource="{Binding Items}" SelectedItem="{Binding SelectedItem}" /> My ViewModel class MyViewModel { List<MyItem> Items {get; set;} MyItem SelectedItem { get; set; } public MyViewModel() { Items = new List<MyItem>{ ... }; SelectedItem = Items.First(); } } But when I show the view, it is not highlighting

Get callback/execute some code when a tab on Tab Bar is clicked

烈酒焚心 提交于 2019-12-11 10:57:51
问题 Alternatively, I could use something like viewWillAppear, only switching tabs doesn't call viewWillAppear - IF I can access selectedItem or selectedIndex reliably from there. The goal is to re-use a similar table view, with 3 tabs filling the table with differently filtered data. I tried overriding didSelect and using the app delegate as UITabBarDelegate, but got the error 'Changing the delegate of a tab bar managed by a tab bar controller is not allowed.' The tab bar controller, rootCt, is

WPF: ComboBox with selecteditem set make not use of SelectedIndex=0?

淺唱寂寞╮ 提交于 2019-12-11 07:53:00
问题 Why is the first element in my combobox popup menu not shown in the selected item area of my combobox , when I use the SelectedItem binding? Without that it is showing up ?? Using the same code selecteditem + selectedindex that is no problem! <ComboBox ItemsSource="{Binding SchoolclassSubjectViewModels}" SelectedItem="{Binding SelectedSchoolclassSubjectViewModel}" SelectedIndex="0" Height="23" HorizontalAlignment="Left" Margin="375,13,0,0" VerticalAlignment="Top" Width="151"> <ComboBox