标签: wpftoolkit

重置数据时如何重置 WPF Toolkit 图表调色板

我在 WPF 用户控件上有一个饼图,其数据定期更改,但是我不是每次都实例化一个新的图表控件,只是清除 ItemsSource 中的数据,然后插入新值。

每次刷新值时,色觉都会继续滚动其颜色选择。

图表颜色选择总是以相同的颜色选择开始(首先是红色,然后是蓝色等),我希望能够在每次重置数据源时告诉图表从头开始重新启动它的颜色选择,而不是获取每次清除和重置数据项时都会有不同的颜色。

我每次都尝试创建 ObservableCollection 的新实例,但这没有任何区别。

wpf wpftoolkit

3
推荐指数
1
解决办法
4397
查看次数

带有 ItemsControl 的网格中的 Gridsplitter

我正在尝试制作 PropertyGrid 自定义控件。PropertyGrid 与 Visual Studio 中使用的 PropertyGrid 非常相似。我尝试使用扩展 WPF 工具包的 PropertyGrid,但您必须使用属性指定属性的类别,并且我们需要在运行时更改类别。据我所知,这对于属性来说是不可能的。

所以我自己制作PropertyGrid。到目前为止,这是我的代码:

Generic.xaml:

<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:local="clr-namespace:HomeMadePropertyGrid"
                    xmlns:System="clr-namespace:System;assembly=mscorlib">

    <BooleanToVisibilityConverter x:Key="BoolToVisConverter"></BooleanToVisibilityConverter>
    <SolidColorBrush x:Key="GlyphBrush" Color="#444" />
    <ControlTemplate x:Key="toggleButtonTemplate" TargetType="ToggleButton">
        <Grid Width="15" Height="13" Background="Transparent">
            <Path x:Name="ExpandPath" Fill="{StaticResource GlyphBrush}" Data="M 4 0 L 8 4 L 4 8 Z" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="1,1,1,1" />
        </Grid>
        <ControlTemplate.Triggers>
            <Trigger Property="IsChecked" Value="True">
                <Setter Property="Data" TargetName="ExpandPath" Value="M 0 4 L 8 4 L 4 8 Z"/>
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>
    <Style x:Key="toggleButtonStyle" TargetType="ToggleButton">
        <Setter Property="Template" Value="{StaticResource toggleButtonTemplate}" />
    </Style> …
Run Code Online (Sandbox Code Playgroud)

c# wpf custom-controls itemscontrol wpftoolkit

3
推荐指数
1
解决办法
1996
查看次数

如何将WPF Toolkit Datagrid与XamlPad(最新版本)一起使用?

我想在XamlPad中使用DataGrid.我如何引用WPFtoolkit DLL?

我已经尝试添加一个xml命名空间引用(下面),但没有运气.

的xmlns:工具箱= "CLR-名称空间:Microsoft.Windows.Controls;装配= WPFToolkit"

任何想法或帮助将不胜感激 - 谢谢!

wpf datagrid wpftoolkit xamlpad

2
推荐指数
1
解决办法
448
查看次数

Caliburn绑定异常

让我解释一下我的问题.请原谅我这个长期的问题.在这里.

我有一个View(BusyProviderView)

<Grid>
    <xctk:BusyIndicator x:Name="aaa" IsBusy="{Binding IsRunning}" >
        <xctk:BusyIndicator.BusyContentTemplate>
            <DataTemplate>
                <Grid cal:Bind.Model="{Binding}">
                    <TextBlock Name="Message"/>
                </Grid>
            </DataTemplate>
        </xctk:BusyIndicator.BusyContentTemplate>
    </xctk:BusyIndicator>
</Grid>
Run Code Online (Sandbox Code Playgroud)

哪个有View型号:

    public class BusyProviderViewModel : PropertyChangedBase, IBusyProvider
{
//two properties with INPC, Message and IsRunning
}
Run Code Online (Sandbox Code Playgroud)

我再次有一个Shell视图

<Window x:Class="MvvmTest.ShellView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="ShellView" Height="300" Width="300">
<Grid>
    <Button Height="25" x:Name="Run">Run</Button>
    <ContentControl x:Name="BusyProvider"/>
</Grid>
Run Code Online (Sandbox Code Playgroud)

其中有一个视图模型

public class ShellViewModel : PropertyChangedBase, IShellViewModel
{
    private IBusyProvider busyProvider;

    public ShellViewModel(IBusyProvider busy)
    {
        this.BusyProvider = busy;
    }

