xaml

Wpf: Storyboard.TargetName works, but Setter TargetName doesn't

落爺英雄遲暮 提交于 2020-06-22 12:09:08
问题 Let's say we have a XAML code like this: <Style TargetType="{x:Type ListBoxItem}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type ListBoxItem}"> <Border HorizontalAlignment="Center" VerticalAlignment="Center"> <Border.LayoutTransform> <!--We are rotating randomly each image. Selected one will be rotated to 45°.--> <RotateTransform Angle="{Binding RandomAngle}" x:Name="globalRotation"/> </Border.LayoutTransform> <Grid> <Image Source="{Binding ImageLocation}"

Wpf: Storyboard.TargetName works, but Setter TargetName doesn't

好久不见. 提交于 2020-06-22 12:08:10
问题 Let's say we have a XAML code like this: <Style TargetType="{x:Type ListBoxItem}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type ListBoxItem}"> <Border HorizontalAlignment="Center" VerticalAlignment="Center"> <Border.LayoutTransform> <!--We are rotating randomly each image. Selected one will be rotated to 45°.--> <RotateTransform Angle="{Binding RandomAngle}" x:Name="globalRotation"/> </Border.LayoutTransform> <Grid> <Image Source="{Binding ImageLocation}"

Reference nested enum type from XAML

左心房为你撑大大i 提交于 2020-06-22 09:55:07
问题 I can't seem to reference a public nested enum type from XAML. I have a class namespace MyNamespace { public class MyClass { public enum MyEnum { A, B, } } } And I try to reference MyEnum in Xaml like this: xmlns:MyNamespace="clr-namespace:MyNamespace;assembly=MyApp" .... {x:Type MyNamespace:MyClass:MyEnum} // DOESN'T WORK but VS complains it can't find public type MyEnum . I also tried using the + syntax based on one of the answers to this post... {x:Type MyNamespace:MyClass+MyEnum} // DOESN

WPF WindowChrome: Edges of maximized Window are out of the screen

…衆ロ難τιáo~ 提交于 2020-06-22 08:34:25
问题 I use WindowChrome to customize a Window. When I maximize the Window, then the edges are out of the screen. I use the following code to fix this: <Window x:Class="WpfApplication1.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> <WindowChrome.WindowChrome> <WindowChrome CaptionHeight="50" CornerRadius="0" GlassFrameThickness="0" NonClientFrameEdges="None" ResizeBorderThickness="5" UseAeroCaptionButtons="False"

Multiple ItemsControl on single collection applies filter to all views at once

为君一笑 提交于 2020-06-22 03:36:50
问题 Prerequisites: .NET 4.5.1 I have three TreeView controls that display three filtered variants of single collection instance. When I try to apply a filter on Items collection of one of controls this filter propagates to other controls automatically which prevents me to use different filters on different controls. Is there any way to achieve the same result without having to maintain three instances of collections at once? An example that shows the problem follows below. First two ListViews are

Multiple ItemsControl on single collection applies filter to all views at once

我的梦境 提交于 2020-06-22 03:35:31
问题 Prerequisites: .NET 4.5.1 I have three TreeView controls that display three filtered variants of single collection instance. When I try to apply a filter on Items collection of one of controls this filter propagates to other controls automatically which prevents me to use different filters on different controls. Is there any way to achieve the same result without having to maintain three instances of collections at once? An example that shows the problem follows below. First two ListViews are

How to bind Multiple Buttons in Combobox

蓝咒 提交于 2020-06-17 12:58:51
问题 I want to bind a list of buttons in combo boxes. Each Combobox will contains buttons of one category and so on. As referred in attached image. Below is my code: <ItemsControl x:Name="iNumbersList"> <ItemsControl.ItemsPanel> <ItemsPanelTemplate> <WrapPanel HorizontalAlignment="Center" VerticalAlignment="Center" Orientation="Horizontal" MaxWidth="930"/> </ItemsPanelTemplate> </ItemsControl.ItemsPanel> <ItemsControl.ItemTemplate> <DataTemplate> <Button Click="ItemButtonClick" Tag="{Binding

how to add self-closing tag to an element in xml?

倾然丶 夕夏残阳落幕 提交于 2020-06-17 04:12:22
问题 There are plenty of information for how to avoid self-closing tag for an XElement in C# on the web, but I want to do is the reverse one. I give a value to an XElement, and also want to see a self-closing tag in the output xml. This is my code: XElement myElement = new XElement("MyItem", new Attribute("value1", "test1), new Attribute("value2", "test2), new Attribute("value3", "test3) ); This is what I got now in the output xml file: <MyItem value1="test1" value2="test2" value3="test3"> <

WPF Label Style Trigger based on a char at unknown index in Contents of the Label, is it possible?

非 Y 不嫁゛ 提交于 2020-06-17 03:23:18
问题 Rather than programatically set the the style when the requirement of a field on a form changes is it possible to use a trigger that checks the last char in a Label.Contents is a '*' and if so set a property on the Label? Something like this but how to check on the last char of the Content property? <Style x:Key="LabelStandard" TargetType="Label"> <Setter Property="HorizontalAlignment" Value="Left"/> <Setter Property="VerticalAlignment" Value="Top"/> <Style.Triggers> <Trigger Property=

Is there a way to disable Auto Capitalisation on Xamarin Forms 'Entry' XAML

本秂侑毒 提交于 2020-06-13 19:30:10
问题 I have just started working in Xamarin and am writing an App targeting iOS and Android. I'm trying to keep pretty much all of my UI design in the common library between them and am starting to find the lines a bit blurred. My current requirement is to disable the auto-capitalisation on the 'Entry' tag object in XAML. Is this something that can be done by markup? I cannot find any property that would support this behaviour. If not, what should I do instead? 回答1: If you plan to use this