Все вопросы: [xaml]

1 301 вопросов

2
голосов
2ответов
1250 просмотров

WPF WrapPanel Items don't scroll one by one

Someone help me out, please. I set a WrapPanel in a ListBox ItemsPanelTemplate. Also, I already set the ScrollViewer.CanContentScroll="True". But why the listbox items are not scrolling up/down by ITEM one by one? The scroll style is still by PIXEL. Can anyone help me? <Grid> <L...

1
голосов
2ответов
1212 просмотров

How can I desaturate selected rows when DataGrid is out of focus?

The normal convention for UI controls is for selected text, items, or rows to be brightly colored (e.g., bright blue) when the parent control is in focus and desaturated/dim (e.g., pale blue) when the control is out of focus. In contrast to the ListView/GridView, the WPF DataGrid control does no...

0
голосов
1ответов
1434 просмотров

Silverlight XAML Binding -- Decimal to Double

I've got some Columns in a DataGridView that have their Binding property set to something like the following: Binding="{Binding NetPrice}" The problem is that this NetPrice field is a Decimal type and I would like to convert it to Double inside the DataGrid. Is there some way to do this?

1
голосов
2ответов
1851 просмотров

databinding to XML in XAML: How to append new XmlNode?

all I found so far about databinding to XML always only seems to be binding to a fixed XML structure. Would be nice, if anyone could point me in any direction, everything I tried so far seems very awkward. This is what I would like to do: Binding the Checked state of a Checkbox to a node within...

6
голосов
4ответов
2168 просмотров

Implementing multiple screens in an Application

Weird question, but one that puzzles me a bit. In the old days when we had Terminals and DOS, applications generally only had one "window", and that was a fullscreen one. When people switched functions, there was no concept of opening a new window, but instead the content of the main window was o...

4
голосов
4ответов
17040 просмотров

How to change a WPF window backgroud with a data trigger?

I want to change the background color of our apps main window when a property changes. We have a business date that can be changed and I want to change the window background when it has changed from expected. I've set up a property to tell this. But can I set a style datatrigger on a window th...

2
голосов
4ответов
14867 просмотров

How can I set selected value of a XAML Combobox?

Why in the following example is the combobox set to blank instead of "Mr."? XAML: <Window x:Class="TestComb82822.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Window1" Height="300" Width="3...

3
голосов
4ответов
8363 просмотров

Dependency property not working, trying to set through style setter

I am trying to set up a custom style for my newly made usercontrol, however i am getting the error : "Cannot convert the value in attribute 'Property' to object of type 'System.Windows.DependencyProperty'." I thought i had set up Dependency properties but it seemed this was not the case, so i di...

-1
голосов
2ответов
1471 просмотров

[WPF]ItemsControl not completely loaded @Loaded event

I have a probably simple problem, that I just can't seem to figure out: I've made an ItemsControl which has its datacontext set and shows the data as pairs of Checkboxes and TextBlocks: <ItemsControl Name="listTaskTypes" Grid.Row="1" Grid.Column="2" Grid.RowSpan="2" ItemsSource="{Binding}" M...

9
голосов
2ответов
6425 просмотров

Applying a style to all derived classes in WPF

I want to apply a style to all classes derived from Control. Is this possible with WPF? The following example does not work. I want the Label, TextBox and Button to have a Margin of 4. <Window x:Class="WeatherInfo.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"...

6
голосов
3ответов
6754 просмотров

App.xaml style cannot be used in Usercontrol, how come?

I have a style for a textblock that is set inside my app.xaml this is then applied to textblocked through out my application and works fine. However i get an error: "could not create instance of type" if i apply this style to a textblock within my user control, how come this is a problem? <U...

21
голосов
4ответов
10757 просмотров

WPF: Execute a Command Binding in a search field when pressing the enter button

I have a search field in my WPF app with a search button that contains a command binding. This works great, but how can i use the same command binding for the text field when pressing enter on the keyboard? The examples I have seen are all using the Code behind with a KeyDown Event Handler. Is th...

3
голосов
2ответов
14389 просмотров

Get data from selected row in Gridview in C#, WPF

I am trying to retrieve data from a Gridview that I have created in XAML. <ListView Name="chartListView" selectionChanged="chartListView_SelectionChanged"> <ListView.View> <GridView> <GridViewColumn Header="Name" DisplayMemberBinding="{Binding Name}" Width="25...

1
голосов
1ответов
646 просмотров

TreeView items disappear

I have a TreeView that is generated in code, and will look like this in the end: <TreeView> <TreeViewItem Header="X"> <TreeViewItem Header="Y"> <TreeViewItem Header="Z"> <StackPanel Orientation="Horizontal"> <TextBlock Width="100" Te...

6
голосов
1ответов
7083 просмотров

Does anyone have a simple example of a UserControl with a single ContentPresenter?

So far, I have this: <UserControl x:Class="MyConcept.ExpanderPanel" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> <Grid> <Border Style="{StaticResource Border_PanelStyle...

0
голосов
1ответов
3156 просмотров

How to set WPF ScrollViewer height dynamically?

I have the following test sample: <Window x:Class="WpfScrollTest.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Window1" Height="200" Width="200"> <Border> <StackPanel...

