标签: childcontrol

在c#中的usercontrol中公开并引发子控件的事件

你好.我有一个包含文本框的UserControl.我想访问文本框的textchanged事件,但在usercontrol的事件属性中,我没有看到文本框的事件.如何使用C#从Winforms中公开公开的UserControl公开和处理子控件的特定事件.

c# user-controls childcontrol winforms

25
推荐指数
1
解决办法
2万
查看次数

用于子控件的WPF鼠标悬停触发效果

可以说我有这段代码:

<Window>
    <Window.Resources>
        <Color x:Key="MyColor"
               A="255"
               R="152"
               G="152"
               B="152" />
        <DropShadowEffect x:Key="MyEffect" 
                          ShadowDepth="0"
                          Color="{StaticResource MyColor}"
                          BlurRadius="10" />
        <Style x:Key="MyGridStyle"
               TargetType="{x:Type Grid}">
            <Setter Property="Height"
                    Value="200" />
            <Setter Property="Width"
                    Value="200" />
            <Style.Resources>
                <Style TargetType="{x:Type TextBlock}">
                    <Setter Property="Width"
                            Value="100" />
                </Style>
                <Style TargetType="{x:Type Image}">
                    <Setter Property="Height"
                            Value="100" />
                    <Setter Property="Width"
                            Value="100" />
                </Style>
            </Style.Resources>
            <Style.Triggers>
                <Trigger Property="IsMouseOver"
                         Value="true">
                    <!-- How do I apply my effect when this grid is hovered over to Image and TextBox, but not the grid itself? -->
                </Trigger>
            </Style.Triggers> …
Run Code Online (Sandbox Code Playgroud)

wpf triggers mouseover effect childcontrol

8
推荐指数
1
解决办法
2万
查看次数

如何在onMouseDown事件中获取鼠标光标下的控件?

我有一个TGridLayout在Firemonkey HD应用程序中填充了一些图像.在gridLayout的onMouseDown事件中,我想获取用户点击的图像对象,但我只有鼠标坐标.

为每个图像实现onMouseDown事件不是一种选择,因为如果从gridlayout中删除图像,则会留下空白空间.在这种情况下,我还想知道用户是否已经点击了这个空白区域.

是否有某种"getChildAtPos"或"FindVCLWindow"模拟在Firemonkey

谢谢!

delphi childcontrol mouse-position mousedown firemonkey

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

如何使WPF Listbox子datatemplate控件在单击时选择ListBoxItem容器?

我有一个列表框,在datatemplate中我有一个Expander.

如果我单击Expander Header,扩展器将展开内容区域,但不会使父ListBoxItem选中.

如果我单击Expander的Expanded Content Zone,则会选择父ListBoxItem.

单击expandderHeader时如何使内容扩展并且父列表框项被选中?

.net wpf listbox listboxitem childcontrol

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

每当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
查看次数