Search Results

Search found 2571 results on 103 pages for 'winrt xaml'.

Page 7/103 | < Previous Page | 3 4 5 6 7 8 9 10 11 12 13 14  | Next Page >

  • XAML trigger as StaticResource

    - by adrianm
    Why can't I create a trigger and use it as a static resource in XAML? <Window.Resources> <Trigger x:Key="ValidationTrigger" x:Shared="False" Property="Validation.HasError" Value="true"> <Setter Property="FrameworkElement.ToolTip" Value="{Binding RelativeSource={x:Static RelativeSource.Self}, Path=(Validation.Errors)/ErrorContent}"/> </Trigger> <Style TargetType="{x:Type TextBox}" BasedOn="{StaticResource {x:Type TextBox}}"> <Style.Triggers> <StaticResource ResourceKey="ValidationTrigger"/> </Style.Triggers> </Style> </Window.Resources> I get an errormessage at runtime "Value cannot be null. Parameter name: triggerBase Error at object 'System.Windows.Markup.StaticResourceHolder' in markup file"

    Read the article

  • Visual Studio Performance when editing XAML/Silverlight files

    - by driAn
    When I work on Silverlight projects within Visual Studio 2008, I regularly notice that the XAML editor hangs for up to 10 seconds. This because Visual Studio consumes 100% CPU during that timeframe. Any ideas how I could fix that? I assume this is some kind of background compiling for itellisense or something similiar. It happens during editing, multiple times an hour, without me doing any special actions. System: Server 2008 Std Visual Studio 2008 SP1 latest updates... I wonder if anyone else experienced this issue. Any help would be appreciated.

    Read the article

  • [XAML] datatrigger

    - by Bert
    Hi, I have a UserControl in XAML with a couple of buttons.... When the "VideoEnable" property in my C# code change to true i want to change the color of a button. The following code compiles but crashes and I cant find a right solution <UserControl.Triggers> <DataTrigger Binding="{Binding VideoEnable}" Value="true"> <Setter Property="Button.Background" Value="Green" TargetName="VideoButton" /> <Setter Property="Grid.Background" Value="Blue" TargetName="videoGrid" /> </DataTrigger> </UserControl.Triggers>

    Read the article

  • Translate ImageButton from C# to XAML

    - by Bill
    I worked out the C# code to create an ImageButton (below) that has three images (one base-image and two overlays) and three text boxes as the face of the button. I am inheriting from the Button class, which unfortunately includes several components that I didn't realize would surface until after coding and need to remove, namely the bright-blue surrounding border on IsMouseOver, and any visible borders between the buttons, as the buttons will end up in a wrapPanel and the borders need to be seamless. Now that the format has been worked out in C#, I expect that I need to translate to XAML so that I can create a ControlTemplate to get the functionality necessary, however I am not certain as to the process of translating from C# to XAML. Can anyone steer me in the right direction? public class ACover : Button { Image cAImage = null; Image jCImage = null; Image jCImageOverlay = null; TextBlock ATextBlock = null; TextBlock AbTextBlock = null; TextBlock ReleaseDateTextBlock = null; private string _TracksXML = ""; public ACover() { Grid cArtGrid = new Grid(); cArtGrid.Background = new SolidColorBrush(Color.FromRgb(38, 44, 64)); cArtGrid.Margin = new System.Windows.Thickness(5, 10, 5, 10); RowDefinition row1 = new RowDefinition(); row1.Height = new GridLength(225); RowDefinition row2 = new RowDefinition(); row2.Height = new GridLength(0, GridUnitType.Auto); RowDefinition row3 = new RowDefinition(); row3.Height = new GridLength(0, GridUnitType.Auto); RowDefinition row4 = new RowDefinition(); row4.Height = new GridLength(0, GridUnitType.Auto); cArtGrid.RowDefinitions.Add(row1); cArtGrid.RowDefinitions.Add(row2); cArtGrid.RowDefinitions.Add(row3); cArtGrid.RowDefinitions.Add(row4); ColumnDefinition col1 = new ColumnDefinition(); col1.Width = new GridLength(0, GridUnitType.Auto); cArtGrid.ColumnDefinitions.Add(col1); jCImage = new Image(); jCImage.Height = 240; jCImage.Width = 260; jCImage.VerticalAlignment = VerticalAlignment.Top; jCImage.Source = new BitmapImage(new Uri(Properties.Settings.Default.pathToGridImages + "jc.png", UriKind.Absolute)); cArtGrid.Children.Add(jCImage); cArtImage = new Image(); cArtImage.Height = 192; cArtImage.Width = 192; cArtImage.Margin = new System.Windows.Thickness(3, 7, 0, 0); cArtImage.VerticalAlignment = VerticalAlignment.Top; cArtGrid.Children.Add(cArtImage); jCImageOverlay = new Image(); jCImageOverlay.Height = 192; jCImageOverlay.Width = 192; jCImageOverlay.Margin = new System.Windows.Thickness(3, 7, 0, 0); jCImageOverlay.VerticalAlignment = VerticalAlignment.Top; jCImageOverlay.Source = new BitmapImage(new Uri( Properties.Settings.Default.pathToGridImages + "jc-overlay.png", UriKind.Absolute)); coverArtGrid.Children.Add(jCImageOverlay); ATextBlock = new TextBlock(); ATextBlock.Foreground = new SolidColorBrush(Color.FromRgb(173, 176, 198)); ATextBlock.Margin = new Thickness(10, -10, 0, 0); cArtGrid.Children.Add(ATextBlock); AlTextBlock = new TextBlock(); AlTextBlock.Margin = new Thickness(10, 0, 0, 0); AlTextBlock.Foreground = new SolidColorBrush(Color.FromRgb(173, 176, 198)); cArtGrid.Children.Add(AlTextBlock); RDTextBlock = new TextBlock(); RDTextBlock.Margin = new Thickness(10, 0, 0, 0); RDTextBlock.Foreground = new SolidColorBrush(Color.FromRgb(173, 176, 198)); cArtGrid.Children.Add(RDTextBlock); Grid.SetColumn(jCImage, 0); Grid.SetRow(jCImage, 0); Grid.SetColumn(jCImageOverlay, 0); Grid.SetRow(jCImageOverlay, 0); Grid.SetColumn(cArtImage, 0); Grid.SetRow(cArtImage, 0); Grid.SetColumn(ATextBlock, 0); Grid.SetRow(ATextBlock, 1); Grid.SetColumn(AlTextBlock, 0); Grid.SetRow(AlTextBlock, 2); Grid.SetColumn(RDTextBlock, 0); Grid.SetRow(RDTextBlock, 3); this.Content = cArtGrid; } public string A { get { if (ATextBlock != null) return ATextBlock.Text; else return String.Empty; } set { if (ATextBlock != null) ATextBlock.Text = value; } } public string Al { get { if (AlTextBlock != null) return AlTextBlock.Text; else return String.Empty; } set { if (AlTextBlock != null) AlTextBlock.Text = value; } } public string RD { get { if (RDTextBlock != null) return RDTextBlock.Text; else return String.Empty; } set { if (RDTextBlock != null) RDTextBlock.Text = value; } } public ImageSource Image { get { if (cArtImage != null) return cArtImage.Source; else return null; } set { if (cArtImage != null) cArtImage.Source = value; } } public string TracksXML { get { return _TracksXML; } set { _TracksXML = value; } } public double ImageWidth { get { if (cArtImage != null) return cArtImage.Width; else return double.NaN; } set { if (cArtImage != null) cArtImage.Width = value; } } public double ImageHeight { get { if (cArtImage != null) return cArtImage.Height; else return double.NaN; } set { if (cArtImage != null) cArtImage.Height = value; } } }

    Read the article

  • Conditional XAML

    - by Nicholas
    For easy of development I'm using a ViewBox to wrap all content inside a Window. This is because my development machine has a smaller screen than the deployment machine so using a ViewBox allows for better realisation of proportion. Obviously there is no reason for it to be there on Release versions of the code. Is there an easy method to conditionally include/exclude that 'wrapping' ViewBox in XAML? E.g. <Window> <Viewbox> <UserControl /*Content*/> </Viewbox> </Window>

    Read the article

  • User defined top level control in XAML

    - by luke
    A normal UserControl looks like this in XAML: <UserControl x:Class="mynamespace.foo" ...namespaces...> <!-- content --> </UserControl> I'd like to be able to define my own top level object, along the lines of: <MyControl x:Class="mynamespace.mycontrol" ...namespaces...> <!-- content --> </UserControl> Where MyControl derives from a UserControl itself. Of course the compiler complains about "MyControl" not being found. Is there a way around this?

    Read the article

  • "Genie" animation effect in XAML

    - by ScottCate
    What would the XAML look like to create a Genie animation effect? Take an object of any size/shape, and "Genie" it to another Minimized location. Kind of like the OSX window minimize. Maybe even a little fancier through a smoke-like effect where the path is more switch back, instead of a simple funnel (if that makes any sense). I'm guessing that there is some sort of Path that could be drawn, and the shape could move and transform along that path. Just a wild guess. Thanks for your ideas.

    Read the article

  • Using image resource in XAML markup?

    - by Jeff Dahmer
    I'm trying to add little icons to my tabs in WPF but having trouble with how to set up the binding. <TabItem.Header> <StackPanel Orientation="Horizontal"> <Image Source="{Binding Source=prop:Resources.eye}" /> <Label VerticalAlignment="Center">Header</Label> </StackPanel> </TabItem.Header> The xmlns:prop is set up for the local project's Properties, I am pulling other values from it elsewhere so I know that the namespace works. The markup above compiles fine BUT I don't see the eye image in the tab. Also, is there any way to set this up into a template? I'm fairly new to XAML/WPF and each tab will have its own image...

    Read the article

  • ScrollViewer GridView XAML

    - by Michel Bakker
    I am currently building a Windows 8 XAML C# application. In a page I have a scrollviewer for horizontal swiping and scrolling. I have several controls in it which work really well with the scorllviewer. But when you scroll and your cursor is on top of the ListView / GridView, then that control will handle scrollnig instead of the scrollviewer. With swiping this doesn't happen, but with the mouse scrollwheel it stops the scrollvieweing scroll. Does anybody know how to disable this behavior or have a workaround?

    Read the article

  • Set Validation Tooltip in CodeBehind instead of XAML

    - by KrisTrip
    I would like to know how to translate the following code to codebehind instead of XAML: <Style.Triggers> <Trigger Property="Validation.HasError" Value="true"> <Setter Property="ToolTip" Value="{Binding RelativeSource={RelativeSource Self}, Path=(Validation.Errors)[0].ErrorContent}"/> </Trigger> </Style.Triggers> The part I can't figure out is the Path portion. I have the following but it doesn't work: new Trigger { Property = Validation.HasErrorProperty, Value = true, Setters = { new Setter { Property = Control.ToolTipProperty, // This part doesn't seem to work Value = new Binding("(Validation.Errors)[0].ErrorContent"){RelativeSource = RelativeSource.Self} } } } Help?

    Read the article

  • Xaml TabControl in the top of window

    - by Rodionov Stepan
    http://dl.dropbox.com/u/59774606/so_question_pic.png Hi All! I have a trouble with xaml-markup design that is shown on a picture. How to place window buttons in one line with tab item headers TAB1,TAB2,TAB3? I use custom control for window buttons like <Border> <StackPanel Orientation="Horizontal"> ... buttons ... </StackPanel> </Border> Does anyone have ideas how I can implement this?

    Read the article

  • How to format TimeSpan in xaml

    - by biju
    I am trying to format a textblock which is bound to a TimeSpan property.It works if the property is of type DateTime but it fails if it is a TimeSpan .I can get it done using a converter.But i am trying to find out if there is any alternatives. Sample Code public TimeSpan MyTime { get; set; } public Window2() { InitializeComponent(); MyTime = DateTime.Now.TimeOfDay; DataContext = this; } Xaml <TextBlock Text="{Binding MyTime,StringFormat=HH:mm}"/> I am expecting the textblock to show only hours and mintes.But it is showing like 19:10:46.8048860

    Read the article

  • WPF: capturing XAML into subclassed control

    - by Sonic Soul
    hello, i narrowed down what i want my wpf button to look like using XAML. now i would like to create a sub classed button control that i can just re-use w/out having to write all that markup <Button Click="TestGridColumnButton_Click" Background="Transparent" Width="16" Height="16" Margin="0,0,0,0" Padding="0,0,0,0" BorderBrush="{x:Null}"> <Button.Template> <ControlTemplate> <Image HorizontalAlignment="Center" VerticalAlignment="Center" Style="{StaticResource SourceStyle}" /> </ControlTemplate> </Button.Template> </Button> how can i set all these properties using C# ?

    Read the article

  • Wait for animation, render to complete - XAML and C#

    - by Adam S
    Hi all. I have a situation where I am animating part of my XAML application, and I need to wait for the animation AND rendering to complete before I can move on in my code. So far the tail end of my function looks like: ProcExpandCollapse.Begin(); while (ProcExpandCollapse.GetCurrentState() != ClockState.Stopped) { } } Which, in theory, will wait until the animation is finished. But it will not wait until the rendering is finished - the thread drawing the application might still not have re-drawn the animation. The animation is expanding a UIElement, and then the next part of my code uses it's rendered size to do some things. My question then is, how do I wait until my UI Element is re-rendered before moving on?

    Read the article

  • C# WPF XAML DataTable binding to relation

    - by LnDCobra
    I have 2 tables: COmpany {CompanyID, CompanyName} Deal {CompanyID, Value} And I have a listbox: <ListBox Name="Deals" Height="100" Width="420" Margin="0,20,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" Visibility="Visible" IsSynchronizedWithCurrentItem="True" ItemsSource="{Binding}" SelectionChanged="Deals_SelectionChanged"> <ListBox.ItemTemplate> <DataTemplate> <StackPanel Orientation="Horizontal"> <TextBlock Text="{Binding companyRowByBuyFromCompanyFK.CompanyName}" FontWeight="Bold" /> <TextBlock Text=" -> TGS -> " /> <TextBlock Text="{Binding BuyFrom}" FontWeight="Bold" /> </StackPanel> </DataTemplate> </ListBox.ItemTemplate> </ListBox> As you can see, I want to display the CompanyName rather then the ID which is a foreign Key. The relation "companyRowByBuyFromCompanyFK" exists, as in Deals_SelectionChanged I can access companyRowByBuyFromCompanyFK property of the Deals row, and I also can access the CompanyName propert of that row. Is the reason why this is not working because XAML binding uses the [] indexer? Rather than properties on the CompanyRows in my DataTable? At the moment im getting values such as - TGS - 3 - TGS - 4 Any ideas? Edit: I still can't get this to work, What would be the best way to accomplish this? Make a converter to convert foreign keys using Table being referenced as custom parameter. Create Table View for each table? This would be long winded as I have quite a large number of tables that have foreign keys.

    Read the article

  • C# WPF XAML DataTable binding to relationship

    - by LnDCobra
    I have the following tables: Company {CompanyID, CompanyName} Deal {CompanyID, Value} And I have a listbox: <ListBox Name="Deals" Height="100" Width="420" Margin="0,20,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" Visibility="Visible" IsSynchronizedWithCurrentItem="True" ItemsSource="{Binding}" SelectionChanged="Deals_SelectionChanged"> <ListBox.ItemTemplate> <DataTemplate> <StackPanel Orientation="Horizontal"> <TextBlock Text="{Binding companyRowByBuyFromCompanyFK.CompanyName}" FontWeight="Bold" /> <TextBlock Text=" -> TGS -> " /> <TextBlock Text="{Binding BuyFrom}" FontWeight="Bold" /> </StackPanel> </DataTemplate> </ListBox.ItemTemplate> </ListBox> As you can see, I want to display the CompanyName rather then the ID which is a foreign Key. The relation "companyRowByBuyFromCompanyFK" exists, as in Deals_SelectionChanged I can access companyRowByBuyFromCompanyFK property of the Deals row, and I also can access the CompanyName propert of that row. Is the reason why this is not working because XAML binding uses the [] indexer? Rather than properties on the CompanyRows in my DataTable? At the moment im getting values such as - TGS - 3 - TGS - 4 What would be the best way to accomplish this? Make a converter to convert foreign keys using Table being referenced as custom parameter. Create Table View for each table? This would be long winded as I have quite a large number of tables that have foreign keys.

    Read the article

  • Binding a TreeView with ContextMenu in Xaml

    - by Michael Stoll
    I'm pretty new to Xaml and need some advise. A TreeView should be bound to a hierarchical object structure. The TreeView should have a context menu, which is specific for each object type. I've tried the following: <TreeView> <TreeView.Resources> <DataTemplate x:Key="RoomTemplate"> <TreeViewItem Header="{Binding Name}"> <TreeViewItem.ContextMenu> <ContextMenu> <MenuItem Header="Open" /> <MenuItem Header="Remove" /> </ContextMenu> </TreeViewItem.ContextMenu> </TreeViewItem> </DataTemplate> </TreeView.Resources> <TreeViewItem Header="{Binding Name}" Name="tviRoot" IsExpanded="True" > <TreeViewItem Header="Rooms" ItemsSource="{Binding Rooms}" ItemTemplate="{StaticResource RoomTemplate}"> <TreeViewItem.ContextMenu> <ContextMenu> <MenuItem Header="Add room"></MenuItem> </ContextMenu> </TreeViewItem.ContextMenu> </TreeViewItem> </TreeViewItem> But with this markup the behavior is as intended, but the child items (the rooms) are indented too much. Anyway all the bining samples I could find use TextBlock instead of TreeViewItem in the DataTemplate, but wonder how to integrate the ContextMenu there.

    Read the article

  • C# WPF XAML binding to DataTable

    - by LnDCobra
    I have the following tables: Company {CompanyID, CompanyName} Deal {CompanyID, Value} And I have a listbox: <ListBox Name="Deals" Height="100" Width="420" Margin="0,20,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" Visibility="Visible" IsSynchronizedWithCurrentItem="True" ItemsSource="{Binding}" SelectionChanged="Deals_SelectionChanged"> <ListBox.ItemTemplate> <DataTemplate> <StackPanel Orientation="Horizontal"> <TextBlock Text="{Binding companyRowByBuyFromCompanyFK.CompanyName}" FontWeight="Bold" /> <TextBlock Text=" -> TGS -> " /> <TextBlock Text="{Binding BuyFrom}" FontWeight="Bold" /> </StackPanel> </DataTemplate> </ListBox.ItemTemplate> </ListBox> As you can see, I want to display the CompanyName rather then the ID which is a foreign Key. The relation "companyRowByBuyFromCompanyFK" exists, as in Deals_SelectionChanged I can access companyRowByBuyFromCompanyFK property of the Deals row, and I also can access the CompanyName propert of that row. Is the reason why this is not working because XAML binding uses the [] indexer? Rather than properties on the CompanyRows in my DataTable? At the moment im getting values such as - TGS - 3 - TGS - 4 What would be the best way to accomplish this? Make a converter to convert foreign keys using Table being referenced as custom parameter. Create Table View for each table? This would be long winded as I have quite a large number of tables that have foreign keys.

    Read the article

  • XAML itemscontrol visibility

    - by Sam
    Hello, I have a ItemsControl in my XAML code. When some trigger occur i want to collapse the full itemsControl, so all the elements. <ItemsControl Name="VideoViewControl" ItemsSource="{Binding Videos}"> <ItemsControl.ItemsPanel> <ItemsPanelTemplate> <WrapPanel ItemHeight="120" ItemWidth="160" Name="wrapPanel1"/> </ItemsPanelTemplate> </ItemsControl.ItemsPanel> <ItemsControl.ItemTemplate> <DataTemplate> <views:VideoInMenuView /> </DataTemplate> </ItemsControl.ItemTemplate> </ItemsControl> The trigger: <DataTrigger Value="videos" Binding="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type UserControl}, AncestorLevel=1}, Path=DataContext.VideosEnable}"> <Setter Property="ScrollViewer.Visibility" Value="Visible" TargetName="test1" /> <Setter Property="ScrollViewer.Visibility" Value="Collapsed" TargetName="test2" /> <Setter Property="WrapPanel.Visibility" Value="Collapsed" TargetName="wrapPanel1" /> </DataTrigger> When I add the last setter the program crashes. Without this last setter it works fine but no visibility change.... What is wrong with this code? What is the write method to collapse all the elements of a ItemsControl with a trigger?

    Read the article

  • help with grouping and sorting for TreeView in xaml

    - by danhotb
    I am having problems getting my head around grouping and sorting in xaml and hope someone can get me straightened out! I have creaed an xml file from a tree of files and folders (just like windows explorer) that can be serveral levels deep. I have bound a TreeView control to an xml datasource and it works great! It sorts everything alphabetically but ... I would like it to sort all folders first then all files, rather than folders listed with files, as it does now. the xml : if you load this to a treeviw it will display the two files before the folder because they are first in alpha-order. here is my code: <!-- This will contain the XML-data. --> <XmlDataProvider x:Key="xmlDP" XPath="*"> <x:XData> <Select_Project /> </x:XData> </XmlDataProvider> <!-- This HierarchicalDataTemplate will visualize all XML-nodes --> <HierarchicalDataTemplate DataType="project" ItemsSource ="{Binding}"> <TextBlock Text="{Binding XPath=@name}" /> </HierarchicalDataTemplate> <HierarchicalDataTemplate DataType="folder" ItemsSource ="{Binding}"> <TextBlock Text="{Binding XPath=@name}" /> </HierarchicalDataTemplate> <HierarchicalDataTemplate DataType="file" ItemsSource ="{Binding}"> <TextBlock Text="{Binding XPath=@name}" /> </HierarchicalDataTemplate> <CollectionViewSource x:Key="projectView" Source="{StaticResource xmlDP}"> <CollectionViewSource.SortDescriptions> <!-- ADD SORT DESCRIPTION HERE --> </CollectionViewSource.SortDescriptions> </CollectionViewSource> <TreeView Margin="11,79.992,18,19.089" Name="tvProject" BorderThickness="1" FontSize="12" FontFamily="Verdana"> <TreeViewItem ItemsSource="{Binding Source={StaticResource xmlDP}, XPath=*}" Header="Project"/> </TreeView>

    Read the article

  • reference from xaml to public class in .cs class file

    - by netmajor
    I have in my WPF project file RssInfo.cs in which I have public class public class DoubleRangeRule : ValidationRule { public double Min { get; set; } public double Max { get; set; } public override System.Windows.Controls.ValidationResult Validate(object value, CultureInfo cultureInfo) { ... } } and from my XAML code in WPF window class I neet to get to this DoubleRangeRule class.. //reference to my project, all my files are in the WpfCzytanieRSS namespace xmlns:valRule="clr-namespace:WpfCzytanieRSS;assembly=WpfCzytanieRSS" <TextBox Validation.ErrorTemplate="{StaticResource TextBoxErrorTemplate}" Name="tbTitle"> <TextBox.Text> <Binding Path="Nazwa" UpdateSourceTrigger="PropertyChanged"> <Binding.ValidationRules> <valRule:DoubleRangeRule Min="0.5" Max="10"/> //error place </Binding.ValidationRules> </Binding> </TextBox.Text> </TextBox> And i get two errors: Error 1 The tag 'DoubleRangeRule' does not exist in XML namespace 'clr-namespace:WpfCzytanieRSS;assembly=WpfCzytanieRSS'. Error 2 The type 'valRule:DoubleRangeRule' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built. Please help to get to class DoubleRangeRule ! :)

    Read the article

  • XAML ContextMenu gets bound to wrong row in a DataGrid

    - by Simon_Weaver
    I have a XAML based ContextMenu bound to the rows in a datagrid. It works just fine - until the grid is scrolled! This is the context menu for one of the controls in the visual tree or a DataGrid row. <data:DataGridTemplateColumn Header="Customer Details" Width="*"> <data:DataGridTemplateColumn.CellTemplate> <DataTemplate> <Grid Background="Transparent"> <!-- allows click in entire cell --> <controlsInputToolkit:ContextMenuService.ContextMenu> <controlsInputToolkit:ContextMenu> <controlsInputToolkit:MenuItem Header="{Binding CompletedOrderId,StringFormat='Create Reminder for order #\{0\}'}" CommandParameter="{Binding}"> <controlsInputToolkit:MenuItem.Command> <command:CreateReminderCommand/> </controlsInputToolkit:MenuItem.Command> <controlsInputToolkit:MenuItem.Icon> <Viewbox> <Image Width="19" Height="18" Source="../images/reminders.png" VerticalAlignment="Center"/> </Viewbox> </controlsInputToolkit:MenuItem.Icon> </controlsInputToolkit:MenuItem> <controlsInputToolkit:ContextMenu> <controlsInputToolkit:ContextMenuService.ContextMenu> ...... The ICommand is CreateReminderCommand and the CommandParameter is bound to the data item for the row itself. This works just fine - I can right click on a row and it will show me the correct text in the menu item 'Create Reminder for order 12345'. Then I scroll the datagrid down a page. If I keep right clicking on items then suddenly I'll see the wrong order number for a row. I think what must be happening is this : The DataGrid is reusing instances of MenuItem that it has previously created. How can I force a refresh of the ContextMenu when it is displayed for an item that changes? There's no 'Update method on the ContextMenu or ContextMenuService.

    Read the article

  • C# WPF XAML Problem with icon in GridViewColumn

    - by Alex
    I've created a ListView with a GridView component in it. Now trying to fill one of the cells with an icon (PNG) like in the code sample below (save_icon.png): <ListView.View> <GridView> <GridViewColumn Header="Date" Width="Auto" DisplayMemberBinding="{Binding Date}" /> <GridViewColumn Header="Time" Width="Auto" DisplayMemberBinding="{Binding Time}" /> <GridViewColumn Header="FriendlyName" Width="Auto" DisplayMemberBinding="{Binding FriendlyName}" /> <GridViewColumn Width="Auto"> <Image Source="save_icon.png" /> </GridViewColumn> </GridView> </ListView.View> Visual Studio gives me an error on the line, where i put the icon into the column (ERROR: "Error 35: The file save_icon.png is not part of the project or its 'Build Action' property is not set to 'Resource'.") I added the icon to the project as a resource and when i start the app, everything works (the icon appears at the right place). But the WPF designer window can't be reloaded and i'm not able to see changes in the designer, when i change the XAML code. Can somebody explain this error or am i doing something wrong? Thanks for every hint in advance!

    Read the article

  • XAML Binding to complex value objects

    - by Gus
    I have a complex value object class that has 1) a number or read-only properties; 2) a private constructor; and 3) a number of static singleton instance properties [so the properties of a ComplexValueObject never change and an individual value is instantiated once in the application's lifecycle]. public class ComplexValueClass { /* A number of read only properties */ private readonly string _propertyOne; public string PropertyOne { get { return _propertyOne; } } private readonly string _propertyTwo; public string PropertyTwo { get { return _propertyTwo; } } /* a private constructor */ private ComplexValueClass(string propertyOne, string propertyTwo) { _propertyOne = propertyOne; _propertyTwo = PropertyTwo; } /* a number of singleton instances */ private static ComplexValueClass _complexValueObjectOne; public static ComplexValueClass ComplexValueObjectOne { get { if (_complexValueObjectOne == null) { _complexValueObjectOne = new ComplexValueClass("string one", "string two"); } return _complexValueObjectOne; } } private static ComplexValueClass _complexValueObjectTwo; public static ComplexValueClass ComplexValueObjectTwo { get { if (_complexValueObjectTwo == null) { _complexValueObjectTwo = new ComplexValueClass("string three", "string four"); } return _complexValueObjectTwo; } } } I have a data context class that looks something like this: public class DataContextClass : INotifyPropertyChanged { private ComplexValueClass _complexValueClass; public ComplexValueClass ComplexValueObject { get { return _complexValueClass; } set { _complexValueClass = value; PropertyChanged(this, new PropertyChangedEventArgs("ComplexValueObject")); } } } I would like to write a XAML binding statement to a property on my complex value object that updates the UI whenever the entire complex value object changes. What is the best and/or most concise way of doing this? I have something like: <Object Value="{Binding ComplexValueObject.PropertyOne}" /> but the UI does not update when ComplexValueObject as a whole changes.

    Read the article

  • how to tile 3D mesh with image brush in XAML

    - by MC9000
    I have a 2D square in a ViewPort3D that I want to do a tiling of an image (like a checkerboard or flooring with "tiles" effect). I've created an image brush (the image is 50x50 pixels, the surface 250x550 pixels) and a viewport (trying to follow MS's site - though their example is for 2D), but only 1 of the colors in the "tile" image shows up and no tiling is seen. I can't find a single example on the Internet and MS's site has no info (that I can find) on 3D XAML anywhere, so I'm stumped as how to actually do this. <Viewport3D> <Viewport3D.Camera> <PerspectiveCamera Position="125,790,120" LookDirection="0,-.7,-0.25" UpDirection="0,0,1" /> </Viewport3D.Camera> <ModelVisual3D> <ModelVisual3D.Content> <Model3DGroup> <AmbientLight Color="white" /> <GeometryModel3D> <GeometryModel3D.Geometry> <MeshGeometry3D Positions="0,0,0 250,0,0 250,550,0 0,550,0 " TriangleIndices="0 1 3 1 2 3 "/> </GeometryModel3D.Geometry> <GeometryModel3D.Material> <DiffuseMaterial> <DiffuseMaterial.Brush> <ImageBrush ViewportUnits="Absolute" TileMode="Tile" ImageSource="testsquare.gif" Viewport="0,0,50,50" Stretch="None" ViewboxUnits="Absolute" /> </DiffuseMaterial.Brush> </DiffuseMaterial> </GeometryModel3D.Material> </GeometryModel3D> </Model3DGroup> </ModelVisual3D.Content> </ModelVisual3D> </Viewport3D>

    Read the article

< Previous Page | 3 4 5 6 7 8 9 10 11 12 13 14  | Next Page >