Search Results

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

Page 79/239 | < Previous Page | 75 76 77 78 79 80 81 82 83 84 85 86  | Next Page >

  • WPF DataGrid row validation error count

    - by SuperFloh1234
    Hi! I'm currently facing the problem, that I import an Excel file to a DataGrid. This works pretty fine, but after importing the table, I need to know how many rows are invalid. I have applied several validation rules for the different datatypes, and I have an icon in the row header, that shows up if the row is invalid. But since I have more that 10.000 rows in the grid, I don't want scroll all the way through it to find the errors. Any ideas, how to determine the count of invalid rows (and then maybe bind that to a textbox)? Thx

    Read the article

  • WPF: Can I use VisualStateManager to change alignment?

    - by kennethkryger
    Hi, I've got this "object-stack" - Window --- Grid (VerticalAlignment = Stretch) ----- Border (VerticalAlignment = Stretch OR Top) The Border a primitive UserControl right now to keep things simple for me. I'd like to be able to use the VisualStateManager to toggle the VerticalAlignment-property of the Border, so that the "Normal-state" equals VerticalAlignment.Top and "Expanded-state" equals VerticalAlignment.Stretch. Is this possible? Also, I'd like to use an easing function, when swithing between the two states.

    Read the article

  • WPF: Binding items added to UserControl's exposed children

    - by Brian
    I have a user control that allows items to be added to it by exposing a Grid's Children property. Any control I add shows up fine but when I try to bind a property on the added item to a control in the main window nothing happens (example): <TextBox Name="txtTest" Text="Success!" /> <mycontrols:CustomUserControl.ExposedGridChildren> <TextBox Text="{Binding ElementName=txtTest, Path=Text, FallbackValue=fail}"/> </mycontrols:CustomUserControl.ExposedGridChildren> This example always results in the TextBox's text showing "fail". Here is how I'm exposing the children in the user control: public UIElementCollection ExposedGridChildren { get { return grdContainer.Children; } } Any thoughts? Is it a scope issue? I know I can't name the elements I add to the children because of scope errors. Thanks, Brian.

    Read the article

  • Reset TextBox.Background to default in WPF so it still gets updated when system settings change

    - by Neo
    I have a TextBox that I wish to reset its Background property to its default value after changing it to a different colour. I have tried setting it to SystemColors.WindowBrush, but then, if the Display Settings are updated to change this value, it doesn't get dynamically reflected in the TextBox (it does normally if TextBox.Background hasn't been touched). Any idea how to do this?

    Read the article

  • WPF BackGroundWorker ProgressChanged not updating textblock

    - by user354469
    I have the method below that seems to behaving strangely. The ProgressChanged and RunWorkerCompleted seem to be updating themselves at the same time. If I comment out the RunWorkerCompleted code which updates the Textblock I see the ProgressChanged taking effect after the data is transferred. What am i doing wrong here? I obviously want the textblock to show I'm getting data, then change when I have finished getting the data. public void GetAppointmentsBackground() { System.Windows.Threading.Dispatcher webServiceDispatcher = this.Dispatcher; worker = new BackgroundWorker(); worker.WorkerReportsProgress = true; worker.DoWork += delegate(object sender, DoWorkEventArgs args) { GetAppointmentsForDayDelegate getAppt = new GetAppointmentsForDayDelegate(GetAppointmentsForDay); webServiceDispatcher.BeginInvoke(getAppt); (sender as BackgroundWorker).ReportProgress(25); }; worker.ProgressChanged += delegate(object s, ProgressChangedEventArgs args) { txtMessages.Text = "Contacting Server"; }; worker.RunWorkerCompleted += delegate(object s, RunWorkerCompletedEventArgs args) { txtMessages.Text = "Completed Successfully"; }; worker.RunWorkerAsync(); }

    Read the article

  • WPF DataGrid bind data between columns

    - by Markus2k
    Lets say I have 2 columns in my data Grid: Column A: Selected, and Column B: Name. The Selected column is a checkbox. And Name column is text field. I want to set the color of the text in 'Name' column as Blue if Column A's check box is checked, and Red otherwise. Essentially I don't know how to bind data between columns of the datagrid. And sample code/link providing example would be useful.

    Read the article

  • WPF Databound Listbox

    - by Jeff
    I have a listbox bound to a list of objects for a data entry screen. The item template includes textblocks, a checkbox and comboboxes. When the listbox is populated I would like to change the foreground color of the textblocks to red if object.value1 = true and object.value2 = 0. Any ideas?

    Read the article

  • WPF - databinding ObservableCollection CollectionChanged event?

    - by e0eight
    Hi, I have an observable collection implemented in my user control which indicates states of a device. Based on the collection change, the user control is to trigger animations(subscribe to collectionchanged event). The observable collection is implemented as a dependency property. In the application, I data bind the device states to the user control observableCollection using one-way databinding. When a new state is added in the application, I can see the ObservableCollection in the user control is updated. However, the CollectionChanged event never got fired, so no animations. Does anyone has an idea why this is so? Thank you in advance.

    Read the article

  • WPF: How to make Contextmenu select and forget?

    - by Kave
    I have a Contextmenu with a ListBox inside. Whenever I right click my control and select a value from my contextmenu the last selected value stays marked and I can't select that value again. The idea is, that I may select the same value within the COntextmenu in order to turn a property on or off. Should be quite basic, what am I missing? Many Thanks,

    Read the article

  • Setting WPF control background image using styles?

    - by aviv
    Hi, I have a set of buttons inside a stack panel. I want them all to have a background image. How can i do it using styles? since i don't want to set manually the Background image for each button. Here is a code snippet: <StackPanel Orientation="Horizontal" Height="100px" VerticalAlignment="Top"> <StackPanel.Resources> <Style TargetType="Button"> <Setter Property="Margin" Value="2,4" /> </Style> </StackPanel.Resources> <Button Width="127px" Height="79px" VerticalAlignment="Bottom"> <Button.Background> <ImageBrush ImageSource="images/Tab.png" /> </Button.Background> </Button> <Button>A</Button> <Button>R</Button> <Button>S</Button> </StackPanel> Thanks.

    Read the article

  • How to reverse items in WPF Datagrid?

    - by irf1x
    If i have DataGrid which looks like: Col 1 Col 2 ------- ------- 1 a 2 b 3 c ... ... n n Can the order be reversed easily without sorting? So that n is first, and 1 is last. I have custom sort implemented from this article, but sorting the same column twice in a row calls sorting function twice (which is slow), so just reversing the order should be faster and have the same effect.

    Read the article

  • WPF List - ListItem Visibility

    - by niao
    Greetings, I have a FlowDocument where List control is placed. Inside this list I have some ListItem. Is there any way to set some kind of Visibility for specific ListItem? I don't see a coressponding Property like Visibility for ListItem. When I set fontsize="0.1" then application hangs (it goes into infinite loop).

    Read the article

  • WPF - How to stop an ItemsControl psuedo-grid's columns from dancing/jumping around during layout

    - by Drew Noakes
    Several other questions on SO have come to the same conclusion I have -- using an ItemsControl with a DataTemplate for each item constructed to position items such that they resemble a grid is much simpler (especially to format) than using a ListView. The code resembles: <StackPanel Grid.IsSharedSizeScope="True"> <!-- Header --> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="Auto" SharedSizeGroup="Column1" /> <ColumnDefinition Width="Auto" SharedSizeGroup="Column2" /> </Grid.ColumnDefinitions> <TextBlock Grid.Column="0" Text="Column Header 1" /> <TextBlock Grid.Column="1" Text="Column Header 2" /> </Grid> <!-- Items --> <ItemsControl ItemsSource="{Binding Path=Values, Mode=OneWay}"> <ItemsControl.ItemTemplate> <DataTemplate> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="Auto" SharedSizeGroup="Column1" /> <ColumnDefinition Width="Auto" SharedSizeGroup="Column2" /> </Grid.ColumnDefinitions> <TextBlock Grid.Column="0" Text="{Binding ColumnProperty1}" /> <TextBlock Grid.Column="1" Text="{Binding ColumnProperty2}" /> </Grid> </DataTemplate> </ItemsControl.ItemTemplate> </ItemsControl> </StackPanel> The problem I'm seeing is that whenever I swap the object to which the ItemsSource is bound (it's an ObservableCollection that I replace the reference to, rather than clear and re-add), the entire 'grid' dances about for a few seconds. Presumably it is making a few layout passes to get all the Auto-width columns to match up. This is very distracting for my users and I'd like to get it sorted out. Has anyone else seen this?

    Read the article

  • WPF attach popup with a control

    - by viky
    I have a scenario where I am displaying a popup on my control. I am able to do this using PlacementTarget, Position, etc. My problem is when I resize the window and move it to somewhere else in the desktop, the popup remains stationary meaning it doesn't move with the control set as PlacementTarget. I was able to hide it in case of other window getting focus. But not able to attach it with my control. How can I solve this problem? Is there any other such control available?

    Read the article

  • WPF - List items not visible in Blend when 'DisplayMemberPath' is used

    - by Andy T
    Hi, We're currently working out how to implement MVVM and I've got to the point where I've got the MVVM Light Toolkit set up in blend and can specify dummy data to be supplied if running in Blend. All good. I've created a dummy list of data. The list contains 6 instances of a very simple class called DummyItem which has Age and Name properties. Here's the main code from my 'DummyList' class: public class DummyItem{ public string Name; public int Age; public DummyItem(string name, int age){ this.Name = name; this.Age = age; } } public class DummyList : ArrayList { public DummyList() { this.Add(new DummyItem("Dummy1", 00)); this.Add(new DummyItem("Dummy2", 01)); this.Add(new DummyItem("Dummy3", 02)); this.Add(new DummyItem("Dummy4", 03)); this.Add(new DummyItem("Dummy5", 04)); this.Add(new DummyItem("Dummy6", 05)); } } Here's the operative part of my XAML. The DataContext line does work and points to the correct ViewModel. <Grid x:Name="LayoutRoot"> <ListBox x:Name="ListViewBox" DataContext="{Binding Source={StaticResource Locator}, Path=ListViewModel}" ItemsSource="{Binding TheList}" DisplayMemberPath="Name"> </ListBox> </Grid> The problem is, when I add 'DisplayMemberPath', as I have above, then I can no longer see the list items in Blend. If I remove 'DisplayMemberPath', then I see a list of objects (DummyItem) with their full path. When the app is run, everything works perfectly. It's just that in Blend itself I cannot see the list items when I use 'DisplayMemberPath'. Anyone know why I can't see the items inside Blend itself when I use DisplayMemberPath? Thanks! AT

    Read the article

  • WPF items not visible when grouping is applied

    - by Tri Q
    Hi, I'm having this strange issue with my ItemsControl grouping. I have the following setup: <ItemsControl Margin="3" ItemsSource="{Binding Communications.View}" > <ItemsControl.GroupStyle> <GroupStyle> <GroupStyle.ContainerStyle> <Style TargetType="{x:Type GroupItem}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type GroupItem}"> <Expander> <Expander.Header> <Grid> <Grid.ColumnDefinitions > <ColumnDefinition Width="*" /> <ColumnDefinition Width="Auto" /> </Grid.ColumnDefinitions> <TextBlock Text="{Binding ItemCount, StringFormat='{}[{0}] '}" FontWeight="Bold" /> <TextBlock Grid.Column="1" Text="{Binding Name, Converter={StaticResource GroupingFormatter}, StringFormat='{}Subject: {0}'}" FontWeight="Bold" /> </Grid> </Expander.Header> <ItemsPresenter /> </Expander> </ControlTemplate> </Setter.Value> </Setter> </Style> </GroupStyle.ContainerStyle> </GroupStyle> </ItemsControl.GroupStyle> <ItemsControl.ItemTemplate> <DataTemplate> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="Auto" /> <ColumnDefinition Width="*" /> <ColumnDefinition Width="Auto" /> </Grid.ColumnDefinitions> <Grid.RowDefinitions> <RowDefinition /> <RowDefinition /> </Grid.RowDefinitions> <TextBlock FontWeight="Bold" Text="{Binding Inspector, Converter={StaticResource NameFormatter}, StringFormat='{}From {0}:'}" Margin="3" /> <TextBlock Text="{Binding SentDate, StringFormat='{}{0:dd/MM/yy}'}" Grid.Row="1" Margin="3"/> <TextBlock Text="{Binding Message }" Grid.Column="1" Grid.RowSpan="2" Margin="3"/> <Button Command="vm:CommunicationViewModel.DeleteMessageCommand" CommandParameter="{Binding}" HorizontalAlignment="Right" Grid.Column="2">Delete</Button> </Grid> </DataTemplate> </ItemsControl.ItemTemplate> </ItemsControl> In my ViewModel, I expose a CollectionViewSource named 'Communications'. I proceed to adding a grouping patter like so: Communications.GroupDescriptions.Add(new PropertyGroupDescription("Subject")); Now, the problem i'm experience is the grouping work fine, but I can't see any items inside the groups. What am I doing wrong? Any pointers would be much appreciated.

    Read the article

  • Scrolling list items in wpf

    - by sudarsanyes
    I guess the following picture depicts the problem better than texts... That is what I need. <ListBox x:Name="NamesListBox" ItemsSource="{Binding}"> <ListBox.ItemsPanel> <ItemsPanelTemplate> <WrapPanel x:Name="ItemWrapPanel"> <WrapPanel.RenderTransform> <TranslateTransform x:Name="ItemWrapPanelTransformation" X="0" /> </WrapPanel.RenderTransform> <WrapPanel.Triggers> <EventTrigger RoutedEvent="WrapPanel.Loaded"> <BeginStoryboard> <Storyboard> <DoubleAnimation Storyboard.TargetName="ItemWrapPanelTransformation" Storyboard.TargetProperty="X" To="-1000" From="{Binding ElementName=ScrollingListItemsWindow, Path=Width}" Duration="0:0:9" RepeatBehavior="100" /> </Storyboard> </BeginStoryboard> </EventTrigger> </WrapPanel.Triggers> </WrapPanel> </ItemsPanelTemplate> </ListBox.ItemsPanel> <ListBox.ItemTemplate> <DataTemplate> <Grid> <Label Content="{Binding}" /> </Grid> </DataTemplate> </ListBox.ItemTemplate> </ListBox> is what I did. But here I don't wanna hard code -1000 for the X value, rather I want to determine this based on the length of the wrap panel/number of items. Can somebody help me with this ?? Reason why I choose list box is that the number of items can increase and decrease at any time and suits the problem better. If you have got any other idea, please suggest it too. Thanks.

    Read the article

  • WPF: Horizontal Alignment

    - by emptyset
    Probably I'm just missing something obvious, but I can't get the image in my DataTemplate to align to the right in the Grid, so that when the window is stretched, the image is "pulled" to the right as well: <Window.Resources> <DataTemplate x:Key="PersonTemplate" DataType="Minimal.Client.Person"> <Border BorderBrush="Purple" BorderThickness="2" CornerRadius="2" Padding="5" Margin="5"> <Grid Margin="10"> <Grid.ColumnDefinitions> <ColumnDefinition Width="Auto" MinWidth="200"/> <ColumnDefinition Width="Auto" MaxWidth="200"/> </Grid.ColumnDefinitions> <StackPanel Grid.Column ="0" Orientation="Horizontal" > <TextBlock FontFamily="Verdana" FontSize="16" FontWeight="Bold" Text="{Binding LastName}" /> <TextBlock FontFamily="Verdana" FontSize="16" Text=", " /> <TextBlock FontFamily="Verdana" FontSize="16" Text="{Binding FirstName}" /> </StackPanel> <StackPanel Grid.Column="1" Orientation="Vertical" HorizontalAlignment="Right"> <Border BorderBrush="Black" BorderThickness="1"> <Image Source="{Binding Picture}" Width="180" Height="150" /> </Border> </StackPanel> </Grid> </Border> </DataTemplate> </Window.Resources> Any suggestions?

    Read the article

  • Template and Themes in WPF through Custom Xaml Files

    - by AKRamkumar
    I have an application where I give my user Widgets. Suppose my user wants to customize the layout of the widgets. For example, I have a clock that is green. In Xaml, to add an animation around the clock would be easy. How could i make it such that at runtime, my application reads a layout.xaml file. Loads it and parses all the gradients and xaml. But still be able to use my widget in there. EG <Layout> <Grid> <!-- Grid Definitions or Animations or Whatever--> <Clock/> <!-- They need to be able to simply use this and my applications needs to read this--> </Grid> </Layout>

    Read the article

  • WPF passing the Int argument to a data object provider method

    - by SAD
    Hi, I'm trying to produce a master/detail datagrid view. I'm using object data providers. Now I have seen many examples when the argument of a method for returning the records for the detail view is a string, like in this example: <!-- the orders datasource --> <ObjectDataProvider x:Key="OrdersDataProvider" ObjectType="{x:Type local:OrdersDataProvider}"/> <ObjectDataProvider x:Key="Orders" MethodName="GetOrdersByCustomer" ObjectInstance="{StaticResource OrdersDataProvider}" > <ObjectDataProvider.MethodParameters> <x:Static Member="system:String.Empty"/> </ObjectDataProvider.MethodParameters> </ObjectDataProvider> But in my case, the argument that I want to pass is the int ID not the string. Can I still somehow use the object data provider to return all the records from the database for the detail view if the argument passed to a method has to be an int? How could it be implemented in MVVM? Thanks a lot for any advice1

    Read the article

  • Wpf Listbox and CheckBox

    - by Tan
    Hi iam using a listbox to show a list of items. in the listbox i ahve an togglebutton on every item. When i click on the toggle button the state of the togglebutton is pressed. But when i am scrolling down in the listbox and scolls up again. The togglebutton state is not pressed. How can i prevent this please help. Heres my itemtemplate <ListBox.ItemTemplate> <DataTemplate> <StackPanel Margin="0,3,0,0"> <Border BorderBrush="Black" BorderThickness="1,1,1,1"> <Border.Background> <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0" MappingMode="RelativeToBoundingBox"> <GradientStop Color="#FFECECEC" Offset="1"/> <GradientStop Color="#FFE8E8E8"/> <GradientStop Color="#FFBDBDBD" Offset="0.153"/> <GradientStop Color="#FFE8E8E8" Offset="0.904"/> </LinearGradientBrush> </Border.Background> <Border.Style> <Style> <Style.Triggers> <DataTrigger Binding="{Binding Path=IsSelected, RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type ListBoxItem}}}" Value="True"> <Setter Property="Border.Height" Value="100"/> <Setter Property="Border.Background"> <Setter.Value> <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0" MappingMode="RelativeToBoundingBox"> <GradientStop Color="DarkGray" Offset="1"/> <GradientStop Color="#FFE8E8E8"/> <GradientStop Color="#FFBDBDBD" Offset="0.153"/> <GradientStop Color="DarkGray" Offset="0.904"/> </LinearGradientBrush> </Setter.Value> </Setter> </DataTrigger> </Style.Triggers> </Style> </Border.Style> <StackPanel Orientation="Horizontal" VerticalAlignment="Center"> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="500"/> <ColumnDefinition Width="100"/> <ColumnDefinition Width="55"/> </Grid.ColumnDefinitions> <!--Pick number--> <StackPanel Grid.Column="0" VerticalAlignment="Center" Orientation="Vertical"> <TextBlock Text="{Binding Path=FtgNamn}" FontWeight="Bold" FontSize="22pt" FontFamily="Calibri"/> <TextBlock Text="{Binding Path=LevsAttBeskr}" FontSize="18pt" FontFamily="Calibri"/> </StackPanel> <!--Pick Quantity--> <StackPanel Grid.Column="1" VerticalAlignment="Center"> <TextBlock Text="{Binding Path=Antal}" FontSize="44pt" FontFamily="Calibri"/> </StackPanel> <!-- Checkbox--> <StackPanel Grid.Column="2" VerticalAlignment="Center" HorizontalAlignment="Center"> <ToggleButton Name="Check" Width="40" Height="40" Click="Check_Click" Tag="{Binding Path=Plocklista}"> <ToggleButton.Style> <Style TargetType="ToggleButton"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type ToggleButton}"> <Border x:Name="InnerBorder" Background="White" BorderBrush="Black" BorderThickness="1"/> <ControlTemplate.Triggers> <Trigger Property="IsChecked" Value="True"> <Setter TargetName="InnerBorder" Property="Background"> <Setter.Value> <ImageBrush ImageSource="/Images/button_ok.png"/> </Setter.Value> </Setter> <Setter TargetName="InnerBorder" Property="BorderThickness" Value="0"/> </Trigger> </ControlTemplate.Triggers> </ControlTemplate> </Setter.Value> </Setter> </Style> </ToggleButton.Style> </ToggleButton> </StackPanel> </Grid> <Border BorderBrush="Darkgray" BorderThickness="0,0,1,0"> </Border> <TextBlock Width="100" Text="{Binding Path=Quantity}" FontSize="44pt" FontFamily="Calibri"/> <CheckBox Width="78"/> </StackPanel> </Border> </StackPanel> </DataTemplate>

    Read the article

  • WPF RadioButton selected in UI, but seen by code as IsChecked == false

    - by Mike
    I have some radio buttons in a group box. I select the buttons randomly, and all works perfectly from a visual standpoint and also the event handler is called each time a new button is selected. Now I have a dependency property with a callback when the value changes. When in this callback procedure I read the IsChecked value of any button, the value is False, in spite the button is visually selected (they are all false at the same time, strange). The debugger also displays all buttons unchecked. Hu hu, I'm lacking ideas about the reason, after the basic verifications... <GroupBox> <StackPanel> <RadioButton x:Name="btNone" Content="Disconnected" IsChecked="True" Checked="OnSelChecked"/> <RadioButton x:Name="btManual" Content="Manual" Checked="OnSelChecked"/> </StackPanel> </GroupBox> Event handler: private void OnSelChecked(object sender, RoutedEventArgs e) { if (btManual.IsChecked == true) { // is called } } Dependency property: public static readonly DependencyProperty ManualProperty = DependencyProperty.Register("Manual", typeof(Position), typeof(SwitchBox), new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.AffectsRender, new PropertyChangedCallback(OnManualChanged))); Dependency property callback: private static void OnManualChanged(DependencyObject sender, DependencyPropertyChangedEventArgs args) { SwitchBox box = sender as SwitchBox; if (box.btManual.IsChecked == true) { // never true, why?? } }

    Read the article

< Previous Page | 75 76 77 78 79 80 81 82 83 84 85 86  | Next Page >