コード例 #1
0
 /// <summary>
 /// Called when a ListBoxStateMachineItem is removed from the items collection.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void OnListBoxItemRemoved(object sender, ListBoxStateMachineItemEventArgs e)
 {
     if (e.Item != null)
     {
         e.Item.ResetItem();
         e.Item.ItemStateChanged -= OnItemStateChanged;
         UpdateLayout();
     }
 }
コード例 #2
0
 /// <summary>
 /// Called when a ListBoxStateMachineItem is added to the items collection.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void OnListBoxItemAdded(object sender, ListBoxStateMachineItemEventArgs e)
 {
     if (e.Item != null)
     {
         e.Item.Parent = this;
         e.Item.ItemStateChanged += OnItemStateChanged;
         UpdateLayout();
     }
 }
コード例 #3
0
 /// <summary>
 /// Handles the ItemStateChanged event for all items in the list box.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void OnItemStateChanged(object sender, ListBoxStateMachineItemEventArgs e)
 {
     OnItemStateChanged(e.Item);
 }
コード例 #4
0
 /// <summary>
 /// Called when a ListBoxStateMachineItem is removed to the selectedItems collection.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void OnSelectedItemsListBoxItemRemoved(object sender, ListBoxStateMachineItemEventArgs e)
 {
     e.Item.IsSelected = false;
 }
コード例 #5
0
 /// <summary>
 /// Called when a ListBoxStateMachineItem is added to the selectedItems collection.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void OnSelectedItemsListBoxItemAdded(object sender, ListBoxStateMachineItemEventArgs e)
 {
     if (items.Contains(e.Item))
     {
         if (selectionMode == SelectionMode.Single && selectedItems.Count > 1)
         {
             if (!selectedItems.Remove(e.Item))
             {
                 e.Item.IsSelected = false;
             }
         }
         else
         {
             e.Item.IsSelected = true;
         }
     }
     else
     {
         throw SurfaceCoreFrameworkExceptions.ItemIsNotInListBoxItemsCollection("Items");
     }
 }
コード例 #6
0
ファイル: ListBox.cs プロジェクト: AnthonyB28/Marist_Map
 /// <summary>
 /// Handles updating the flag texture on the selected cloth when the ListBox item selected changes.
 /// </summary>
 private void OnItemStateChanged(object sender, ListBoxStateMachineItemEventArgs e)
 {
     ListBoxItem item = e.Item as ListBoxItem;
     if (item != null && item.IsSelected)
     {
         textiles.CurrentTheme = item.Theme;
     }
 }