标签: selecteditem

单击选项卡栏上的选项卡时获取回调/执行一些代码

或者,我可以使用类似 viewWillAppear 的东西,只有切换选项卡不会调用 viewWillAppear - 如果我可以从那里可靠地访问 selectedItem 或 selectedIndex 。

目标是重新使用类似的表格视图,其中 3 个选项卡用不同过滤的数据填充表格。

我尝试覆盖 didSelect 并将应用程序委托用作 UITabBarDelegate,但收到错误“不允许更改由选项卡栏控制器管理的选项卡栏的委托”。

标签栏控制器 rootCt 位于应用程序委托中并且可以正常工作。

所以这就是我正在寻找的技巧 - 当索引更改时从根(标签栏)控制器获取通知。想法?

iphone selecteditem notify uitabbar

1
推荐指数
1
解决办法
5123
查看次数

Silverlight:如何通过数据上下文获取DataGrid中的数据网格行

给定Silverlight数据网格,如何找到具有特定数据上下文的相应数据网格行?

silverlight datacontext datagrid selecteditem

1
推荐指数
1
解决办法
4614
查看次数

标签必须是一个简单的标识符?Flash/Flex Builder

我有这个代码:

public function chooseCategoryDDL_changeHandler(event:IndexChangeEvent):void {

       var para:Object = new Object();
           para.action = "changecategoryxml";
           para.book_class = event:IndexChangeEvent.book_class;

           if (event.IndexChangeEvent > -1 ) {
           changeCategory.send(para);
           }
Run Code Online (Sandbox Code Playgroud)

我不断收到错误消息"标签必须是一个简单的标识符".理想情况下,我想将代码编写为state:

 ... para.book_class = event.selectedItem.book_class;

           if (event.selectedItem > -1 ) {
           changeCategory.send(para);
           }
Run Code Online (Sandbox Code Playgroud)

但是,当我尝试使用selectedItem语法时,它为我提供了"访问未定义属性selectedItem".我真的把这头发撕掉了,这已经困扰了我多年.如果有人能够对此有所了解,我将永远感激:)

谢谢

syntax selecteditem flash-builder

1
推荐指数
1
解决办法
3805
查看次数

当用户在ItemTemplate文本框中单击时,在ListView中设置SelectedItem

我有以下ListView(简化):

<ListView Name="lvwNotes" KeyUp="lvwNotes_KeyUp">
    <ListView.ItemTemplate>
        <DataTemplate>
            <StackPanel Orientation="Vertical">
                <DockPanel Background="LightGray">
                     <TextBlock DockPanel.Dock="Right" Text="{Binding Path=Author}" />
                     <TextBlock Text="{Binding Path=Timestamp}" />
                </DockPanel>
                <TextBox Text="{Binding Path=Text}" 
                         GotFocus = "lvwNotes_TextBox_GotFocus"
                         TextWrapping="Wrap" />
            </StackPanel>
        </DataTemplate>
    </ListView.ItemTemplate>
Run Code Online (Sandbox Code Playgroud)

通过单击更改所选项目仅在用户使用TextBlocks单击DockPanel时有效,但在单击TextBox时则无效.我想要实现的是将所选项目设置为包含用户单击的TextBox的项目.

我设法通过与TextBox相关的ListViewItem:

private void lvwNotes_TextBox_GotFocus(object sender, RoutedEventArgs e) {
    DependencyObject o = Tools.GetAncestorByType((DependencyObject)sender, typeof(ListViewItem));
    if (!o.Equals(null)) {
        // code to select this ListViewItem
    }
}
Run Code Online (Sandbox Code Playgroud)

但是设定

lvwNotes.SelectedIten = o ;
Run Code Online (Sandbox Code Playgroud)

仍然没有效果.我也尝试过Dispatcher.BeginInvoke的一些技巧,但说实话,我并不确切知道我在那里做什么.

wpf listview textbox selecteditem itemtemplate

1
推荐指数
1
解决办法
3501
查看次数

如果选中单选按钮如何读取并使用javascript将其保存为1?

我有3个单选按钮:

