xaml

Space in StringFormat

拥有回忆 提交于 2020-02-02 03:02:07
问题 I'm looking to add a comma and one 'space' after a binding. I have the comma after the binding but I cannot work out at all how to do a 'space'. This is what I have; <TextBlock Text="{Binding Name, StringFormat={}{0:\,}\,}" /> Could someone please inform me on how to add a 'space' after the comma? I have tried literally adding a space in the XAML but this does not work. 回答1: XAML trims the string of whitespace unless you tell it where the string ends. Surround your string with single quotes.

How to close Tab with a close button in WPF?

喜夏-厌秋 提交于 2020-02-02 02:21:52
问题 I am working on a WPF app where it creates new tab upon clicking a button. That is working fine. I am having hard time in figuring out how to have a close button, like a X next to the Tab header and close the selected tab? MainWindow.xaml <Grid> <StackPanel Name="listConnections" Grid.Column="0" Background="#4682b4" Margin="0,0,0,-0.2" > </StackPanel> <TabControl Name="tabConnections" Grid.Column="1" TabStripPlacement="Top" Margin="0,0,0.4,-0.2"> </TabControl> </Grid> </Window> add Tab method

Nested WPF DataGrids

安稳与你 提交于 2020-02-02 01:51:21
问题 I have a DataGrid (from the toolkit) and I want to nest another DataGrid in the DataGrid.RowDetailsTemplate. The trick is I want to bring back the data from one table in the main grid and then based on row selection go and get additonal detail from a different table and show it in the DataGrid in the detail template. This is easy enough to do in 2 seperate DataGrids but I am having trouble getting it to work with the nested version. Is this even possible? If so, could someone point me in the

Animate color property with different brushes

前提是你 提交于 2020-02-01 06:43:49
问题 I have the following in a ControlTemplate.Resources : <ColorAnimation Storyboard.TargetName="border" Storyboard.TargetProperty="Background.(SolidColorBrush.Color)" To="Orange" Duration="0:0:0.2" /> It works all right if the original background that I wanted to change to orange was a solid color. But I'd also want to have this work when the original background is a LinearGradientBrush . In this second case, the animation tries to change the property in vain, nothing happens. How can I specify

Animate color property with different brushes

别说谁变了你拦得住时间么 提交于 2020-02-01 06:42:05
问题 I have the following in a ControlTemplate.Resources : <ColorAnimation Storyboard.TargetName="border" Storyboard.TargetProperty="Background.(SolidColorBrush.Color)" To="Orange" Duration="0:0:0.2" /> It works all right if the original background that I wanted to change to orange was a solid color. But I'd also want to have this work when the original background is a LinearGradientBrush . In this second case, the animation tries to change the property in vain, nothing happens. How can I specify

Styling WPF OxyPlot PlotViews in XAML

与世无争的帅哥 提交于 2020-02-01 03:55:10
问题 When setting up an OxyPlot plot view, you can either define the plot explicitly through various controls, or set it up through a binding to a PlotModel . As such, in the first case, the XAML for a plot of two LineSeries objects could look something like <oxy:Plot Title="Some plot"> <oxy:Plot.Axes> <oxy:LinearAxis Position="Left" /> <oxy:LinearAxis Position="Bottom" /> </oxy:Plot.Axes> <oxy:Plot.Series> <oxy:LineSeries ItemsSource="{Binding ActualSeriesData1}" DataFieldX="X" DataFieldY="Y"/>

Binding SelectedItems in ListView to a ViewModel in Windows Phone 8.1

可紊 提交于 2020-01-31 17:58:24
问题 I have the following code: <ListView SelectionMode="Multiple" ItemsSource="{Binding MyList}" ItemTemplate="{StaticResource MyListTemplate}"> <ListView.ItemContainerStyle> <Style TargetType="ListViewItem"> <Setter Property="IsSelected" Value="{Binding Mode=TwoWay, Path=IsSelected}"/> </Style> </ListView.ItemContainerStyle> </ListView> With the following DataTemplate: <Page.Resources> <!-- Data Template for the ListView --> <DataTemplate x:Key="MyListTemplate"> <Grid> <Grid.ColumnDefinitions>

XAML MSBuild task XamlMarkupCompilePass1 fails in parallel MSBuild and throws error Access denied

被刻印的时光 ゝ 提交于 2020-01-31 12:09:57
问题 We have several projects containing XAML UI and XAML workflow files. Since we enabled execution of MSBuild in parallel, with the flag /m the builds, from time to time we get an exception in the MSBuild task XamlMarkupCompilePass1 ##[error]C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Xaml.targets(193,5): Error XC1000: XC1020: Build error occurred in the XAML MSBuild task: 'Could not load file or assembly 'file:///C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\

Convert an image to XAML?

帅比萌擦擦* 提交于 2020-01-31 05:00:30
问题 Does anyone know of any way to convert a simple gif to xaml? E.G. A tool that would look at an image and create elipses, rectangles and paths based upon a gif / jpg / bitmap? 回答1: Illustrator has a trace tool which will do this a cheaper option might be http://vectormagic.com it will export a svg that you should be able to convert to xaml 回答2: Inkscape can trace bitmaps, and can save directly to XAML. And, it happens to be free. I've used it to trace a lot of bitmaps and it's worked really

WPF XAML

元气小坏坏 提交于 2020-01-31 04:49:45
xmlns 在xml中专门用于声明名字控件, xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 是WPF的核心名字空间,它包含所有WPF类,包括用于构建用户界面的控件 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 是XAML名字空间,包含各种XAML实用特性,之后会有x:Class ,x:Name等 ,x就表示这个命名空 XAML名字空间中的Class 告诉XAML编译器生成一个新Applicaion类(Partial类)用于事件处理,我们可以提供Class的Partial类的其他实现, x名字空间的主要内容如下: attribute类: x:Class:告诉窗口编译成类,如上 x:ClassModifier:编译成的类的访问权限,public,internal,private等 x:Name:编译成类的属性 x:FieldModifier:修饰属性的访问权限 x:key:用于检索资源的key x:Shared:声明资源是否共享,与x:key配合使用 标记扩展类: x:Array :数组标签类型 x:Static:表示静态成员 x:Type:表示类型 x:nul: WPF Xaml的标记扩展常用的包括:StaticResource