问题标签 [selecteditem]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
wpf - Selected item in listbox unreadable because of the color
I dynamically create a collection of stackpanels in my listbox. In this stackpanel are contained labels and checkbox horizontally aligned.
The problem is when I click on a stackpanel, the selection is unreadable because the line become dark-blue whereas the letters stay black so black on blue, you see nothing. How can I dynamically change the forecolor of the selected elements in the stackpanel? I say dynamically and not in the xml file, because all those elements are dynamically created from a database.
I have code similar to this:
contentpresenter won't work... I tried several way to position it... So, I found a way to circle the problem ... in the app.xaml :
Thus the background of selected items is clearer so that the user can still read text of the selected listboxitems.
and every listboxitem is concerned.
and yet... I would love to know how on earth it's possible to change the selected item's text color in list box.. if I manage to get the answer I'll keep you in touch...
I did this...
but stll not working, it says the trigger property can't be found in ControlTemplate... I tried to add it after the trigger property, but not working either...
I tried something like this in the App.xaml : "
and in the particular xaml file where my listbox is :
but when executing, nothing appears anymore in the listbox, nothing... I don't get it...
iphone - UITabbar without controller
I have a simple app where the only view controller has an outlet to a UITabBar. It also implements UITabBarDelegate and is set as the delegate for the UITabBar:
I implemented the following method Which gets called whenever any of my 4 UITabBarItems get tapped. I tried just doing something really simple:
In theory, it should always stay selected on my first tab and it works perfectly when I just tap any UITabBarItem (nothing happens, the first one always stays selected). But when I touch a UITabBarItem and hold it (not taking my finger off) the selection changes anyway ! Debugging, everything gets called properly.
It's like changing the selectedItem property doesn't have any effect is the user still has the item "down" (with his finger on it).
What would be a good workaround? I tried overloading UITabBar and messing with touchesBegan and touchesEnd but they don't even get called. Same with UITabBarItem.
Oh and please don't suggest using a UITabBarController as it is not flexible enough for my application.
So frustrating....thanks!
c# - 如何保持选中项?- 列表显示
当用户单击没有项目的空间时,我想在 ListView 上保留一个项目。例如,项目下方的空间,但仍在 ListView 组件上。我已将 ListView 属性“HideSelection”更改为 false,但这仅在焦点更改为另一个组件时有效;不是当用户单击 ListView 本身时。谢谢!
cocoa - 在 Mac UI 中获取当前选定的项目
我想获取当前选定的项目(文本、图像等)并在按下键盘快捷键时显示在我的 Cocoa 应用程序窗口中。例如,Droplr 具有这样的功能。我该怎么做呢?
例如,我希望它在屏幕上选择该文本时将“(文本、图像等)”作为文本返回,如下所示: http: //drp.ly/JAdv
wpf - WPF ComboBox SelectedItem - 更改为以前的值
我有一个将 SelectedItem 绑定到 ViewModel 的 ComboBox。
当用户在 View ComboBox 中选择一个新项目时,我想显示一个提示并验证他们是否要进行更改。
在视图模型的 SetItem 属性设置器中,我显示一个对话框来确认选择。当他们说是时,它工作正常。
我的问题是,当用户单击“否”时,我不确定谁让 ComboBox 恢复到以前的值。ViewModel 中的 Property 具有正确的旧值,但在 View 中,ComboBox 显示新选择的值。
我希望用户选择一个项目,确认他们想要继续它,如果他们决定不这样做,我希望 ComboBox 恢复到上一个项目。
我怎样才能做到这一点?谢谢!
c# - 如何以编程方式编辑选定的子项?
有谁知道如何在 listView 上编辑子项?我试过用这个:
但这不起作用。我收到错误“InvalidArgument='1' 的值对'index' 无效”。我在列表视图上有两列,所以我认为 [1] 的索引将是子项。
c# - WPF ListView SelectedItem 为空
我有一个列表视图,其中有一个复选框作为列之一。如果我单击除实际复选框之外的任何位置,则 ListView 的 SelectedItem 会按预期设置为当前选定的行。另一方面,如果我单击复选框(没有先单击该行),则 SelectedItem 为空或先前单击的行。
谁能帮我吗....
干杯
c# - 将 WPF Combobox 的 SelectedItem 转换为 Color 会导致异常
我有一个与可用系统颜色绑定的组合框。当用户选择一种颜色时,会触发以下代码:
这会引发带有以下消息的转换异常:“指定的转换无效。” 当我在调试器中将鼠标悬停在 cboFontColour.SelectedItem 上时,它始终是一个 Color 对象。
我不明白为什么系统似乎无法从颜色转换为颜色,任何帮助都会非常感激。
wpf - 基于匹配对象在 XAML 中设置 ComboBox.SelectedItem
我已经模板化ComboBox
了,它基本上充当了一个简单的调色板。它填充了SolidColorBrush
对象列表。
我还有一些保存当前颜色的十六进制值的数据和一个将十六进制转换为SolidColorBrush
.
我正在尝试的是根据我的数据源中的颜色设置SelectedItem
属性。ComboBox
由于我的组合填充了 type 的对象SolidColourBrush
,并且我的绑定转换器返回 a SolidColorBrush
,我认为这很简单:
但是......它不起作用:(
我已经通过对ComboBox
.
所以,很明显,我不能只说 SelectedItem = [something],其中 [something] 基本上是一个等于我想要被选中的项目的对象。
这样做的正确方法是什么?当然,在仅 XAML 的样式中使用绑定是可能的,而且我不必做一些讨厌的 C# 迭代组合框中的所有项目来尝试找到匹配项(这看起来非常老派)......?
wpf - Wpf SelectedItem 不适用于 ListView 中的组合框
我在 ListView 中遇到了 Combobox 的问题。我有一个名为“Substrate”的课程。该类包含一个名为“SubstrateType”的类的对象。我想在 Listview 中显示“Substrate”类的对象。“Substrate”的每个属性都显示在 Listview 的列中。对于不同的“SubstrateType”,我想使用组合框。
在 XAML 中,我这样尝试:
在代码隐藏中,我得到了两个 ObservableCollections。一个用于所有 Substrate,一个用于所有可能的 SubstrateTypes。如果单击组合框,则会显示所有 SubstrateType。但是如果您不选择一个,则组合框没有选定项。
http://i44.tinypic.com/2eakxav.png
提前致谢。