Search Results

Search found 5961 results on 239 pages for 'wpf 4 5'.

Page 68/239 | < Previous Page | 64 65 66 67 68 69 70 71 72 73 74 75  | Next Page >

  • Trouble animating RadialGradientBrush in WPF

    - by emddudley
    I'm trying to animate a RadialGradientBrush in my application. I get the super helpful exception: Additional information: 'System.Windows.Style' value cannot be assigned to property 'Style' of object 'System.Windows.Controls.Border'. '[Unknown]' property does not point to a DependencyObject in path '(0).(1).[0].(2)'. Error at object 'System.Windows.Style' in markup file 'Eng.Modules.Core;component/system/grid/systemgridview.xaml' Line 252 Position 51. I know it's something wrong with the indirect property targeting or partial path qualification in my DoubleAnimation's Storyboard.TargetProperty attribute. Any ideas? <Border> <Border.Resources> <RadialGradientBrush x:Key="SomeBrush"> <RadialGradientBrush.GradientStops> <GradientStop Color="White" Offset="0" /> <GradientStop Color="Gold" Offset="1" /> </RadialGradientBrush.GradientStops> </RadialGradientBrush> </Border.Resources> <Border.Style> <Style TargetType="{x:Type Border}"> <Style.Triggers> <DataTrigger Binding="{Binding Path=IsEnabled, RelativeSource={RelativeSource Self}}" Value="True"> <Setter Property="Background" Value="{StaticResource SomeBrush}" /> <DataTrigger.EnterActions> <BeginStoryboard x:Name="SomeStoryBoard"> <Storyboard> <!-- RIGHT HERE --> <DoubleAnimation Storyboard.TargetProperty="(Border.Background).(GradientBrush.GradientStops)[0].(GradientStop.Offset)" From="0" To="1" Duration="0:0:1" RepeatBehavior="Forever" AutoReverse="True" /> </Storyboard> </BeginStoryboard> </DataTrigger.EnterActions> <DataTrigger.ExitActions> <RemoveStoryboard BeginStoryboardName="SomeStoryBoard" /> </DataTrigger.ExitActions> </DataTrigger> </Style.Triggers> </Style> </Border.Style> </Border>

    Read the article

  • Implementing custom CanExecuteChanged event with Commands in WPF

    - by ajtp
    Hi everybody, I try to do a custom CanExecuteChanged event for a command button. Inside CanExecuteChanged event I would like to do some stuff when canExecute value change but I don't want to do it by implementing a custom command button class (deriving from Button and Implementing ICommandSource). Also I don't want to do my stuff into CanExecute method. Any ideas? Thanks.

    Read the article

  • WPF Error when implementing Login.xaml

    - by LnDCobra
    I am getting the following exception: "Nullable object must have a value" Everything was working when I was using StartupURI="MainWindow.xaml" but I wanted to implement a login screen so I changed this to Startup="Application_Startup" and then created the following method in App.xaml.cs: private void Application_Startup(object sender, StartupEventArgs e) { UpdateAccounts(); bool result = true; ///* LoginWindow login = new LoginWindow(); result = login.ShowDialog().Value; /* */ if (!result) { return; } MainWindow window = new MainWindow(); bool main = window.ShowDialog().Value; } Does anyone have any idea what is going on? Or any suggestions on what is the best practice for implementing login interface.

    Read the article

  • WPF RibbonButton

    - by melculetz
    How can I programatically set the text on a RibbonButton? Right now I have the code below, but the button does not display 'Browse'. Any suggestions? RibbonButton btn = new RibbonButton(); btn.Name = "btnBrowse"; btn.Content = "Browse"; btn.HorizontalAlignment = System.Windows.HorizontalAlignment.Left; btn.Click += new RoutedEventHandler(btn_Click);

    Read the article

  • WPF Control Background under GridViewColumn

    - by sergo_lsn
    Hi, I'd like make background for colums like in this image http://www.freeimagehosting.net/image.php?e2435df982.png I have CheckBoxes on the left and TreeView on the right. In one column I have checkboxes in other I have treeview. In column with checkboxes I need set background. Background has to be permanent. .... </DataTemplate> </GridViewColumn.CellTemplate> </GridViewColumn> <GridViewColumn Width="25"> All column has to have background not only cell <GridViewColumn.CellTemplate> <DataTemplate> <CheckBox> <CheckBox.Resources> <ResourceDictionary> <ResourceDictionary.MergedDictionaries> .... </ResourceDictionary.MergedDictionaries> </ResourceDictionary> </CheckBox.Resources> </CheckBox> </DataTemplate> </GridViewColumn.CellTemplate> </GridViewColumn> </GridViewColumn> <GridViewColumn Width="300"/> </TreeListView.Columns> <TreeListView.Resources> <ResourceDictionary> <ResourceDictionary.MergedDictionaries> ... TreeView.xaml </ResourceDictionary.MergedDictionaries> </ResourceDictionary> </TreeListView.Resources> <TreeListView.ItemTemplate> <HierarchicalDataTemplate> <HierarchicalDataTemplate.ItemsSource> .... </HierarchicalDataTemplate.ItemsSource> </HierarchicalDataTemplate> </TreeListView.ItemTemplate> </TreeListView>

    Read the article

  • WPF and XPS: Empty Document Viewer

    - by xscape
    byte[] mediaBytes = Convert.FromBase64String("<<strings>>"); XpsDocument doc; ms = new MemoryStream(mediaBytes, 0, mediaBytes.Length); Uri DocumentUri = new Uri("pack://document.xps"); using (Package package = Package.Open(ms, FileMode.Create)) { PackageStore.AddPackage(DocumentUri, package); doc = new XpsDocument(package, CompressionOption.Maximum, DocumentUri.AbsoluteUri); FixedDocumentSequence fds = doc.GetFixedDocumentSequence(); documentViewer.Document = fds as IDocumentPaginatorSource; PackageStore.RemovePackage(DocumentUri); doc.Close(); } Can anyone please help me. Its result is an empty document. The mediaBytes is a PDF document.

    Read the article

  • WPF Global Resources in App.xaml

    - by Ryan
    I have created a custom Treeview control and am trying to access the HierarchicalDataTemplate resource of this control from another window in the same project. I have placed <ResourceDictionary Source="/Controls/TreeView/Themes/Generic.xaml"/> into my App.xaml file. Everytime I run, I get an error saying that it can not find the resource key "scene" - the name of the HierarchicalDataTemplate from my custom control. How can I access this template? Thanks

    Read the article

  • WPF - Byte Array to Hex View (similar to Notepad++ HEX-Editor plugin)

    - by tenfour
    I am using an ItemsControl to display a List<byte> in hex. The ItemsPanelTemplate is a UniformGrid with a fixed number of columns: <ItemsControl HorizontalAlignment="Left" VerticalAlignment="Top" ItemsSource="{Binding}"> <ItemsControl.ItemsPanel> <ItemsPanelTemplate> <UniformGrid Columns="16"/> </ItemsPanelTemplate> </ItemsControl.ItemsPanel> <ItemsControl.ItemTemplate> <DataTemplate> <TextBlock Text="{Binding StringFormat='\{0:X2\}'}" Margin="5,5,5,0"/> </DataTemplate> </ItemsControl.ItemTemplate> </ItemsControl> I'd like to prefix each row with an 'Address' column, just like you'd see with the Notepad++ 'HEX-Editor' plugin. That is, since I have 16 columns, each row should be prefixed something like this: 0000 [00 01 02 .... 0F] 0010 [10 11 12 .... 1F] 0020 [20 21 22 .... 2F] ... Any suggestions?

    Read the article

  • WPF with MVVM and Prismv2 - Event Bubbling?

    - by depictureboy
    What is the best way to get an event from a child or grandchild module up to the parent Shell? For instance, if I have a view in a module that is actually 2 levels away from the Shell, and I have a Window behavior. Is the eventaggregator really the best way to do this? it seems like overkill. I just want my MainShell to watch for a change in the IsDialogOpen Property on the ViewModels in all my child modules. I feel like I am missing the trees for the forest...

    Read the article

  • Edit dialog, with bindings and OK/Cancel in WPF

    - by Erik
    How can i have a dialog for editing the properties of a class with binding, and have OK-Cancel in the dialog? My first idea was this: public partial class EditServerDialog : Window { private NewsServer _newsServer; public EditServerDialog(NewsServer newsServer) { InitializeComponent(); this.DataContext = (_newsServer = newsServer).Clone(); } private void ButtonClick(object sender, RoutedEventArgs e) { switch (((Button)e.OriginalSource).Content.ToString()) { case "OK": _newsServer = (NewsServer)this.DataContext; this.Close(); break; case "Cancel": this.Close(); break; } } } When in the switch, case "OK", the DataContext contains the correct information, but the originally passed NewsServer instance does not change.

    Read the article

  • Multicolumn ListView in WPF - errors

    - by Will
    Hi, I am trying to define a multicolumn listview in xaml (visual studio 2008) and then add items to it in c#. I have seen many posts on this subject, and tried the various methods, but I am getting errors. my xaml code is below, VS does not flag any errors on it. <ListView Height="234.522" Name="chartListView" Width="266.337"> <ListView.View> <GridView> <GridViewColumn Header="Name" Width="70"/> <GridViewColumn Header="ID" /> </GridView> </ListView.View> </ListView> to try and add data to the columns, I created a button and put the code in the button click : private void button3_Click(object sender, RoutedEventArgs e) { chartListView.Items.Add("item1").SubItems.Add("item2"); } the error that is showing is on Subitems is: 'int' does not contain a definition for 'SubItems' and no extension method 'SubItems' accepting a first argument of type 'int' could be found (are you missing a using directive or an assembly reference?) D:\devel\VS\pchart\pchart\pchart\Window1.xaml.cs Also, I tried looking at some other posts on listview controls such as http://stackoverflow.com/questions/1260812/listview-inserting-items i tried the code there : ListViewItem item = new ListViewItem(); item.Text=anInspector.getInspectorName().ToString(); and got almost the same error on item.Text as i did with SubItems. is there something earlier in my code, or project definition that i am missing? Thanks for any help

    Read the article

  • Measuring WPF Rendering Performance

    - by Wonko the Sane
    Hi All, I am looking to get some better performance on an ItemsControl, and I believe that the biggest hang-up is the rendering. The ItemTemplate of the control consists of (basically) a Border around an ImageBrush. The ItemsSource is an ObservableCollection of a custom class (of which I have no real control). What I'd like to know are some techniques for measuring (rudimentary measurements are fine to start with) the performance. This is an XP machine using .NET 3.5 SP1. Thanks, wTs

    Read the article

  • WPF Storyboard issue

    - by Vinjamuri
    In the following template, the button is displayed with Normal image when the application is started, but when the mouse is over, the button doesn't get changed to mouse over image. Appreciate your help!!! I want some solution without major changes in the design. <Style TargetType="{x:Type local:ButtonControl}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type local:ButtonControl}"> <Grid> <VisualStateManager.VisualStateGroups> <VisualStateGroup x:Name="CommonStates"> <VisualState x:Name="Normal"> <Storyboard> <DoubleAnimation Duration="00:00:00.20" Storyboard.TargetName="imgNormal" Storyboard.TargetProperty="Opacity" To="1" /> </Storyboard> </VisualState> <VisualState x:Name="MouseOver"> <Storyboard> <DoubleAnimation Duration="00:00:00.20" Storyboard.TargetName="imgNormal" Storyboard.TargetProperty="Opacity" To="0" /> <DoubleAnimation Duration="00:00:00.20" Storyboard.TargetName="imgOver" Storyboard.TargetProperty="Opacity" To="1" /> </Storyboard> </VisualState> <VisualState x:Name="Disabled"> <Storyboard> <DoubleAnimation Duration="00:00:00.20" Storyboard.TargetName="imgDisable" Storyboard.TargetProperty="Opacity" To="1" /> </Storyboard> </VisualState> <VisualState x:Name="Pressed"> <Storyboard> <DoubleAnimation Duration="00:00:00.20" Storyboard.TargetName="imgPress" Storyboard.TargetProperty="Opacity" To="1" /> </Storyboard> </VisualState> </VisualStateGroup> </VisualStateManager.VisualStateGroups> <Grid> <Border x:Name="imgNormal"> <Image Source="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=NormalImage}" Opacity="1" Stretch="UniformToFill"/> </Border> </Grid> <Grid> <Border x:Name="imgOver"> <Image Source="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=MouseOverImage}" Opacity="0" Stretch="UniformToFill"/> </Border> </Grid> <Grid> <Border x:Name="imgDisable"> <Image Source="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=DisableImage}" Opacity="0" Stretch="UniformToFill"/> </Border> </Grid> <Grid> <Border x:Name="imgPress"> <Image Source="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=MousePressImage}" Opacity="0" Stretch="UniformToFill"/> </Border> </Grid> </Grid> </ControlTemplate> </Setter.Value> </Setter> </Style>

    Read the article

  • [WPF Datagrid] Binding to a List<>

    - by Tr?n Qu?c Bình
    I have a datagrid like this: <dg:DataGrid Name="dg" AutoGenerateColumns="False" CanUserDeleteRows="True"> <dg:DataGrid.Columns> <dg:DataGridTextColumn Header="Product Code" x:Name="columnProductCode" Binding="{Binding Path=Product.ProductCode}" IsReadOnly="True" ></dg:DataGridTextColumn> <dg:DataGridTextColumn Header="Product Name" x:Name="columnProductName" Binding="{Binding Path=Product.Name}" IsReadOnly="True" ></dg:DataGridTextColumn> <dg:DataGridTextColumn Header="ProductMeasure" x:Name="columnDonViTinh" Binding="{Binding Path=Product.Measure IsReadOnly="True"></dg:DataGridTextColumn> <dg:DataGridTextColumn Header="Quantity" x:Name="ColumnQuantity" Binding="{Binding Path=Quantity IsReadOnly="False"></dg:DataGridTextColumn> </dg:DataGrid.Columns> </dg:DataGrid> In the behind code, I have a struct like this: private struct ProductDetail { public TProduct Product { get; set ; } // TProduct is a class provied by a web service public int Quantity { get; set; } } and a List like this: private IList<ProductDetail> bs = new List<ProductDetail>(); I had tried to fill data to "bs". And binding like this: this.dg.ItemsSource = this.bs; Everything is ok. I can insert a new row, delete row, but when I try to modified the column Quantity then click on the header of the datagrid (to resort) -- the Quantity column change to it is before. How can I fix this problem. Thanks advanced.

    Read the article

  • WPF - Getting the value of one a DataGridCell from within DataTemplateSelector

    - by Andy T
    Hi, I'm using DataTemplateSelector with the WPFToolkit DataGrid. I want to select the editing template for one cell based on the value of another cell on the same row. The DataTemplateSelector's SelectTemplate method takes two arguments: one is the data item displayed by the grid row, the other is the grid cell. What I want to know is how to get the value of another cell from within the SelectTemplate method. However, I'm not sure of the correct way to get this information by accessing properties of the cell. public class RangeValuesEditTemplateSelector : DataTemplateSelector { public DataTemplate NumberTemplate{get; set;} public DataTemplate TextTemplate{get; set;} public override DataTemplate SelectTemplate(object item, DependencyObject container) { //TODO: need to find the correct way to populate the if condition below DataGridCell theCell = container as DataGridCell; if (theCell.something.somethingElse) { return NumberTemplate; }else{ return TextTemplate; } } } Can anyone help? Many thanks in advance. AT

    Read the article

  • WPF Animation / Processing priority

    - by Matt B
    Hi all, I have a button which has an animation (in xaml) on it's click event. Cool so far. Problem is that I also have processing occurring on the click event (so I can do stuff) - and this occurs first. How do I prioritise or re-order so that the animation takes place before any custom processing... Thanks.

    Read the article

  • WPF Separator position

    - by morsanu
    Hey, I'm using a Separator to draw a vertical line inside a Border. At first this was ok because the line needed to be centered, but now I need to position it at a custom x-position from the left border. Is there a way to do that? <Border x:Name="border" ClipToBounds="True" Background="White" BorderBrush="Black" BorderThickness="2"> <Separator BorderBrush="Black" BorderThickness="2"> <Separator.LayoutTransform> <RotateTransform Angle="90" /> </Separator.LayoutTransform> </Separator> </Border>

    Read the article

  • Animate UserControl in WPF?

    - by sanjeev40084
    I have two xaml file one is MainWindow.xaml and other is userControl EditTaskView.xaml. In MainWindow.xaml it consists of listbox and when double clicked any item of listbox, it displays other window (edit window) from EditView userControl. I am trying to animate this userControl everytime whenever any item from the listbox is double clicked. I added some animation in userControl however the animation only gets run once. How can i make my animation run everytime whenever any item from the listbox is clicked? <ListBox x:Name="lstBxTask" Style="{StaticResource ListBoxItems}" MouseDoubleClick="lstBxTask_MouseDoubleClick"> <ListBox.ItemTemplate> <DataTemplate> <StackPanel> <Rectangle Style="{StaticResource LineBetweenListBox}"/> <StackPanel Orientation="Horizontal"> <TextBlock Text="{Binding Taskname}" Style="{StaticResource TextInListBox}"/> <Button Name="btnDelete" Style="{StaticResource DeleteButton}" Click="btnDelete_Click"/> </StackPanel> </StackPanel> </DataTemplate> </ListBox.ItemTemplate> </ListBox> <ToDoTask:EditTaskView x:Name="EditTask" Grid.Row="1" Grid.RowSpan="2" Grid.ColumnSpan="2" Visibility="Collapsed"/> In the MainWindow code, there is mouse double click event, which changes the visibility of EditTaskView to Visible. Suggestions?

    Read the article

  • WPF - TextBlock - Cannot override OnRender

    - by Nitin Chaudhari
    Hi, I am creating a custom control by deriving TextBlock, my intention is to do some custom rendering based on some dependency properties. However the OnRender method is sealed on TextBlock. Although I can get my work done by overriding OnRenderSizeChanged, this is not correct. Any ideas on how can i do it the right way? Thanks in advance.

    Read the article

  • Dynamic Scoped Resources in WPF/XAML?

    - by firoso
    I have 2 Xaml files, one containing a DataTemplate which has a resource definition for an Image brush, and the other containing a content control which presents this DataTemplate. The data template is bound to a view model class. Everything seems to work EXCEPT the ImageBrush resource, which just shows up white... Any ideas? File 1: DataTemplate for ViewModel <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:vm="clr-namespace:SEL.MfgTestDev.ESS.ViewModel" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d"> <DataTemplate DataType="{x:Type vm:PresenterViewModel}"> <DataTemplate.Resources> <ImageBrush x:Key="PresenterTitleBarFillBrush" TileMode="Tile" Viewbox="{Binding Path=FillBrushDimensions, Mode=Default}" ViewboxUnits="Absolute" Viewport="{Binding Path=FillBrushPatternSize, Mode=Default}" ViewportUnits="Absolute" ImageSource="{Binding Path=FillImage, Mode=Default}"/> </DataTemplate.Resources> <Grid d:DesignWidth="1440" d:DesignHeight="900"> <Grid.ColumnDefinitions> <ColumnDefinition Width="*"/> <ColumnDefinition Width="192"/> </Grid.ColumnDefinitions> <Grid.RowDefinitions> <RowDefinition Height="120"/> <RowDefinition Height="*"/> </Grid.RowDefinitions> <DockPanel HorizontalAlignment="Stretch" Width="Auto" LastChildFill="True" Background="{x:Null}" Grid.ColumnSpan="2"> <Image Source="{Binding Path=ImageSource, Mode=Default}"/> <Rectangle Fill="{DynamicResource PresenterTitleBarFillBrush}"/> </DockPanel> </Grid> </DataTemplate> </ResourceDictionary> File 2: Main Window Class which instanciates the DataTemplate Via it's view model. <Window x:Class="SEL.MfgTestDev.ESS.ESSMainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:vm="clr-namespace:SEL.MfgTestDev.ESS.ViewModel" Title="ESS Control Window" Height="900" Width="1440" WindowState="Maximized" WindowStyle="None" ResizeMode="NoResize" DataContext="{Binding}"> <Window.Resources> <ResourceDictionary Source="PresenterViewModel.xaml" /> </Window.Resources> <ContentControl> <ContentControl.Content> <vm:PresenterViewModel ImageSource="XAMLResources\SEL25YearsTitleBar.bmp" FillImage="XAMLResources\SEL25YearsFillPattern.bmp" FillBrushDimensions="0,0,5,110" FillBrushPatternSize="0,0,5,120"/> </ContentControl.Content> </ContentControl> </Window> And for the sake of completeness! The CodeBehind for the View Model using System; using System.Collections.Generic; using System.Text; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Shapes; namespace SEL.MfgTestDev.ESS.ViewModel { public class PresenterViewModel : ViewModelBase { public PresenterViewModel() { } //DataBindings private ImageSource _imageSource; public ImageSource ImageSource { get { return _imageSource; } set { if (_imageSource != value) { _imageSource = value; OnPropertyChanged("ImageSource"); } } } private Rect _fillBrushPatternSize; public Rect FillBrushPatternSize { get { return _fillBrushPatternSize; } set { if (_fillBrushPatternSize != value) { _fillBrushPatternSize = value; OnPropertyChanged("FillBrushPatternSize"); } } } private Rect _fillBrushDimensions; public Rect FillBrushDimensions { get { return _fillBrushDimensions; } set { if (_fillBrushDimensions != value) { _fillBrushDimensions = value; OnPropertyChanged("FillBrushDimensions"); } } } private ImageSource _fillImage; public ImageSource FillImage { get { return _fillImage; } set { if (_fillImage != value) { _fillImage = value; OnPropertyChanged("FillImage"); } } } } }

    Read the article

  • [WPF C#]Get UserControl or VisualTree in DataValidation of TextBlock

    - by dalind
    Hy, I have a validator set on the text property of a textblock. For a correct validation I would need the parent usercontrol of the textblock, but the only things I have in the validator are the value object (a string) and the culture (doesn't help either). Does anyone know a way to get certain usercontrols in a class/a method where I have no access to any kind of visual or control of my application. The problem could be solve if I could give the validator the usercontrol or the textblock as parameters, but I didn't find a way to do so.. Thank you very much for your answers. Greets

    Read the article

  • wpf combobox padding

    - by Jose
    This is a simple question How do you remove the space between the content of a combobox and the border of it. E.g. If the selection of a combobox is "Selection 1" then the "S" is drawn at the very top left of the ComboBox control with no whitespace spacing between it and top left portion of the control. I did this <ComboBox Padding="0"/> Even this: <ComboBox.ItemContainerStyle> <Style TargetType="ComboBoxItem"> <Setter Property="Padding" Value="0"/> </Style> </ComboBox.ItemContainerStyle> The specified ComboBox above is within a ListView GridViewColumn. Maybe that's messing with something. This doesn't remove the padding. Any ideas?

    Read the article

< Previous Page | 64 65 66 67 68 69 70 71 72 73 74 75  | Next Page >