wpf-controls 相关问题

WPF控件包括UserControls,它是其他控件的复合集合,以及CustomControls,它们是使用WPF样式和模板构建的控件。

WPF控件模板源码参考

我相信微软最近发布了WPF的源代码。我知道已经有.Net库的源代码参考(Source Reference) 我看到微软 WPF 控件的源代码...

回答 2 投票 0

如何为自定义WPF控件添加最小和最大验证?

我想创建一个具有多个 WPF 依赖属性的自定义控件。 属性之一是返回 Thickness 对象。 自定义控件应该适合设计使用...

回答 1 投票 0

C# WPF标签背景根据百分比属性填充

我想制作一个自定义控件标签,它可以有一个名为百分比的属性,背景将根据该百分比填充。示例:label.Percentage = 70 然后

回答 1 投票 0

无法在 WPF 文本框中输入重音字符

我正在编写一个 WPF 应用程序来进行意大利语词汇练习。 当我尝试使用 Windows 键盘快捷键输入重音字符时,它仅作为基础字符出现在文本框中。 例如...

回答 1 投票 0

如何在 WPF WrapPanel 中将几个标签居中对齐?

我在 WPF StackPanel 和 WrapPanel 中放置了一些标签,如下所示,这样我就可以用粗体显示其中的部分内容。 我在 WPF StackPanel 和 WrapPanel 中放置了一些标签,如下所示,这样我就可以用粗体显示其中的部分内容。 <Grid Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="1" Grid.RowSpan="2"> <StackPanel Margin="10,15,20,5" > <WrapPanel Orientation="Horizontal" HorizontalAlignment="Center"> <Label Name="WarningLabelTextLookOverPart1" Content="{Binding WarningLabelTextLookOverPart1}" FontFamily="{DynamicResource NormalFontFamily}" FontSize="{DynamicResource NormalFontSize}" FontWeight="Normal" Style="{DynamicResource H2Label}" Foreground="{DynamicResource BlackEightyBrush}" Visibility="{Binding ShowIdCapture, Converter={StaticResource BooleanVisibilityConverterCollapsedWhenFalse}}"/> <Label Name="WarningLabelTextLookOverPart2" Content="{Binding WarningLabelTextLookOverPart2}" FontFamily="{DynamicResource NormalFontFamily}" FontSize="{DynamicResource NormalFontSize}" FontWeight="Bold" Style="{DynamicResource H2Label}" Foreground="{DynamicResource BlackEightyBrush}" Visibility="{Binding ShowIdCapture, Converter={StaticResource BooleanVisibilityConverterCollapsedWhenFalse}}"/> <Label Name="WarningLabelTextLookOverPart3" Content="{Binding WarningLabelTextLookOverPart3}" FontFamily="{DynamicResource NormalFontFamily}" FontSize="{DynamicResource NormalFontSize}" FontWeight="Normal" Style="{DynamicResource H2Label}" Foreground="{DynamicResource BlackEightyBrush}" Visibility="{Binding ShowIdCapture, Converter={StaticResource BooleanVisibilityConverterCollapsedWhenFalse}}"/> <Label Name="WarningLabelTextLookOverPart4" Content="{Binding WarningLabelTextLookOverPart4}" FontFamily="{DynamicResource NormalFontFamily}" FontSize="{DynamicResource NormalFontSize}" FontWeight="Bold" Style="{DynamicResource H2Label}" Foreground="{DynamicResource BlackEightyBrush}" Visibility="{Binding ShowIdCapture, Converter={StaticResource BooleanVisibilityConverterCollapsedWhenFalse}}"/> </WrapPanel> </StackPanel> </Grid> 看起来像这样 有关如何将标签集中对齐的任何建议,即将“您被起诉”部分居中。 您可以将 UniformGrid 与 1 列与 WrapPanel 组合使用,如下所示 <Grid Grid.Row="1" Grid.RowSpan="2" Grid.Column="0" Grid.ColumnSpan="2"> <StackPanel Margin="10,15,20,5"> <UniformGrid HorizontalAlignment="Center" Columns="1"> <WrapPanel Orientation="Horizontal"> <Label Name="WarningLabelTextLookOverPart1" Content="If the customer look under 25," FontWeight="Normal" Foreground="Black"/> <Label Name="WarningLabelTextLookOverPart2" Content="it's YOUR reposibility to ask for ID" FontWeight="Bold" Foreground="Black"/> <Label Name="WarningLabelTextLookOverPart3" Content="to check this and failure to do so could result in" FontWeight="Normal" Foreground="Black"/> </WrapPanel> <Label Name="WarningLabelTextLookOverPart4" HorizontalAlignment="Center" Content="you being prosecuted" FontWeight="Bold" Foreground="Black"/> </UniformGrid> </StackPanel> </Grid> 下次提问时,请提供最小的可重现示例,即将绑定更改为实际文本。