1
голосов
3ответов
2743 просмотров

How do I make an asterisk line up with surrounding text in WPF?

I'm trying to make an asterisk line up vertically with surrounding text/graphics rather than above it. I thought applying a negative BaselineOffset would be the solution, but it seems to have no effect. Here's the documentation for the TextBlock.BaselineOffset property: Property Value Typ...

4
голосов
2ответов
7562 просмотров

ComboBoxItem to full width of ComboBox, when using SelectedIndex, or navigating keyboard?

Following XAML causes the "My stuff" being centered of ComboBox until I open the ComboBox, when it correctly stretches itself. <ComboBox Height="30" Width="300" HorizontalContentAlignment="Stretch" SelectedIndex="0"> <ComboBoxItem HorizontalContentAlignment="Stretch"> ...

19
голосов
3ответов
32524 просмотров

WPF - How to right align a textblock inside a horizontally oriented stackpanel?

This should be so simple - I've been hitting my head against my desk for so long trying to make a seemlingly simple task work (makes me feel like WPF is un-intuitive or buggy)... In any case, I've got a Stackpanel which is set to horizontal orientation. Inside it I've got two TextBlocks. I want...

6
голосов
3ответов
3649 просмотров

WPF, xaml Cad or drawing app examples?

I am trying to learn WPF and xaml and am writing a cad style geometry app for my kids. Does anyone know of an existing example written in VB.net? C# is fine as well. Thanks! EDIT: Any thoughts/examples on how to structure such an app? TIA

14
голосов
1ответов
10791 просмотров

Triggering on a ScrollViewer's scroll bar visibility (WPF)

Is it possible to create a Trigger that is triggered based on a ScrollViewer's scroll bar visibility? I have a ScrollViewer with its VerticalScrollBarVisibility set to Auto and I want to change some of the ScrollViewer's properties only when the scroll bar is actually visible. Something like thi...

-1
голосов
2ответов
2221 просмотров

How to enable ribbon menu?

<r:RibbonWindow.Resources> <ResourceDictionary> <!--Ribbon Commands--> <r:RibbonCommand x:Key="cmdPrint" CanExecute="RibbonCommand_CanExecute_Print" LabelTitle="Print" LabelDescription="Print" ToolTipTitle="Help" ToolTipDescription="This is used to Print"...

2
голосов
2ответов
2356 просмотров

wpf to silverlight xaml issue

Ok, I have a ResourceDictionary definition that I used for a WPF app below: <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> <Style x:Key="fieldsPanel" TargetType="{x:Type StackPanel}"> ...

0
голосов
2ответов
1700 просмотров

WPF Grid Mouse Events

I was wondering, what is the best way to capture a mouse Event inside of a wpf Grid? I wanted to Capture an event when the mouse wheel is either scrolled up or down in the Grid. I tried to create a custom grid, but that kind of didn't work. Any ideas?

2
голосов
2ответов
2902 просмотров

How do I make WPF ListView items repeat horizontally AND vertically?

I have a ListView where I would like to display things horizontally. That works fine, but now I would need to have them display like in a Windows Explorer type. For example : A B C D E F G H I or A B C D E F G H I Is it possible in a ListView?

5
голосов
2ответов
4583 просмотров

Nested TextBlocks and Hyperlinks, How do you replicate this XAML in C#?

I have this XAML: <TextBlock TextWrapping="Wrap" Foreground="Green" Text="This is some Green text up front. "> <TextBlock Foreground="Blue"> This is some Blue text. </TextBlock> This is some Green text following the Blue text. <Hyperlink&g...

0
голосов
2ответов
268 просмотров

Is there a use for XAML <columndefinition>Something Here Example</columndefinition>?

I was just creating a Grid in my XAML when i noticed that Visual Studio automatically creates ColumnDefinitions like this: &lt;Grid&gt; &lt;Grid.ColumnDefinitions&gt; &lt;ColumnDefinition&gt;&lt;/ColumnDefinition&gt; &lt;ColumnDefinition&gt;&lt;/ColumnDefinition&gt; &lt;/Grid.C...

2
голосов
3ответов
1516 просмотров

How can I bind a custom object in code-behind to a Grid in XAML?

In the following example, the Message property binds correctly but the FirstName, LastName and Age properties of the Customer object are blank. Why is that? XAML: &lt;Window x:Class="TestBinding9922.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http...

1
голосов
1ответов
1965 просмотров

WPF grid XAML layout

I am writing my UI mostly in XAML without a WYSIWYG editor. In Grids you can do: &lt;TextBox Grid.Column="0" Grid.Row="0" ... When creating a Grid coming from a HTML background I have been doing: &lt;TextBox Grid.Column="0" Grid.Row="0"&gt; &lt;Label Grid.Column="1" Grid.Row="0"&gt; &lt...

24
голосов
2ответов
11713 просмотров

XAML equivalent to DIV in HTML?

What I want to be more specific is an element I can use for grouping a set of other elements, without effecting their layout. The only thing it should do besides giving a nicer XAML by grouping related elements in their own parent tag is to propagate ambient properties such as DataContext. It sho...