xaml

The ScrollViewer does not scroll

牧云@^-^@ 提交于 2020-02-13 16:14:45
问题 I would like to have an interface with 3 components one next to the other. The first would be a ListView and the two others being Grids. Since the components will overflow on the right, I want to put them in a ScrollViewer. I did not succeed. I tried to do a really simple example to try, but even the example fails. <ScrollViewer Grid.Column="1" Grid.Row="2" HorizontalAlignment="Left" VerticalAlignment="Top" Width="600" Height="400"> <StackPanel Width="1200" Height="400" Orientation=

WPF ListboxItem and ContextMenu

牧云@^-^@ 提交于 2020-02-13 05:17:34
问题 I have code like this: <ListBox.ItemTemplate> <DataTemplate> <StackPanel Orientation="Vertical" ContextMenuService.ShowOnDisabled="True"> <StackPanel.ContextMenu> <ContextMenu> <MenuItem Command="Delete" Click="DeleteEvent"> </MenuItem> </ContextMenu> </StackPanel.ContextMenu> <TextBlock Text="{Binding EventName}"> </TextBlock> </StackPanel> </DataTemplate> </ListBox.ItemTemplate> Unfortunately It doesn't work. My context menu is disabled (it is displaying but I cannot click it because it's

WPF ListboxItem and ContextMenu

为君一笑 提交于 2020-02-13 05:17:23
问题 I have code like this: <ListBox.ItemTemplate> <DataTemplate> <StackPanel Orientation="Vertical" ContextMenuService.ShowOnDisabled="True"> <StackPanel.ContextMenu> <ContextMenu> <MenuItem Command="Delete" Click="DeleteEvent"> </MenuItem> </ContextMenu> </StackPanel.ContextMenu> <TextBlock Text="{Binding EventName}"> </TextBlock> </StackPanel> </DataTemplate> </ListBox.ItemTemplate> Unfortunately It doesn't work. My context menu is disabled (it is displaying but I cannot click it because it's

XAML 字符转义

廉价感情. 提交于 2020-02-12 18:26:40
在 写xaml的使用遇到了一些特殊字符,这里记录一下特殊字符转义。 这些特殊字符遵循用于编码的万维网联合会(W3C) XML 标准。 下表显示这组特殊字符的编码语法: 字符 语法 描述 < &lt; 小于符号。 > &gt; 大于符号。 & &amp; & 符号。 " &quot; 双引号。 参见: https://docs.microsoft.com/zh-cn/dotnet/framework/wpf/advanced/how-to-use-special-characters-in-xaml 来源: https://www.cnblogs.com/azsunqi/archive/2020/02/12/12299888.html

【WPF学习】第二十六章 Application类——应用程序的生命周期

折月煮酒 提交于 2020-02-09 01:09:03
原文: 【WPF学习】第二十六章 Application类——应用程序的生命周期   在WPF中,应用程序会经历简单的生命周期。在应用程序启动后,将立即创建应用程序对象,在应用程序运行时触发各种应用程序事件,你可以选择监视其中的某些事件。最后,当释放应用程序对象时,应用程序将结束。 一、创建Application对象   使用Application类的最简单方式是手动创建它。下面的示例演示了最小的程序:在应用程序入口(Main()方法)处创建名为MainWindow的窗口,并启动一个新的应用程序:   在本质上,Visual Studio为Application类使用的模型与用于窗口的模型相同。起点是XAML模板,默认情况下该模板被命名为App.xaml,它看起来如下所示: <Application x:Class="TestApplication.App" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" StartupUri="MainWindow.xaml"> </Application>   在“ 【WPF学习】第四章 加载和编译XAML ”介绍过

Using WebView to display local page html in my crossplatform xamarin app

为君一笑 提交于 2020-02-08 10:08:52
问题 i'm new in developing app with xamarin. I'm developing my first crossplatform app using xamarin forms. If you can give me the simpliest solution for my problem with examples. i have a MainPage.xaml with some stacklayout. in one of this stacklayout i want to display a local page.html using a Webview (i think). thanks you my page xaml is this <ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:d="http://xamarin.com/schemas/2014

windows 8 update to windows 8.1

岁酱吖の 提交于 2020-02-07 23:41:10
可以参考以下几个链接: http://blogs.windows.com/windows/b/appbuilder/archive/2013/07/24/windows-8-to-windows-8-1-preview-starting-with-the-xaml-templates.aspx http://msdn.microsoft.com/en-us/library/windows/apps/dn263114.aspx 另外, windows8.1 虽然优化了资源的使用和加载,但是还是支持 ResourceDictionary 这种方式,具体请参考: http://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.xaml.resourcedictionary.aspx Windows 8.1 已经不存在 Snap 、 Fill 、 FullScreen 这几种状态,以下链接的 Updates to the ApplicationView class 里面有详细的说明,您可以参考一下: http://msdn.microsoft.com/en-us/library/windows/apps/bg182890.aspx#one 这里有具体的实现: Handling VisualState in Windows 8

How control re-position depends on other control visibility in same panel

痞子三分冷 提交于 2020-02-07 07:53:26
问题 I have two buttons inside a stack panel. Initially B1 button is on top, then B2. I will change button visibility dynamically from code so that, when I change B1 visibility hidden, then B2 will come on top. How can I achieve this functionality. <Grid> <StackPanel > <Button Content="B1" Height="20" Width="100" Visibility="Visible"/> <Button Content="B2" Height="20" Width="100" Visibility="Visible"/> </StackPanel> </Grid> 回答1: First you remove the Statckpanel and put then in a Grid and you can

Selecting an Item or column in a Repeater and changing the Data

血红的双手。 提交于 2020-02-07 06:44:05
问题 I am trying to change the data in my repeater so far I am cycling through each row by Item and AlternatingItem but I want change the values in the last column so that the value is to two decimal places. I have a basic Connection to a stored procedure which populates the repeater code below: connection to the stored procedure: SqlDataAdapter da = new SqlDataAdapter("Stored Procedure", conn); da.SelectCommand.CommandType = CommandType.StoredProcedure; da.SelectCommand.Parameters.Add(new

Change selection color of ListBox Item

放肆的年华 提交于 2020-02-07 05:40:05
问题 I have a normal ListBox and I want to change the selection color to Red. Here's what I've got so far. <Style x:Key="myLBStyle" TargetType="{x:Type ListBoxItem}"> <Style.Resources> <SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="red" /> <SolidColorBrush x:Key="{x:Static SystemColors.InactiveSelectionHighlightBrushKey}" Color="red" /> </Style.Resources> </Style> It's working. The SelectedItem is Red and stay Red even if it's out of focus. Here's my real problem: In my