Wpf 在视图加载期间避免下拉选择更改事件
网格包含下拉控件。我希望在视图加载期间避免选择更改事件。实现这一点的最佳方法是什么?我不知道WPF中的下拉控件是什么 我尝试了combobox和SelectionChanged事件在表单加载时不触发 这是我的密码Wpf 在视图加载期间避免下拉选择更改事件,wpf,Wpf,网格包含下拉控件。我希望在视图加载期间避免选择更改事件。实现这一点的最佳方法是什么?我不知道WPF中的下拉控件是什么 我尝试了combobox和SelectionChanged事件在表单加载时不触发 这是我的密码 <Window x:Class="Q6.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.mi
<Window x:Class="Q6.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:Q6"
mc:Ignorable="d"
Title="MainWindow" Height="350" Width="525">
<Grid>
<ComboBox SelectionChanged="ComboBox_SelectionChanged"
Height="30" Width="100">
<ComboBoxItem>Alpha</ComboBoxItem>
<ComboBoxItem>Beta</ComboBoxItem>
<ComboBoxItem>Gamma</ComboBoxItem>
</ComboBox>
</Grid>
</Window>
以及背后的代码:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace Q6
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
private void ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
//Not firing at load time
}
}
}
你能上传你的代码吗,或者到目前为止你有什么?甚至是一张照片。它在尝试回答时会有所帮助。private void Comment_SelectionChangedobject sender,SelectionChangedEventArgs e{gridEntityTransaction.SetFocusedRowCellValueComments,string.Empty;}。。。。。。。。我们在用户控件加载事件中绑定了网格。在用户控件加载期间,不应执行选择更改事件中的此代码。