public ButtonHome(string contendtext, string functionCode, string imagePath, int foreground = 0) : this() { this.imagePath = imagePath; this.contendtext = contendtext; this.Padding = new Thickness(1, 0, 1, 1); this.Height = 22; this.Width = 120; sp.Orientation = Orientation.Horizontal; image.Source = new BitmapImage(new Uri("/ERP;component/Images/" + this.imagePath, UriKind.Relative)); image.Height = 16; image.Width = 16; image.Margin = new Thickness(0, 0, 2, 0); sp2.Width = 92; sp2.Orientation = Orientation.Horizontal; sp.HorizontalAlignment = HorizontalAlignment.Left; tb.Text = this.contendtext; tb.FontSize = 13; tb.Margin = new Thickness(0, 4, 0, 0); //tb.FontFamily = new FontFamily("NSimSun"); tb.Padding = new Thickness(0); //tb.FontWeight = FontWeights.Bold; if (foreground == 1) { tb.Foreground = new SolidColorBrush(ComColorConstants.DarkRed); } sp2.Children.Add(tb); sp.Children.Add(image); sp.Children.Add(sp2); this.Content = sp; var trigger = new System.Windows.Interactivity.EventTrigger { EventName = "Click" }; var etc = new EventToCommand(); var binding = new Binding("CmdOpenWins") { Mode = BindingMode.OneWay }; BindingOperations.SetBinding(etc, EventToCommand.CommandProperty, binding); etc.CommandParameter = functionCode; trigger.Actions.Add(etc); System.Windows.Interactivity.Interaction.GetTriggers(this).Add(trigger); }
private void AddCommandTrigger(object viewModel, string eventName, string commandBinding) { InvokeCommandWithParamAction action = new InvokeCommandWithParamAction(); Binding actionBinding = new Binding(); actionBinding.Source = viewModel; actionBinding.Path = new PropertyPath(commandBinding); BindingOperations.SetBinding(action, InvokeCommandWithParamAction.CommandProperty, actionBinding); System.Windows.Interactivity.EventTrigger trigger = new System.Windows.Interactivity.EventTrigger(); trigger.EventName = eventName; trigger.Actions.Add(action); trigger.Attach(this); }
public void SetGotFocus(string bdCode) { var bd = new Binding("CmdGotFocus" + bdCode) { Mode = BindingMode.OneWay }; var trigger = new System.Windows.Interactivity.EventTrigger { EventName = "GotFocus" }; var etc = new EventToCommand(); BindingOperations.SetBinding(etc, EventToCommand.CommandProperty, bd); trigger.Actions.Add(etc); System.Windows.Interactivity.Interaction.GetTriggers(this).Add(trigger); }
public static void AttachActionMessage(this DependancyObject control, string eventName, string methodName, object parameter) { var action = new ActionMessage(); action.MethodName = methodName; action.Parameters.Add(new Parameter { Value = parameter }); var trigger = new System.Windows.Interactivity.EventTrigger(); trigger.EventName = eventName; trigger.SourceObject = control; trigger.Actions.Add(action); Interaction.GetTriggers(control).Add(trigger); }
protected void SetDropDownClosed(string bindFunctionName) { var trigger = new System.Windows.Interactivity.EventTrigger { EventName = "DropDownClosed" }; var etc = new EventToCommand(); var binding = new Binding("CmdDropDownClosed" + bindFunctionName) { Mode = BindingMode.OneWay }; BindingOperations.SetBinding(etc, EventToCommand.CommandProperty, binding); trigger.Actions.Add(etc); System.Windows.Interactivity.Interaction.GetTriggers(this).Add(trigger); }
public ButtonHelp(string commandname) : this() { var trigger = new System.Windows.Interactivity.EventTrigger { EventName = "Click" }; var etc = new EventToCommand(); var binding = new Binding(commandname) { Mode = BindingMode.OneWay }; BindingOperations.SetBinding(etc, EventToCommand.CommandProperty, binding); trigger.Actions.Add(etc); System.Windows.Interactivity.Interaction.GetTriggers(this).Add(trigger); }
protected void SetKeyDown(string bindFunctionName) { var trigger = new System.Windows.Interactivity.EventTrigger { EventName = "KeyDown" }; var etc = new EventToCommand() { PassEventArgsToCommand = true }; var binding = new Binding("CmdKeyDown" + bindFunctionName) { Mode = BindingMode.OneWay }; BindingOperations.SetBinding(etc, EventToCommand.CommandProperty, binding); trigger.Actions.Add(etc); System.Windows.Interactivity.Interaction.GetTriggers(this).Add(trigger); }
private static void AddOnLoad <T>(T t) where T : DependencyObject { if (t == null) { return; } var cmdMame = "CmdViewOnLoad"; var trigger = new System.Windows.Interactivity.EventTrigger { }; var etc = new EventToCommand(); var binding = new Binding(cmdMame) { Mode = BindingMode.OneWay }; BindingOperations.SetBinding(etc, EventToCommand.CommandProperty, binding); trigger.Actions.Add(etc); System.Windows.Interactivity.Interaction.GetTriggers(t).Add(trigger); }
public static void Init() { if (s_isInitialized) { return; } // Needed to prevent stripping of System.Windows.Interactivity // which is current only referenced in the XAML DataTemplates var eventTrigger = new System.Windows.Interactivity.EventTrigger(); string assemblyName = Assembly.GetExecutingAssembly().GetName().Name; System.Windows.Application.Current.Resources.MergedDictionaries.Add(new System.Windows.ResourceDictionary { Source = new Uri(string.Format("/{0};component/WPResources.xaml", assemblyName), UriKind.Relative) }); var accent = System.Windows.Application.Current.Resources["PhoneAccentBrush"] as SolidColorBrush; System.Windows.Media.Color color = accent.Color; Color.Accent = Color.FromRgba(color.R, color.G, color.B, color.A); Log.Listeners.Add(new DelegateLogListener((c, m) => Console.WriteLine("[{0}] {1}", m, c))); Device.OS = TargetPlatform.WinPhone; Device.PlatformServices = new WP8PlatformServices(); Device.Info = new WP8DeviceInfo(); Registrar.RegisterAll(new[] { typeof(ExportRendererAttribute), typeof(ExportCellAttribute), typeof(ExportImageSourceHandlerAttribute) }); Ticker.Default = new WinPhoneTicker(); Device.Idiom = TargetIdiom.Phone; ExpressionSearch.Default = new WinPhoneExpressionSearch(); s_isInitialized = true; }
private static void AddBindingValidationError <T>(T t) where T : DependencyObject { if (t == null) { return; } var cmdMame = "CmdViewBindingValidationError"; var trigger = new System.Windows.Interactivity.EventTrigger { EventName = "BindingValidationError" }; var etc = new EventToCommand { PassEventArgsToCommand = true, }; var binding = new Binding(cmdMame) { Mode = BindingMode.OneWay }; BindingOperations.SetBinding(etc, EventToCommand.CommandProperty, binding); trigger.Actions.Add(etc); System.Windows.Interactivity.Interaction.GetTriggers(t).Add(trigger); }
public RadioButtonErp(string bindIsEnableName, string groupName, string contendtext, string bindFunctionName, string commandParameterValue) : base() { this.Style = App.Current.Resources["RadioButtonStyleERP"] as Style; this.Padding = new Thickness(1, 2, 0, 2); this.Margin = new Thickness(1, 3, 0, 0); this.FontWeight = FontWeights.Bold; this.FontFamily = new FontFamily(ErpUIText.ErpFont); this.FontSize = ErpUIText.ErpFontSize; this.VerticalAlignment = VerticalAlignment.Center; this.Content = contendtext; this.GroupName = groupName; if (!string.IsNullOrEmpty(bindIsEnableName)) { var bd = new Binding(bindIsEnableName); this.SetBinding(RadioButton.IsEnabledProperty, bd); } var trigger = new System.Windows.Interactivity.EventTrigger { EventName = "Click" }; var etc = new EventToCommand() { CommandParameterValue = commandParameterValue }; var binding = new Binding(bindFunctionName) { Mode = BindingMode.OneWay }; BindingOperations.SetBinding(etc, EventToCommand.CommandProperty, binding); trigger.Actions.Add(etc); System.Windows.Interactivity.Interaction.GetTriggers(this).Add(trigger); }
private static void OnEventNameChanged(System.Windows.Interactivity.EventTrigger sender, DependencyPropertyChangedEventArgs args) { ((System.Windows.Interactivity.EventTrigger)sender).OnEventNameChanged((string)args.OldValue, (string)args.NewValue); }
public ButtonFun(string bindIsEnableName, string imagePath, string contendtext, string bindFunctionName, string bingIsShowName = "") : this() { this.bindIsEnableName = bindIsEnableName; this.imagePath = imagePath; this.contendtext = contendtext; this.bindFunctionName = bindFunctionName; this.Padding = new Thickness(0); this.Margin = new Thickness(2, 0, 2, 0); //this.Height = 23; //if (ComLanguageResourceManage.CurrentCulture.Name == "en-US") // this.Width = 75; //else // this.Width = 60; //this.Width = 60; var bindingie = new Binding(this.bindIsEnableName); this.SetBinding(Button.IsEnabledProperty, bindingie); this.bingIsShowName = bingIsShowName; if (!string.IsNullOrEmpty(this.bingIsShowName)) { var bindingis = new Binding(this.bingIsShowName); this.SetBinding(Button.VisibilityProperty, bindingis); } sp.Orientation = Orientation.Horizontal; sp.HorizontalAlignment = HorizontalAlignment.Left; //Image //if (!string.IsNullOrEmpty(this.imagePath)) //{ // image.Source = new BitmapImage(new Uri("/ERP;component/Images/" + this.imagePath, UriKind.Relative)); // image.Height = 16; // image.Width = 16; // image.Margin = new Thickness(0, 0, 1, 0); //} //if (image.Width > 0) //{ // sp.Children.Add(image); //} //text tb.Text = this.contendtext; tb.Margin = new Thickness(0, 0, 0, 0); tb.Padding = new Thickness(0); tb.FontWeight = FontWeights.Bold; sp.Children.Add(tb); this.Content = sp; var trigger = new System.Windows.Interactivity.EventTrigger { EventName = "Click" }; var etc = new EventToCommand(); var binding = new Binding(this.bindFunctionName) { Mode = BindingMode.OneWay }; BindingOperations.SetBinding(etc, EventToCommand.CommandProperty, binding); trigger.Actions.Add(etc); System.Windows.Interactivity.Interaction.GetTriggers(this).Add(trigger); }