<div id="step-1">
    <h2 class="StepTitle">
        <label style="font-weight: bold; color: #662819;" id="frage1"></label>
    </h2>
    <br />

    <input type="radio" name="group1" id="antwort1" value="" onmousedown="this.__chk = this.checked" onclick="if (this.__chk) this.checked = false" />
    <label id="antwort1fuerFrage1"></label>
    <br />
    <br />

    <input type="radio" name="group1" id="antwort2" value="" onmousedown="this.__chk = this.checked" onclick="if (this.__chk) this.checked = false" />
    <label id="antwort2fuerFrage1"></label>
    <br />
    <br />

    <input type="radio" name="group1" id="antwort3" value="" onmousedown="this.__chk = this.checked" onclick="if (this.__chk) this.checked = false" />
    <label id="antwort3fuerFrage1"></label>
</div>
Run Code Online (Sandbox Code Playgroud)

我试图读取单选按钮是否被选中,并保存一个值(需要1或/ 0),如下所示:

var frage1 = document.getElementById("frage1").innerHTML;
var antwort1 = …
Run Code Online (Sandbox Code Playgroud)

javascript jquery selecteditem radio-group radio-button

1
推荐指数
1
解决办法
740
查看次数

数据绑定(使用MVVM模式)到DataGrid的RowDetailsTemplate中的WPF组合框的问题

我正在尝试将视图模型属性绑定到WPF组合框的'SelectedItem'属性.这个组合框驻留在DataGrid的RowDetailsTemplate中.绑定部分存在,因为视图模型的属性getter和setter在选择行时会被调用一次(因此会导致细节视图扩展).但是,在随后的组合框选择更改后,该属性永远不会被再次调用.这几乎就像数据上下文在行详细信息展开后不正确,或者在显示行详细信息后解除绑定.非常奇怪,我无法弄清楚如何在所有选择更改时调用该属性.必须要有办法.

我知道这个问题是由于组合框在行细节中,但我无法弄清楚如何解决它.有没有人遇到类似的问题?任何和我的意思是任何形式的信息或帮助将非常感激...我已经花了几天黑客攻击这个试图弄清楚为什么它的行为这样.

data-binding wpf combobox selecteditem mvvm

0
推荐指数
1
解决办法
1056
查看次数

每当ListView子控件获得焦点时如何更新ListViewItem.SelectedItem?

如何更好地ListView.SelectedItem控制内部的儿童控制ListView

<ListView ItemsSource="{Binding Path=Records, Mode=TwoWay}" IsSynchronizedWithCurrentItem="True">
     <ListView.SelectedItem>
          <Binding Path="SelectedRecord" Mode="TwoWay" UpdateSourceTrigger="PropertyChanged"/>
     </ListView.SelectedItem>
     <ListView.ItemContainerStyle>
          <Style TargetType="{x:Type ListViewItem}">
               <Style.Triggers>
                   <Trigger Property="IsKeyboardFocusWithin" Value="True">
                         <Setter Property="IsSelected" Value="True"/>
                   </Trigger>
               </Style.Triggers>
          </Style>
     </ListView.ItemContainerStyle>
     <ListView.Resources>
          <DataTemplate DataType="x:Type ListViewItem">
               <ListViewItem IsSelected="{Binding IsKeyboardFocusWithin"/>
          </DataTemplate>
     </ListView.Resources>
     <ListView.View>
          <GridView>
              <GridViewColumn>
              <TextBox ... Tag="{Binding}".../>
              </GridViewColumn>
              <GridViewColumn>
              <TextBox ... Tag="{Binding}".../>
              </GridViewColumn>
          </GridView>
     </ListView.View>
</ListView>
Run Code Online (Sandbox Code Playgroud)

ListView具有内子控件的行GridView列.我想更新ListView.SelectedItem任何行中的任何子控件具有键盘焦点时的绑定属性.如果可以在.xaml文件中完全完成而不必诉诸代码,那将是很棒的.

wpf listview selecteditem mvvm childcontrol

0
推荐指数
1
解决办法
4071
查看次数

ComboBox SelectedItem 初始值不是来自 ItemsSource

我无法理解组合框的行为。

我有一个编辑视图来编辑现有的订单数据。这是我的部分订单数据的 VM:

public class OrderDataViewModel : ViewModelBase, IOrderDataViewModel
{
    private readonly ICustomersListProviderService _customersListProviderService;
    private readonly Order _order;