回答 1 投票 0

尝试从派生类向 GridViewDataColumn 添加过滤器

所以我有以下场景 具有列表绑定的 RadGridView 这是我的 XAML 所以我有以下场景 带有列表绑定的 RadGridView 这是我的 XAML <telerik:RadGridView x:Name="grid" Grid.Row="0" ItemsSource="{Binding BaseClassesList}" IsFilteringAllowed="True" IsReadOnly="true"> <telerik:RadGridView.Columns> <telerik:GridViewDataColumn DataMemberBinding="{Binding Name}" /> <telerik:GridViewDataColumn> <DataTemplate DataType="{x:Type DerivedClass}"> <TextBlock Text="{Binding WhatIWant}"/> </DataTemplate> </telerik:GridViewDataColumn> </telerik:RadGridView.Columns> </telerik:RadGridView> 这是我的视图模型 public List<BaseClass> BaseClassesList {get;set;} 这是我的基类 public class BaseClass { public string Name{ get; set; } public string Filler1{ get; set; } public string Filler2{ get; set; } } 这是我的派生类 public class DerivedClass : BaseClass { public string WhatIWant{ get; set; } } 如您所见,我绑定到了 BaseClasses 列表,一切正常,我可以获得我想要的所有信息。 但是,由于我正在访问 BaseClass 而不是 DerivedClass 的列表,因此 GridViewDataColumn 无法发挥其魔力并允许列筛选器工作。漏斗图标/按钮不出现。 除了此过滤功能之外,所有信息都正确显示在网格中 我尝试定义 DataTemplate、DataMemberPath、Filtering 标志,但到目前为止什么也没定义。 因此,经过大量的墙壁撞击和岩石粉碎之后,我终于找到了解决方案。 但在此之前,为了简单起见,我之前没有说的是我有第三个派生类,我想要访问的内容就在它上面 public class DerivedDerivedClass : DerivedClass { public string WhatIWant{ get; set; } //Removed from here } 第一件事是将我想要访问的内容移至基类的第一个派生 public class DerivedDerivedClass : DerivedClass { public string WhatIWant{ get; set; } //Removed from here } public class DerivedClass : BaseClass { public string WhatIWant{ get; set; } //Placed here } 在 XAML 网格中,我必须将 DataType 和 FilterMemberPath 添加到列中。我最初在 DataTemplate 上有 DataType,但这不起作用 <telerik:RadGridView.Columns> <telerik:GridViewDataColumn DataMemberBinding="{Binding Name}" /> <telerik:GridViewDataColumn DataType="{x:Type DerivedClass}" FilterMemberPath="WhatIWant"> <DataTemplate DataType="{x:Type DerivedClass}"> //DataType should not be defined here <TextBlock Text="{Binding WhatIWant}"/> </DataTemplate> </telerik:GridViewDataColumn> </telerik:RadGridView.Columns>

回答 1 投票 0

WPF 密码框提示不起作用

我正在尝试在WPF中设置PasswordBox的样式,以便它可以显示提示。 我通过在 ResourceDictionary 中使用以下代码来执行此操作: 我正在尝试在WPF中设置PasswordBox的样式,以便它可以显示Hint。 我通过在 ResourceDictionary 中使用以下代码来完成此操作: <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:BudgetBuddy.Styles"> <Style x:Key="PBHintStyle" TargetType="{x:Type PasswordBox}"> <Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.WindowBrushKey}}"/> <Setter Property="BorderBrush" Value="#FFABADB3"/> <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/> <Setter Property="BorderThickness" Value="1"/> <Setter Property="KeyboardNavigation.TabNavigation" Value="None"/> <Setter Property="HorizontalContentAlignment" Value="Left"/> <Setter Property="FocusVisualStyle" Value="{x:Null}"/> <Setter Property="AllowDrop" Value="True"/> <Setter Property="ScrollViewer.PanningMode" Value="VerticalFirst"/> <Setter Property="Stylus.IsFlicksEnabled" Value="False"/> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type PasswordBox}"> <Border x:Name="border" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="True" CornerRadius="4" Padding="5 2 0 0"> <Grid> <ScrollViewer x:Name="PART_ContentHost" Focusable="False" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden"/> <TextBlock x:Name="WARKTEXT" Text="{TemplateBinding Tag}" Foreground="DimGray" Visibility="Collapsed" /> </Grid> </Border> <ControlTemplate.Triggers> <Trigger Property="IsEnabled" Value="False"> <Setter Property="Opacity" TargetName="border" Value="0.56"/> </Trigger> <Trigger Property="IsMouseOver" Value="True"> <Setter Property="BorderBrush" TargetName="border" Value="#FF7EB4EA"/> </Trigger> <Trigger Property="IsKeyboardFocused" Value="True"> <Setter Property="BorderBrush" TargetName="border" Value="#FF569DE5"/> </Trigger> <MultiTrigger> <MultiTrigger.Conditions> <Condition Property="IsFocused" Value="False"/> </MultiTrigger.Conditions> <Setter Property="Visibility" TargetName="WARKTEXT" Value="Visible"/> </MultiTrigger> </ControlTemplate.Triggers> </ControlTemplate> </Setter.Value> </Setter> <Style.Triggers> <MultiTrigger> <MultiTrigger.Conditions> <Condition Property="IsInactiveSelectionHighlightEnabled" Value="True"/> <Condition Property="IsSelectionActive" Value="False"/> </MultiTrigger.Conditions> <Setter Property="SelectionBrush" Value="{DynamicResource {x:Static SystemColors.InactiveSelectionHighlightBrushKey}}"/> </MultiTrigger> </Style.Triggers> </Style> </ResourceDictionary> 这段代码可以工作,但有一个问题。它显示提示,将字符显示为密码字符,但问题是在字段中输入密码后,它会在密码字符上显示提示。 以下是一些截图: 问题是这样的: 我该如何解决这个问题?提前致谢。 :) 您可以尝试处理PasswordBox的PasswordChanged事件,并根据Password属性是否包含任何字符将其Tag属性设置为“True”或“False”,然后检查触发器中Tag属性的值 在 xaml 上: <Style x:Key="PasswordStyle" TargetType="{x:Type PasswordBox}"> <Setter Property="Tag" Value="False"/> <EventSetter Event="PasswordChanged" Handler="OnPasswordChanged"/> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type PasswordBox}"> <Border x:Name="border" CornerRadius="4" BorderBrush="LightGray" BorderThickness="4" Background="Transparent" SnapsToDevicePixels="True"> <Grid> <TextBlock x:Name="PassMessage" HorizontalAlignment="Left" VerticalAlignment="Center" Text=" Password..." FontSize="34" Margin="5,0,5,0" Foreground="LightGray" IsHitTestVisible="False" Visibility="Hidden"/> <ScrollViewer x:Name="PART_ContentHost" Focusable="False" HorizontalScrollBarVisibility="Hidden" BorderBrush="Transparent" VerticalScrollBarVisibility="Hidden"/> </Grid> </Border> <ControlTemplate.Triggers> <MultiTrigger> <MultiTrigger.Conditions> <Condition Property="Tag" Value="False"/> <Condition Property="IsKeyboardFocusWithin" Value="False"/> </MultiTrigger.Conditions> <Setter Property="Visibility" TargetName="PassMessage" Value="Visible"/> </MultiTrigger> </ControlTemplate.Triggers> </ControlTemplate> </Setter.Value> </Setter> </Style> <Grid> <PasswordBox x:Name="passwordBox" Style="{StaticResource PasswordStyle}" HorizontalAlignment="Left" Margin="217,256,0,0" VerticalAlignment="Top" Width="450"/> </Grid> 在 xaml.cs 上 private void OnPasswordChanged(object sender, RoutedEventArgs e) { passwordBox = sender as PasswordBox; passwordBox.Tag = (!string.IsNullOrEmpty(passwordBox.Password)).ToString(); } 希望这有帮助 你可以试试这个: <MultiTrigger> <MultiTrigger.Conditions> <Condition Property="IsFocused" Value="False"/> <Condition Property="Text" Value=""/> </MultiTrigger.Conditions> <Setter Property="Visibility" TargetName="WARKTEXT" Value="Visible"/> </MultiTrigger> <MultiTrigger> <MultiTrigger.Conditions> <Condition Property="IsFocused" Value="False"/> <Condition Property="Text" Value="{x:Null}"/> </MultiTrigger.Conditions> <Setter Property="Visibility" TargetName="WARKTEXT" Value="Visible"/> </MultiTrigger> 如果文本不为空或为空,则会显示提示,否则不显示。 希望对您有帮助。

