为了账号安全,请及时绑定邮箱和手机立即绑定

我创建的参数不起作用 usercontrol wpf

我创建的参数不起作用 usercontrol wpf

C#
慕田峪4524236 2021-07-07 13:00:26
 <Border Grid.Row="0"  Height="auto" x:Name="BorderEcs" Background="#9494a5"   BorderThickness="1,0,1,1" BorderBrush="#9494a5"  CornerRadius="10,10,0,0">        <StackPanel Height="auto">            <Label x:Name="LblTitl" Content="" Margin="5,0,0,0" Height="auto"  Foreground="#FFFFFF" FontFamily="Century Gothic" FontSize="13" />            <DataGrid  Width="{Binding ControlWidth, RelativeSource={RelativeSource Self},Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"                        Height="{Binding ControlHeight, RelativeSource={RelativeSource Self},Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"                                      CellStyle="{StaticResource DataGridContentCellCentering}"                           RowStyle="{StaticResource RowStyle}"                            ColumnHeaderStyle="{StaticResource ColumnHeaderStyle}"                            Style="{StaticResource DataGridStyle}"                             AlternatingRowBackground="White"                            AlternationCount="2">            </DataGrid>        </StackPanel>{ 公共部分类 UCDataGrid : UserControl,INotifyPropertyChanged { public UCDataGrid() { InitializeComponent(); 数据上下文 = 这个;public static DependencyProperty ControlHeightProperty = DependencyProperty.Register("ControlHeight", typeof(int), typeof(UCDataGrid));    public static  DependencyProperty ControlWidthProperty =        DependencyProperty.Register("ControlWidth", typeof(int), typeof(UCDataGrid));    public event PropertyChangedEventHandler PropertyChanged;    public int ControlHeight    {        get { return (int)GetValue(ControlHeightProperty); }        set { SetValue(ControlHeightProperty, value);            OnProperyChanged("ControlHeight");        }    }    public int ControlWidth    {        get { return (int)GetValue(ControlWidthProperty); }        set { SetValue(ControlWidthProperty, value); OnProperyChanged("ControlWidth"); }    } 
查看完整描述

1 回答

  • 1 回答
  • 0 关注
  • 214 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信