【问题标题】:datepicker issue- calendar size is too bigdatepicker 问题 - 日历大小太大
【发布时间】:2015-09-11 11:34:49
【问题描述】:

以下 xaml 日期选择器(下拉)日历及其天数宽度太大。如何减小压光宽度和压光天数。 请帮我解决这个问题

<Grid Grid.Column="0">
<Grid.ColumnDefinitions >
                                <ColumnDefinition Width="134"/>
    <ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions >
    <RowDefinition />
    <RowDefinition />
    <RowDefinition />
    <RowDefinition />
</Grid.RowDefinitions>
<TextBlock Text="Client Name" Grid.Row="0" Grid.Column="0"/>
<TextBox Text="{Binding DataContext.client_name, ElementName=Parant}" 
         MaxLength="50"
         Padding="2"
         Height="25"
         Grid.Row="0" Grid.Column="1"/>

<TextBlock Text="Building Location" Grid.Row="1" Grid.Column="0"/>
<TextBox MaxLength="255" 
         Text="{Binding DataContext.location, ElementName=Parant}"  
         Grid.Row="1" 
         AcceptsReturn="True" 
         TextWrapping="Wrap" 
         Height="40"
         Grid.Column="1" />

<TextBlock Text="Date" Grid.Row="2" Grid.Column="0"/>
<!--<TextBox MaxLength="255" 
         Text="{Binding DataContext.survey_date, ElementName=Parant}"  
        Grid.Row="2" Grid.Column="1"/>-->
<DatePicker Name="DtpFromDate"  
                SelectedDate="{Binding DataContext.SurvayDatetime , ElementName=Parant}" 
                Margin="5"
                Width="230"
                HorizontalAlignment="Left" 
                Height="25"  Grid.Row="2" Grid.Column="1"  />


<!--<TextBlock Text="Edit Lock:" Grid.Row="3" Grid.Column="0"/>
<ComboBox ItemsSource= "{Binding DataContext.elockList, ElementName=Parant}"  
          SelectedValue="{Binding DataContext.elock, ElementName=Parant}"  
          Grid.Row="3" Grid.Column="1" />-->

<TextBlock Text="Turn Around Time" Grid.Row="3" Grid.Column="0"/>
<ComboBox ItemsSource="{Binding DataContext.turnaroundList, ElementName=Parant}"
           SelectedValue ="{Binding DataContext.turnaround, ElementName=Parant}"  
          Height ="25"
          Grid.Row="3" 
          Grid.Column="1"/>

请看日历的图片,并给出解决这个问题的解决方案。 我的日期选择器显示如下:

【问题讨论】:

  • 看起来你定义的宽度太大了。尝试将其更改为 150
  • 你能把附件Grid的代码贴出来吗?
  • 您有 TextBlock 样式或其他可能会影响它的样式吗?我过去曾在该控件上遇到过类似的问题
  • 我的windows资源是:
  • 我检查过了,但在我的 windows.resource 中我只设置了宽度、高度、边距和填充

标签: wpf datepicker


【解决方案1】:

添加日历自定义样式后问题解决

【讨论】:

  • 你可能已经展示了样式,或者它不是真正的解决方案。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-10-08
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多