In a WPF app I'd like to check if a return of a LINQ to SQL query contains some records, but my approach doesn't work:
TdbDataContext context = new TdbDataContext();
var sh = from p in context.Items where p.Selected == true select p;
if (sh == null)
{
MessageBox.Show("There are no Selected It...
Hi,
I have tabcontrol,in that by pressing second tab button im adding data to third Tab Listbox.But its not get added.
SecondTab function:
private void Callbutton_Click(object sender, RoutedEventArgs e)
{
tab.AddPresetmenu("CALL BUTTON");
}
ThirdTab Fucntion:
ObservableCollection<DataItem> items =...
I have a storyboard like the following
Duration="0:0:1" Completed="DeviceExplorer_Completed">
The animation for some reason does not appear to be working linearly.
If I change the duration to something like Duration="0:0:0.8"
and assign the stroyboard to a MouseEnter event of a button, the animation moves but does not complet...
I have the following situation:
A stackpanel contains a number of elements, including some that are contained in a GroupBox. So something like this:
<StackPanel x:Name="stackpanel" Background="White">
<TextBlock Text="TextBlock"/>
<TextBlock Text="Another TextBlock"/>
<!--plus a load of other elements and controls-->
<...
In a WPF application I have a ListView:
<ListView Name="ItemSelList" ItemsSource="{Binding ItemColl}" SelectionChanged="ItemSelList_SelectionChanged">
<ListView.View>
<GridView>
<GridViewColumn Header="Date" Width="90" DisplayMemberBinding="{Binding Date}"/>
<GridViewColumn Header="Time" Width="90" DisplayMemberBindi...
Hi ,
A Context Menu automatically closes when the user clicks outside of it.
Is there a way to stop it from closing ? I tried setting the StaysOpen property to true but failed to get the desired result.
Thanks for any help!
...
I have some useful wpf buttons to test some functionality. It would be good not to show them in release but in debug indeed.
Doing it from code is easy. But I'd prefer a declarative solution.
...
I have a ContextMenu with the ItemsSource bound to the selected item of a list view, like this:
<ContextMenu ItemsSource="{Binding Path=PlacementTarget.SelectedItem,
RelativeSource={RelativeSource Self}, Converter={StaticResource possibleConverter}}"/>
The possibleConverter enumerates all possible values for a property of the the ...
Hey Guys,
I'm starting a WPF project, and just finished the base of the UI, it seems very convoluted though, so I'm not sure if I've gone around laying it out in the right way. I don't want to get to start developing the back-end and realise that I've done the front wrong, and make life harder for myself.
Coming from a background of <D...
I have defined my binding thus:
<TreeView
ItemsSource="{Binding UsersView.View}"
ItemTemplate="{StaticResource MyDataTemplate}"
/>
The CollectionViewSource is defined thus:
private ObservableCollection<UserData> users;
public CollectionViewSource UsersView{get;set;}
UsersView=new CollectionViewSource{Source=users};
Us...
I've added functionality to an application that prints out a bunch of information to a FixedDOcument and sends this off to the printer. This works just fine, however the request is that there be an in application function that emails the document using OUtlook and its here that I come unstuck. I'd very much like to just reuse the class t...
[Original]
I have a listbox which has its itemssource (this is done in the code behind on as the window is created) databound to an observable collection. The List box then has the following data template assigned against the items:
usercontrol.xaml
...
<ListBox
x:Name="communicatorListPhoneControls"
ItemContainerStyle="{Sta...
Hello all.
Im new to .NET and WPF so i hope i will ask the question correctly.
I am using INotifyPropertyChanged implemented using PostSharp 1.5:
[Serializable, DebuggerNonUserCode, AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class, AllowMultiple = false, Inherited = false),
MulticastAttributeUsage(MulticastTargets.Clas...
I'm making my own ControlTemplate for a standard Button in WPF. I want to change the background of my button when the user hovers over the button with the mouse, but also when the user presses the button (to yet another color). This seems like a common behavior, but I can't get it to work.
My template consists of a Border with an Image ...
Hi,
I want to display a Slider ranging from 0.5 to 1.5 with only one tick mark at 1.0 to mark the center and default value. I have defined a Slider as follows:
<Slider Minimum="0.5" Maximum="1.5"
IsMoveToPointEnabled="True" IsSnapToTickEnabled="False"
Orientation="Horizontal"
Ticks="1.0"
TickPlacement="B...
Hope this is not a dupe.
I would like to be able to do the following in XAML:
<DataTemplate DataType="{x:Type TestApp:ButtonVM}">
<Button
Grid.Column="{Binding GridColumn}"
Grid.Row="{Binding GridRow}"
Content="{Binding Path=Info}"
/>
</DataTemplate>
The Cont...
I need OnDragEnter event for every cell on my WPF Datagrid.
I tried this :
<ControlTemplate TargetType="{x:Type my:DataGridCell}" x:Key="RowTemplate">
<ContentPresenter DragEnter="ContentPresenter_DragEnter" >
</ContentPresenter>
</ControlTemplate>
But doesn't seem to work. Any ideas people?
Edit: Thanks for the responses...
My WPF window has its foreground brush set to a brush from a resource dictionary, and I want all text in the window to have this color, so I don't touch the foreground brush in anything else.
Textboxes get the color
Textblocks get the color
Buttons get the color
Listboxes do not get the color, and so neither do their contents.
Is ther...
Hi,
I have a 3rd party dll which generates a Bitmap and send back its reference. If I generate a System.Windows.Media.Imaging.BitmapSource out of it immediately then all goes well. But if I save the reference and later on (after a few seconds and many function calls) I try to generate the Bitmapsource, I get
System.AccessViolationE...
I'm curious if anyone knows of a way to easily get a double border effect in WPF similar to what you see in the selected items in Windows Explorer in Windows 7.
If you look closely, you'll notice that the selected item has a dark border, a lighter, inner-border, and then a gradient background.
Currently, I'm using two borders around ...