第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

單擊數(shù)據(jù)網(wǎng)格列標(biāo)題中的元素

單擊數(shù)據(jù)網(wǎng)格列標(biāo)題中的元素

C#
慕森王 2021-10-23 16:10:02
我已將自定義樣式應(yīng)用于 DataGrid 的列標(biāo)題。這是它的簡化版本:<Style x:Key="DataGridColumnHeaderStyle" TargetType="{x:Type DataGridColumnHeader}">    <Setter Property="Template">        <Setter.Value>            <ControlTemplate TargetType="DataGridColumnHeader">                <Grid>                    <Border BorderBrush="{TemplateBinding BorderBrush}" Background="{TemplateBinding Background}" BorderThickness="{TemplateBinding BorderThickness}" HorizontalAlignment="{TemplateBinding HorizontalAlignment}" VerticalAlignment="{TemplateBinding VerticalAlignment}">                        <Grid>                            <StackPanel Orientation="Horizontal">                                <ContentPresenter Margin="5 0 5 0" HorizontalAlignment="Center" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />                                <Image IsHitTestVisible="True" Source="pin.png">                                    <Image.InputBindings>                                        <MouseBinding MouseAction="LeftClick" Command="{x:Static myView:MyCommand}" CommandParameter="{Binding}" />                                    </Image.InputBindings>                                </Image>                            </StackPanel>                        </Grid>                    </Border>                    <Thumb x:Name="PART_LeftHeaderGripper" Style="{StaticResource DataGridColumnHeaderResizeThumb}"/>                    <Thumb x:Name="PART_RightHeaderGripper" HorizontalAlignment="Right" Style="{StaticResource DataGridColumnHeaderResizeThumb}"/>                </Grid>            </ControlTemplate>        </Setter.Value>    </Setter></Style>單擊圖像時(shí),我正在努力使命令觸發(fā)。有什么我想念的嗎?單擊 DataGridColumnHeader 中的元素(即圖像)時(shí),是否有不同的方式可以觸發(fā)命令?更多細(xì)節(jié):MyCommand 是在 Window 的 CommandBindings 中定義的。我沒有在此處包含此代碼。我為其他工作正常的元素(即 DataGridCell)定義了類似的其他命令。似乎有一些特定于 DataGridColumnHeader 元素阻止命令被觸發(fā)的方式。
查看完整描述

1 回答

?
楊__羊羊

TA貢獻(xiàn)1943條經(jīng)驗(yàn) 獲得超7個(gè)贊

似乎您綁定到MyCommandxmlns 下的類型myView;相反,您應(yīng)該綁定到MyCommand(假設(shè)類MyCommand實(shí)現(xiàn)ICommand)的實(shí)例。你可以考慮在這里實(shí)現(xiàn)單例。或者您可以定義MyCommand任何地方的靜態(tài)實(shí)例。


查看完整回答
反對 回復(fù) 2021-10-23
  • 1 回答
  • 0 關(guān)注
  • 159 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號