    public IEnumerable<IResult> Run()
    {
        yield return …
Run Code Online (Sandbox Code Playgroud)

c# wpftoolkit caliburn.micro simple-injector

2
推荐指数
1
解决办法
674
查看次数

如何在mvvm中将自动完成框与模型绑定?

我公开了一个集合,并将其绑定到autocompletebox的itemsource,但是在自动完成框中选择或更改文本不会像文本框或标签一样更新模型!

视图模型:

public ObservableCollection<String> SymptomsDb { get; private set; }

private String symptom;

public String Symptom
{
    get { return symptom; }
    set
    {
        symptom = value;
        RaisePropertyChanged(() => this.Symptom);
    }
}

public AnalysisViewModel()
{
    List<String> s = new List<String>();
    s.Add("test");
    SymptomsDb = new ObservableCollection<String>(s);
}
Run Code Online (Sandbox Code Playgroud)

视图:

<controls:AutoCompleteBox 
    ItemsSource="{Binding SymptomsDb}" 
    SelectedItem="{Binding Symptom}" 
    Text="{Binding Symptom}" 
    IsTextCompletionEnabled="True" 
    FilterMode="Contains"/>
Run Code Online (Sandbox Code Playgroud)

mvvm wpftoolkit

2
推荐指数
1
解决办法
3550
查看次数

如何在wpf工具包中动态地将更多行系列添加到折线图中?

我正在尝试使用wpf工具包图表行,我需要在图表中有多行,但我不知道如何做到这一点我试图在这里和谷歌但我总是找到一个XAML代码,我需要在c#中动态执行.在程序中,我不知道我需要多少图表以及每个图表中有多少行,这是我在XAML中无法做到的...

for (int j = 0; j < 4; j++) //its just so i cant check it
{
    ColumnDefinition cd = new ColumnDefinition();
    myGrid.ColumnDefinitions.Add(cd);

    Chart chart1 = new Chart();
    LineSeries lineChart = new LineSeries();
    chart1.Height = 200;
    chart1.Width = 300;
    chart1.Title = (j);

    //((LineSeries)chart1.Series[0]).ItemsSource = valueList;

    lineChart.DependentValuePath = "Value";
    lineChart.IndependentValuePath = "Key";
    lineChart.ItemsSource = valueList;
    lineChart.IsSelectionEnabled = true;
    chart1.Series.Add(lineChart);
   lineChart.ItemsSource = valueList1;
    chart1.Series.Add(lineChart); <---

    myGrid.Children.Add(chart1);
    Grid.SetColumn(chart1, (j));  
    Grid.SetRow(chart1, 0);

}
Run Code Online (Sandbox Code Playgroud)

我试过这个,但它不起作用......

请帮忙!:(

wpf charts linechart wpftoolkit lineseries

2
推荐指数
1
解决办法
8922
查看次数

如何在WPF饼图中为饼图切片设置默认颜色

我正在使用带有标签的WPF饼图,使用Zag studio中的文章 .此图表每1分钟刷新一次新值.它工作正常,但为什么每次刷新时饼图的颜色都会改变?是否有任何可能的方法来设置默认颜色.我显示的饼图只有两个切片.

我试过的,

 <customControls:LabeledPieChart>
  <customControls:LabeledPieChart.Palette>
   <dv:ResourceDictionaryCollection>
   <ResourceDictionary>                                               
     <Style TargetType="dvc:PieDataPoint">
     <Setter Property="Background" Value="Green"/>
     </Style>
    <Style TargetType="dvc:PieDataPoint">
   <Setter Property="Background" Value="Purple"/>
    </Style>
  </ResourceDictionary>
  </dv:ResourceDictionaryCollection>
 </customControls:LabeledPieChart.Palette>
 </customControls:LabeledPieChart> 
Run Code Online (Sandbox Code Playgroud)

上面的代码片段返回异常

'set property'System.Windows.ResourceDictionary.DeferrableContent'引发了异常.

任何身体可以帮忙?谢谢.

c# wpf xaml wpftoolkit wpf-controls

2
推荐指数
1
解决办法
4269
查看次数

SelectedColor绑定不会从ColorPicker更新为Model

我有一个WPF应用程序,我需要允许更改外观(主要是背景和前景).所以我将它们绑定到在应用程序范围内定义的动态资源App.resources.

我还决定在我的设置窗口中使用ColorPickerfrom wpftoolkit(v2.5.0)

使用colorPicker设置窗口

简化的例子

App.xaml中

<Application x:Class="WpfColors.App"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             StartupUri="MainWindow.xaml">
    <Application.Resources>
        <SolidColorBrush x:Key="BgBrush" Color="Gray"/>
    </Application.Resources>
</Application>
Run Code Online (Sandbox Code Playgroud)

带有颜色选择器的MainWindow.xaml

<Window x:Class="WpfColors.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
        Title="MainWindow" Height="350" Width="525">
    <Grid>
        <DataGrid Name="grdBrushes" 
                  Background="{DynamicResource ResourceKey=BgBrush}" 
                  AutoGenerateColumns="False">
            <DataGrid.Columns>
                <DataGridTextColumn Width="*" Header="Element" Binding="{Binding Path=Name}"/>

                <DataGridTemplateColumn Width="*" Header="Color">
                    <DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <xctk:ColorPicker SelectedColor="{Binding Path=BrushColor, Mode=TwoWay}"
                                              AvailableColorsHeader="Available" />
                        </DataTemplate>
                    </DataGridTemplateColumn.CellTemplate>
                </DataGridTemplateColumn>
            </DataGrid.Columns>
        </DataGrid>        
    </Grid>
</Window>
Run Code Online (Sandbox Code Playgroud)

MainWindow.cs

using System.Linq;
using System.Windows;
using System.Windows.Media;

namespace WpfColors
{
    public partial class MainWindow : Window
    {
        public MainWindow() …
Run Code Online (Sandbox Code Playgroud)

wpf binding color-picker wpftoolkit dynamicresource

2
推荐指数
1
解决办法
2988
查看次数

WPF工具包:CheckComboBox和[Flags]枚举

我正在使用Xceed Extended WPF Toolkit来显示带有[Flags]属性的枚举PropertyGrid.

[Flags]             
public enum TestEnum
{
    Test1 = 1,
    Test2 = 2,
    Test3 = 4,
    Test4 = 8,
    Test5 = 16,
    Test6 = 32,
    Test7 = 64,
}
Run Code Online (Sandbox Code Playgroud)

因为我无法在编译时知道枚举定义,所以我将使用EnumBuilder动态创建枚举.

我创建了一个编辑器来显示枚举CheckComboBox:

public class CheckComboBoxEditor : TypeEditor<CheckComboBox>, ITypeEditor
{
    protected override void SetValueDependencyProperty()
    {
        ValueProperty = CheckComboBox.SelectedValueProperty;
    }

    protected override CheckComboBox CreateEditor()
    {
        return new CheckComboBox();
    }

    protected override void ResolveValueBinding(PropertyItem propertyItem)
    {
        var _binding = new Binding("Value");
        _binding.Source = propertyItem; …
Run Code Online (Sandbox Code Playgroud)

c# wpf enums wpftoolkit xceed

2
推荐指数
1
解决办法
992
查看次数

'IndependentValue'成员无效,因为在chartinToolkit wpf中没有合格的类型名称

我正在尝试查看图表中的Ace值,但出现以下错误“'IndependentValue'成员无效,因为它在chartinToolkit wpf中没有限定类型名称”

这是我的代码

    <Window x:Class="WpfToolkitChart.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="MainWindow" Height="1031" Width="855" xmlns:chartingToolkit="clr-namespace:System.Windows.Controls.DataVisualization.Charting;assembly=System.Windows.Controls.DataVisualization.Toolkit"  FlowDirection="RightToLeft">

<ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" Margin="0,-28,0,28">
    <Grid Height="500">

        <chartingToolkit:Chart  Name="lineChart" Title="Line Series Demo" VerticalAlignment="Top" Margin="33,6,6,0" Height="440" Foreground="DarkRed" FlowDirection="LeftToRight" FontFamily="CPalatineLinoType">
            <chartingToolkit:LineSeries  DependentValuePath="Value" IndependentValuePath="Key" ItemsSource="{Binding}" IsSelectionEnabled="True"/>

            <ToolTipService.ToolTip>
                <StackPanel Margin="2,2,2,2">
                    <ContentControl Content="{TemplateBinding IndependentValue}" FontSize="12"/>
                    <ContentControl Content="{TemplateBinding DependentValue}"   FontSize="12"/>
                </StackPanel>
            </ToolTipService.ToolTip>
        </chartingToolkit:Chart>
    </Grid>
</ScrollViewer>
Run Code Online (Sandbox Code Playgroud)

请在此感谢任何人帮助我:)

wpf charts xaml tooltip wpftoolkit

2
推荐指数
2
解决办法
4285
查看次数