回答 2 投票 0

有没有一种方法可以根据Excel的字符串排序逻辑升序对字符串进行排序,而无需编写自定义代码?

我有一个 Infragistics XamComboEditor,它需要根据 Excel 的升序排序逻辑对其值进行排序。它通过 绑定到 ObservableDictionary

回答 1 投票 0

InteractiveDataDisplay.WPF 制作动态图表作为值记录器外观

我使用 Microsoft InteractiveDataDisplay.WPF(以前的 DynamicDataDisplay)来可视化实时数据(大约 2-3 秒)。 这段代码xaml.cs: 公共部分类 MainWindow : 窗口 {

回答 3 投票 0

使用切换按钮处理弹出窗口

我在 Xaml 中有一个切换按钮和一个弹出窗口。弹出窗口的 IsOpen 绑定到切换按钮的 IsChecked,并且弹出窗口的 StaysOpen 设置为 false。因此,当选中切换按钮并且

回答 3 投票 0

Cognex In-Sight SDK - WPF 控件

我几乎没有尝试过将 Cognex In-Sight SDK 与 WPF 应用程序一起使用。 SDK 中有一些示例,但不幸的是仅适用于 WinForms。我想知道我可以为 WinForm 控件制作一个 Host...

回答 1 投票 0

创建一个仅响应字符按键和少数选定的编辑按键的 WPF 文本框

WPF 文本框响应相当多的编辑命令。我想消除绝大多数,并让它响应任何文本输入和一些编辑命令,如退格和删除。我...

回答 2 投票 0

WPF 鼠标光标附近闪烁弹出窗口

我尝试在 WPF 中的鼠标光标旁边显示一个弹出窗口。窗口位置将在鼠标移动事件期间更新。主窗口是这样的: 我尝试在 WPF 中的鼠标光标旁边显示一个弹出窗口。窗口位置将在鼠标移动事件期间更新。主窗口是这样的: <Grid x:Name="_layoutGrid" Background="Transparent"> <DockPanel Background="Green"/> <Popup Name="_cursorInfo" IsHitTestVisible="False" AllowsTransparency="True" Placement="Relative" PlacementTarget="{Binding ElementName=_layoutGrid}"> <Border CornerRadius="1" Padding="1" Background="Blue" Opacity="0.7" IsHitTestVisible="False"> <TextBlock Text="Here is a content" IsHitTestVisible="False" /> </Border> </Popup> </Grid> 鼠标移动的事件处理程序如下: public MainWindow() { InitializeComponent(); _layoutGrid.MouseMove += LayoutGrid_MouseMove; _layoutGrid.MouseLeave += LayoutGrid_MouseLeave; } private void LayoutGrid_MouseLeave(object sender, MouseEventArgs e) { _cursorInfo.IsOpen = false; } private void LayoutGrid_MouseMove(object sender, MouseEventArgs e) { var pos = e.GetPosition(_layoutGrid); if (!_cursorInfo.IsOpen) { _cursorInfo.IsOpen = true; } _cursorInfo.HorizontalOffset = pos.X; _cursorInfo.VerticalOffset = pos.Y; Debug.WriteLine($"Pos: {pos}"); } 弹出窗口出现,但有很多“闪烁”。似乎鼠标很快就被捕获在弹出窗口中,导致闪烁。我还认识到,当我删除所包含边框的背景时,闪烁就消失了。不过我想看到边框的彩色背景。我认为设置“IsHitTestVisible”就足够了,但看来我错了。知道如何避免闪烁吗? 在光标的X和Y位置添加一些额外的偏移量,似乎可以解决问题 _cursorInfo.HorizontalOffset = pos.X + 10; _cursorInfo.VerticalOffset = pos.Y + 10;

回答 1 投票 0

WPF 中 Android 风格切换按钮实现示例

<Setter Property="Height" Value="30" /> <Setter Property="Width&q...</desc> <question vote="0"> <pre><code>&lt;Style x:Key=&#34;AndroidToggleBtnStyle&#34; TargetType=&#34;ToggleButton&#34;&gt; &lt;Setter Property=&#34;Height&#34; Value=&#34;30&#34; /&gt; &lt;Setter Property=&#34;Width&#34; Value=&#34;120&#34; /&gt; &lt;Setter Property=&#34;Template&#34;&gt; &lt;Setter.Value&gt; &lt;ControlTemplate TargetType=&#34;ToggleButton&#34;&gt; &lt;Border x:Name=&#34;outborder&#34; Padding=&#34;0&#34; BorderBrush=&#34;{StaticResource BorderColorBrush}&#34; BorderThickness=&#34;2&#34; CornerRadius=&#34;10&#34;&gt; &lt;Border x:Name=&#34;backgrd&#34; Padding=&#34;0&#34; Background=&#34;Transparent&#34; CornerRadius=&#34;10&#34;&gt; &lt;Border x:Name=&#34;inercircle&#34; Width=&#34;20&#34; Height=&#34;20&#34; Margin=&#34;5,0,5,0&#34; HorizontalAlignment=&#34;Left&#34; Background=&#34;{StaticResource BorderColorBrush}&#34; CornerRadius=&#34;100&#34;&gt; &lt;ContentPresenter /&gt; &lt;/Border&gt; &lt;/Border&gt; &lt;/Border&gt; &lt;ControlTemplate.Triggers&gt; &lt;Trigger Property=&#34;IsChecked&#34; Value=&#34;True&#34;&gt; &lt;Setter TargetName=&#34;outborder&#34; Property=&#34;BorderBrush&#34; Value=&#34;{StaticResource BackColorBlueBrush}&#34; /&gt; &lt;Setter TargetName=&#34;backgrd&#34; Property=&#34;Background&#34; Value=&#34;{StaticResource BackColorBlueBrush}&#34; /&gt; &lt;Setter TargetName=&#34;inercircle&#34; Property=&#34;HorizontalAlignment&#34; Value=&#34;Right&#34; /&gt; &lt;Setter TargetName=&#34;inercircle&#34; Property=&#34;Background&#34; Value=&#34;{StaticResource BackColorWhiteBrush}&#34; /&gt; &lt;/Trigger&gt; &lt;/ControlTemplate.Triggers&gt; &lt;/ControlTemplate&gt; &lt;/Setter.Value&gt; &lt;/Setter&gt; &lt;/Style&gt; </code></pre> <p><a href="https://i.stack.imgur.com/qiH6v.png" target="_blank"><img src="https://cdn.txt58.com/i/AWkuc3RhY2suaW1ndXIuY29tL3FpSDZ2LnBuZw==" alt=""/></a></p> <p>它被定义并用作样式代码。 当选中时,背景颜色会发生变化。 不过outbound和backgrd还是有一点差距的。 我们如何填空?</p> </question> <answer tick="false" vote="0"> <p>这是一个愚蠢的问题。 我不应该将cornerradius 的值添加到backgrd 中。 删除声明的属性值后,运行正常。</p> </answer> </body></html>

回答 0 投票 0

WPF - WPFUI 库 - 图标不会在导航栏上呈现 C#

我正在使用 WPFUI 的演示模板来开发 WPF 应用程序,同时将新项目编辑到导航栏的列表中,直到您将鼠标悬停在导航栏列表中时,图标才会正确呈现,如

回答 1 投票 0

我怎样才能控制wrapanel,这样如果我删除了一个项目,顺序就不会改变

在列表视图中,我使用 Wrappanel 作为 ItemsPanelTemplate 在 listview 中,我使用 Wrappanel 作为 ItemsPanelTemplate <ListView ItemsSource="{Binding TodoItemViewModels}" ScrollViewer.VerticalScrollBarVisibility="Disabled" Drop="Card_Drop" AllowDrop="True" DragLeave="Card_DragLeave" IsEnabled="{Binding Disable, ElementName=root}" Background="Green"> <ListView.ItemsPanel> <ItemsPanelTemplate> <WrapPanel Margin="0" Orientation="Vertical" /> </ItemsPanelTemplate> </ListView.ItemsPanel> <!-- Displaying Cards in CardCollection View --> <ListView.ItemTemplate> <DataTemplate> <Border BorderThickness="2" BorderBrush="BlanchedAlmond" Opacity="1" Background="BlanchedAlmond" Width="25" Height="30" MouseMove="Card_MouseMove" CornerRadius="5" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"> <TextBlock Text="{Binding Cardstr}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Foreground="{Binding Cardclr}" Background="BlanchedAlmond" /> </Border> </DataTemplate> </ListView.ItemTemplate> </ListView> 我怎样才能修复Listview,所以如果我删除一个项目,它的位置将会有一个空槽,而不是像下面的图片那样重新排列列表: 我尝试了Wrapanel和Gridview都无法正常工作。 我不想在网格中逐个单元插入,因为这会使程序变得复杂 您不应移除卡,而应将其替换为代表空插槽的另一个对象。 例如,您可以向包含 IsEmpty 和 Cardstr 属性的类添加 Cardclr 属性,然后使用 DataTemplateSelector 基于此属性选择适当的模板: public class CustomTemplateSelector : DataTemplateSelector { public DataTemplate CardTemplate { get; set; } public DataTemplate EmptyTemplate { get; set; } public override DataTemplate SelectTemplate(object item, DependencyObject container) { var obj = item as YourClass; if (obj != null && obj.IsEmpty && EmptyTemplate != null) return EmptyTemplate; return CardTemplate; } } XAML:: <ListView ItemsSource="{Binding TodoItemViewModels}" ScrollViewer.VerticalScrollBarVisibility="Disabled" Drop="Card_Drop" AllowDrop="True" DragLeave="Card_DragLeave" IsEnabled="{Binding Disable, ElementName=root}" Background="Green"> <ListView.Resources> <DataTemplate x:Key="cardTemplate"> <Border BorderThickness="2" BorderBrush="BlanchedAlmond" Opacity="1" Background="BlanchedAlmond" Width="25" Height="30" MouseMove="Card_MouseMove" CornerRadius="5" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"> <TextBlock Text="{Binding Cardstr}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Foreground="{Binding Cardclr}" Background="BlanchedAlmond" /> </Border> </DataTemplate> <DataTemplate x:Key="emptyTemplate"> <Border> <TextBlock>empty...</TextBlock> </Border> </DataTemplate> </ListView.Resources> <ListView.ItemTemplateSelector> <local:CustomTemplateSelector CardTemplate="{StaticResource cardTemplate}" EmptyTemplate="{StaticResource emptyTemplate}"/> </ListView.ItemTemplateSelector> <ListView.ItemsPanel> <ItemsPanelTemplate> <WrapPanel Margin="0" Orientation="Vertical" /> </ItemsPanelTemplate> </ListView.ItemsPanel> </ListView>

回答 1 投票 0

在WPF中创建一个自定义ScrollViewer,它可以正常调整元素大小,并在子宽度小于其最小值时显示水平滚动条?

我正在开发一个 WPF 应用程序,我需要创建一个自定义 ScrollViewer,它可以根据可用宽度自动调整其子元素的大小。另外,当c的最小宽度...

回答 1 投票 0

如何将控件位置绑定到数据网格的滚动位置

我想通过在上面添加描述性标题(标签)来对 DataGrid 列进行分组: (前两列上方的“标题 1”) 调整列大小时,标签会按其应有的方式响应: (“他...

回答 1 投票 0

如何使 XAML DataGridColumns 填充整个 DataGrid?

我在 XAML(不是 Silverlight)中使用具有可调整大小的列的 DataGrid,如果用户调整屏幕大小,DataGrid 将展开。 目前如果所有 DataGrid 列的宽度都小于

回答 12 投票 0

如何以编程方式设置mediaElement源

我有一个 MediaElement 控件和几个视频,其构建操作设置为内容,并复制到设置为始终的输出目录。 如果我在 xaml 视图中显式设置源,如下所示: <

回答 1 投票 0

© www.soinside.com 2019 - 2024. All rights reserved.