This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<TreeView ... local:CheckBoxTreeViewItem.Checked="item_Checked" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<HierarchicalDataTemplate x:Key="CheckBoxTreeViewItemTemplate" ItemsSource="{Binding Items, Mode=OneWay}" > | |
<StackPanel Orientation="Horizontal"> | |
<Image Margin="2,0" Source="{Binding ImageSource, Mode=TwoWay}" /> | |
<CheckBox Focusable="False" IsChecked="{Binding IsChecked}" VerticalAlignment="Center" | |
<span style="background-color: #ffff00;">Command="{Binding CheckedEvent}"</span>/> | |
<ContentPresenter Content="{Binding Text, Mode=TwoWay}" Margin="2,0" /> | |
</StackPanel> | |
</HierarchicalDataTemplate> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public BindToClickEventCommand CheckedEvent | |
{ | |
get | |
{ | |
return new BindToClickEventCommand(TreeView); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class BindToClickEventCommand : ICommand | |
{ | |
private Action _handler; | |
public ViewModelCommand(Control control) | |
{ | |
// Get the control's Type | |
Type someTreeViewType = ((UIElement)control).GetType(); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Get the control's Type | |
Type controlViewType = ((UIElement)control).GetType(); | |
// Dig out the undocumented (yes, I know, it's risky) EventHandlerStore | |
// from the control's Type | |
PropertyInfo EventHandlersStoreType = | |
controlViewType.GetProperty("EventHandlersStore", | |
BindingFlags.Instance | BindingFlags.NonPublic); | |
// Get the actual "value" of the store, not just the reflected PropertyInfo |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This event uses the bubbling routing strategy | |
public static readonly RoutedEvent CheckedEvent = EventManager.RegisterRoutedEvent( | |
"Checked", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(TreeView)); | |
public static void AddCheckedHandler(DependencyObject d, RoutedEventHandler handler) | |
{ | |
UIElement uie = d as UIElement; | |
if (uie != null) | |
{ | |
uie.AddHandler(CheckedTreeViewItem.CheckedEvent, handler); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.ComponentModel; | |
using System.Linq; | |
using System.Text; | |
using System.Windows.Controls; | |
public class CheckedTreeViewItem : ItemsControl, INotifyPropertyChanged | |
{ | |
bool? _isChecked = false; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<HierarchicalDataTemplate x:Key=" | |
CheckBoxTreeViewItemTemplate" | |
ItemsSource="{Binding Items, Mode=OneWay}" > | |
<StackPanel Orientation="Horizontal"> | |
<Image Margin="2,0" Source="{Binding ImageSource, Mode=TwoWay}" /> | |
<CheckBox Focusable="False" IsChecked="{Binding IsChecked}" VerticalAlignment="Center"/> | |
<ContentPresenter Content="{Binding Text, Mode=TwoWay}" Margin="2,0" /> | |
</StackPanel> | |
</HierarchicalDataTemplate> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'woocommerce_thankyou', 'google_trusted_stores_confirmation' ); | |
function google_trusted_stores_confirmation( $order_id ) { | |
// Lets grab the order | |
$order = wc_get_order( $order_id ); | |
$customer = get_current_user_id(); |
NewerOlder