【发布时间】: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