可扩展应用程序标记语言(XAML)是一种基于XML的声明式语言,用于在各种框架中初始化结构化值和对象。当问题是关于具有特定框架的XAML的使用时,还应该提供框架的标签,例如, [wpf](Windows Presentation Foundation),[silverlight],[windows-phone],[windows-store-apps](Windows 8商店应用),[win-universal-app],[xamarin.forms]或[工作流程 - 基础]
如何更改所选视图指示器(蓝线)的外观(例如高度、宽度、颜色、位置等)? 文本框示例: 组合框示例: 编辑1: 这是我唯一发现的东西......
最终目标 剪辑一个心形的图像。 试图 我已将此源的 svg 路径数据转换为其等效的几何图形。除了我必须旋转最终的几何对象,除非......
如何让屏幕阅读器以类似于读取 Win32 MessageBox 的方式读取我的 WPF 消息?
我们有一个 WPF 桌面应用程序,需要显示一些自定义消息窗口。我无法让屏幕阅读器(例如 Freedom Scientific 的 JAWS)正确朗读它们......
[QueryProperty("文件名", "文件名_")] 公共部分类DetailsViewModel:ObservableObject { [可观察属性] 字符串文件名; 部分无效
Xamarin 表单:如何在滚动时使视频居中(如 tiktok)
我正在研究xamarin表单。我正在显示我的 carrouselView 上有负载的视频。我想在向上或向下滚动时将项目居中,以便用户不必滚动多次来居中
在我的 XAML 文件中,内容页面标签如下所示: 在我的 XAML 文件中,内容页面标签如下所示: <ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui" xmlns:toolkit="http://schemas.microsoft.com/dotnet/2022/maui/toolkit" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:viewmodel="clr-namespace:Tester.ViewModel" x:DataType="viewmodel:Viewmodel" x:Class="Tester.View.NewDb" BackgroundColor="DarkGreen"> <ContentPage.Resources> <toolkit:InvertedBoolConverter x:Key="InvertedBoolConverter" /> </ContentPage.Resources> 所以我有一个名为 Viewmodel 的类,用于数据绑定。 我正在尝试将输入控件绑定到复选框控件,如下所示: <Entry Placeholder="Enter Database Password" Grid.Row="2" Margin="20,0,20,0" TextColor="White" x:Name="dbPasswd" BindingContext="{x:Reference chkShowPasswd}" IsPassword="{Binding IsChecked, Converter={StaticResource InvertedBoolConverter}}"/> <HorizontalStackLayout Grid.Row="2" Grid.Column="1" HorizontalOptions="Center"> <CheckBox x:Name="chkShowPasswd" VerticalOptions="Center"/> <Label Text="Show Password" TextColor="White" FontSize="Micro" VerticalOptions="Center"/> </HorizontalStackLayout> 当我运行该程序时,我收到一条错误消息: 绑定:在 Tester.ViewModel.Viewmodel.cs 上找不到属性“IsChecked” 现在我在这里有更多的入口控件,我希望将它们绑定到 Viewmodel 代码隐藏中的 ObservableObjects 以及其他任务和方法。 所以我的问题是,如何绑定我在视图模型中显示的两个控件? 在绑定源中指定对复选框的引用: <Entry x:Name="dbPasswd" Grid.Row="2" Margin="20,0,20,0" IsPassword="{Binding IsChecked, Source={x:Reference chkShowPasswd}, Converter={StaticResource InvertedBoolConverter}}" Placeholder="Enter Database Password" TextColor="White" />
我有一个 .svg 格式的图像,我正在将其转换为 .xaml 格式,并且我想将其用作图像源,据我所知这是可能的。但我的应用程序中还有另一个问题,即近 10 个用户为它们着色......
为什么我的 Liveshare 合作伙伴看不到 Visual Studio 2022 上的 XAML 设计器?
如果我们尝试编写 WPF 应用程序并邀请我的朋友参加 LiveShare 会话,他只能看到 XAML 代码,而看不到设计器。其他一切都很好。 LiveShare 的其他一切都是...
为什么我的 Liveshare 合作伙伴看不到 Visual Studio 2022 上的 XAML 设计器?
如果我们尝试编写 WPF 应用程序并邀请我的朋友参加 LiveShare 会话,他只能看到 XAML 代码,而看不到设计器。其他一切都很好。 LiveShare 的其他一切都是...
我有一个非常简单的继承UiButton,具有一些自定义样式: 内部类 UiButton :System.Windows.Controls.Button { 公共 UiButton() { 背景=新的SolidColorBrush(Co...
我目前在 WPF 中的页面导航方面遇到问题,我目前有一个带有侧边栏的主窗口,以及窗口中间的一个框架来显示新页面。侧边栏导航似乎...
将新项目添加到网格后,它会转到与最后一个项目相同的方块。当我多次单击按钮而不是创建新行时,它会在最后一行的基础上进行另一个练习 他们是
XamlC 错误 XFC0000:无法解析我的 xct:popup xaml 文件中的类型“Popup”
如何解决输出窗口中出现以下错误: XamlC 错误 XFC0000:无法解析类型“Popup”。 我的代码: 如何解决输出窗口中出现的以下错误: XamlC 错误 XFC0000:无法解析类型“Popup”。 我的代码: <xct:Popup xmlns:xct="http://xamarin.com/schemas/2020/toolkit" xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="SWD_Trening.NewEvent" IsLightDismissEnabled="False" Size="1000,600"/> <StackLayout> </StackLayout> </xct:Popup> 您必须包含定义弹出窗口的名称空间: Xamarin 表单 xmlns:xct="clr-namespace:Xamarin.CommunityToolkit.UI.Views;assembly=Xamarin.CommunityToolkit" 请查看官方文档:Xamarin Forms 社区工具包弹出窗口 毛伊岛 xmlns:xct="http://schemas.microsoft.com/dotnet/2022/maui/toolkit" 请查看官方文档:MAUI 社区工具包弹出窗口
我正在为 WinUI 应用程序开发文档查看器。 一般来说,它是有效的,只是滚动查看器高度不会改变。 所以当放大图像时,滚动查看器不会改变......
如果无法通过样式设置子控件属性,如何通过 XAML 设置子控件属性
我想在用户控件中设置子控件的属性。 我想在用户控件中设置子控件的属性。 <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="auto"/> <ColumnDefinition Width="*"/> <ColumnDefinition Width="auto"/> </Grid.ColumnDefinitions> <Label Grid.Column="0" x:Name="cLabel" Content="{Binding Caption}" /> <TextBox Grid.Column="1" x:Name="cTextBox" Text="{Binding Text}"/> <Label Grid.Column="2" x:Name="cUnit" Content="{Binding Unit}"/> </Grid> <!-- how to set only cLabel Width? something like: --> <local:LabeledTextbox cLabel.Width=100> 我想它不可能通过样式,因为样式也会设置cUnit。对吗? 我尝试了样式,但它设置了所有子项。 您可以使用该元素的资源来设置这些属性。 <local:LabeledTextbox> <local:LabeledTextbox.Resources> <Style TargetType="Label"> <Setter Property="Width" Value="100" /> <Setter Property="BorderBrush" Value="Gray" /> <Setter Property="BorderThickness" Value="1" /> <Setter Property="Margin" Value="4" /> <Setter Property="Foreground" Value="Purple" /> <Setter Property="FontStyle" Value="Italic" /> </Style> </local:LabeledTextbox.Resources> </local:LabeledTextbox> 或者,如果您想为多个控件设置该值,您可以将要隔离的内容块包装在某种容器控件中,并为包含元素设置资源,如下所示: <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="auto" /> <ColumnDefinition Width="*" /> <ColumnDefinition Width="auto" /> </Grid.ColumnDefinitions> <Label Grid.Column="0" x:Name="cLabel" Content="Caption" /> <TextBox Grid.Column="1" x:Name="cTextBox" Text="Text" /> <Label Grid.Column="2" x:Name="cUnit" Content="Unit" /> </Grid> <StackPanel> <StackPanel.Resources> <Style TargetType="Label"> <Setter Property="Width" Value="100" /> <Setter Property="BorderBrush" Value="Gray" /> <Setter Property="BorderThickness" Value="1" /> <Setter Property="Margin" Value="4" /> <Setter Property="Foreground" Value="Purple" /> <Setter Property="FontStyle" Value="Italic" /> </Style> </StackPanel.Resources> <local:LabeledTextbox /> <local:LabeledTextbox /> <local:LabeledTextbox /> </StackPanel>
为什么 WPF ProgressBar PART_Indicator 添加不透明度?
我正在尝试为 WPF 中的 ProgressBar 控件制作自定义样式。但 PART_Indicator 正在降低栏右侧的不透明度。 (查看 25%、50%、75% 的示例) 当酒吧达到 100% 时...
错误 XFC0045 - 如何将 CarouselView 绑定到毛伊岛的 ObservableCollection?
我正在尝试将 ObservableCollection 绑定到 。在 CarouselView 中,我有一个 ,我试图将其绑定到 ObservableCollection 中的公共属性。嗬...
描述错误 当 TValue 是类对象时,ComboBox 的 ItemsSource 与 Dictionary 绑定会引发错误。 我在我的项目中使用 WinUI 3 和 C#。 我看了很多其他的...
我想在点击某个超链接时添加一个导航到另一个页面的过程。 我想在点击某个超链接时添加到另一个页面的导航过程。 <DataGridHyperlinkColumn x:Name="Hyperlink" Header="Hyperlink" ContentBinding="{Binding Name}" DataGridHyperLinkColumn 没有点击功能。那么如何实现“点击功能”呢? 预先感谢 在您的代码隐藏中,您可以尝试订阅超链接的 RequestNavigate 事件。 // In constructor or after component initialization. Hyperlink.RequestNavigate += Hyperlink_RequestNavigate; 在 Hyperlink_RequestNavigate 方法中,您可以处理导航逻辑。 private void Hyperlink_RequestNavigate(object sender, RequestNavigateEventArgs e) { // Navigate to the URL specified in the hyperlink Process.Start(new ProcessStartInfo(e.Uri.AbsoluteUri)); e.Handled = true; }
我正在尝试添加不同的行为和转换器。但无论我在做什么,光标都会回到开头。 例如,我正在尝试使用行为来阻止超过 1 个白人......