    public OrderDataViewModel(Order order, ICustomersListProviderService customersListProviderService)
    {
        Assign.IfNotNull(ref _order, order);
        Assign.IfNotNull(ref _customersListProviderService, customersListProviderService);
    }

    public DateTime CreationDate
    {
        get { return _order.CreationDate ?? (_order.CreationDate = DateTime.Now).Value; }
        set
        {
            if (_order.CreationDate == value) return;

            _order.CreationDate = value;
            OnPropertyChanged();
        }
    }

    public Customer Customer
    {
        get { return _order.Customer; }
        set
        {
            if (_order.Customer == value) return;

            _order.Customer = value;
            OnPropertyChanged();
        }
    }


    private …
Run Code Online (Sandbox Code Playgroud)

wpf binding combobox selecteditem mvvm

0
推荐指数
1
解决办法
4497
查看次数

Xamarin 为所选项目形成全局变量

我需要将 Term.TermID 传递给 CoursesDetailsPage.cs,这样我基本上就可以将它用作外键,因为 SQLite 本身并没有\xe2\x80\x99t 实现这些。

\n

CoursesDetailsPage 从“课程”页面以模态方式调用,从“TermsDetails”页面以模态方式调用“TermsDetails”页面,从选择术语的“Terms”页面以模态方式调用该页面,因此仍应选择正确的术语。

\n

我需要在可以传递到 CoursesDetailsPage 的某个位置设置所选术语的 TermId(甚至只是其等效的 int),以便我可以将其设置为 CourseTermId。

\n

其余变量均通过 Xaml 中的绑定设置。

\n
TermsPage.xaml.cs\n\n//This is where the term is selected, and the first page that calls the modal stack.\nasync void OnTermSelected(object sender, SelectedItemChangedEventArgs e)\n{\n    if (e.SelectedItem != null)\n    {\n      await Navigation.PushModalAsync(new TermsDetailsPage\n        {\n        BindingContext = e.SelectedItem as Term\n        });\n    }\n}\n\n\n//The Term is then saved on the TermsDetailsPage:\nTermsDetailsPage.xaml.cs\n\nasync void OnSaveTermClicked(object sender, EventArgs e)\n{\nvar term = (Term)BindingContext;\nterm.TermName = ECTermName.Text;\nterm.TermStart = DPTermStart.Date;\nterm.TermEnd = DPTermEnd.Date;\nterm.IsFinished …
Run Code Online (Sandbox Code Playgroud)

c# global-variables selecteditem xamarin.forms

0
推荐指数
1
解决办法
3515
查看次数

单击按钮删除ListView行项

我有一个简单的listview每行删除按钮

现在当我单击删除按钮时,应删除所选的列表视图行.

这是我的Listview:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
           android:layout_width="match_parent"
           android:layout_height="match_parent" >

 <ListView android:id="@+id/itemslistview"
           android:layout_height="match_parent"
           android:layout_width="match_parent"
           android:layout_marginTop="75dp"/>
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)

ListViewRow:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
          android:orientation="horizontal"
          android:layout_width="match_parent"
          android:layout_height="match_parent">

    <TextView
          android:id="@+id/textView"
          android:layout_width="wrap_content" 
          android:layout_height="wrap_content" 
          android:layout_weight="2"
          android:padding="10dp"
          android:textSize="16sp"
          android:ems="10" 
          android:textColor="#800080" />
    <ImageView
           android:id="@+id/btndelete"
           android:layout_width="wrap_content" 
           android:layout_height="wrap_content"
           android:layout_weight="1" 
           android:src="@drawable/delete"
           android:layout_toRightOf="@+id/textView"
           android:layout_marginTop="5dp"/>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

这是我试图删除的方式:

lv.setOnItemClickListener(new OnItemClickListener() {
    @Override
    public void onItemClick(AdapterView<?> parent, View view,
                                                   int position, long id) {
        listrowposition= position;
        Button del =(Button)findViewById(R.id.btndelete);
        findViewById(R.id.deleteicon).setOnClickListener(
                                        new View.OnClickListener() {
            @Override
            public void onClick(View arg0) {
                MyList.remove(listrowposition);
                adp.notifyDataSetChanged(); …
Run Code Online (Sandbox Code Playgroud)

android listview selecteditem delete-row

-1
推荐指数
1
解决办法
3775
查看次数