|
I have simple List<string>.
I need to define Table that each column of this table is one of this list elements.
So i will use ListView - I need to define a ListView that each column of this ListView is one of my List<string> => that mean that the
first column name is List<string>[0]
second column name is List<string>[1]
.
.
.
I can't fine any way to do it.
I google it and all the examples are shown how to create dynamic rows
Any help please ...
|
|
|
|
|
I am currently working on a cbt software and i want the questions to be coming randomly ( one per page) which is working. Please how can i program Previous and Next button with WPF of VB.NET so user can skip and later go back before the exam finishes. Please help me. Have been on it for like 3 weeks now. thank you
|
|
|
|
|
You already posted this in the VB forum. Please post in one forum only.
|
|
|
|
|
First[^] hit when I googled WPF Page Navigation.
|
|
|
|
|
He may have had trouble relating Next/Previous with Navigation, so this is good google foo!
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
|
Probably the same way you developed the first two.
|
|
|
|
|
please give me some advise,Thanks.
|
|
|
|
|
|
Part 1
I'm using SQLiteStudio 3.0.5.
It's OK, but one think I can't figure out is how to execute 2 queries AND have both their results show at the time time:
SELECT * FROM Table1;
[UPDATED - OOPS]
SELECT * FROM Table2
This runs but only displays the results from Table 2.
Part 2
Anyone know of a better tool?
Thanks
If it's not broken, fix it until it is
modified 22-Jul-15 12:44pm.
|
|
|
|
|
SELECT * FROM Table1
Shows results from Table2?
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
Sorry, typo -
SELECT * FROM Table1;
SELECT * FROM Table2
Only shows the results from table2.
SQL Management Studio shows one table for each query
If it's not broken, fix it until it is
|
|
|
|
|
Not exactly sure what you're after here. If the tables are related then you need to join them on a common field and show the results as one query. If they are not related you can always use a cross join which will return rows from table1 combined with each row of table2:
SELECT * FROM Table1 CROSS JOIN Table2
or
SELECT * FROM Table1, Table2
-NP
Never underestimate the creativity of the end-user.
|
|
|
|
|
Nothing to do with joins...
Paste the following into SSMS
SELECT * FROM Table1
SELECT * FROM Table2
Press F5. The queries both run and both result sets are displayed.
When I do this in SQLiteManager, only the last result set is displayed.
If it's not broken, fix it until it is
|
|
|
|
|
Does sticking GO; between the statements change the results?
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
|
What does this have to do with WPF or Silverlight?
|
|
|
|
|
Absolutly nothing. I posted in the wrong formum
If it's not broken, fix it until it is
|
|
|
|
|
I would like to have an icon switch between red and green, for inactive/active, and will have approximately a dozen scattered throughout several grids. I looked into DataBinding and IValueConverter, but have not been successful in getting the functionality that I am looking for. Question, is this the best way most efficient way for switching an icon off and on.
|
|
|
|
|
Did you try a Data.Trigger?
In Word you can only store 2 bytes. That is why I use Writer.
|
|
|
|
|
I was eventually able to get my code to function using the Converter, I had not correctly set up the DataContext. I will investigate Data.Trigger though. Thanks.
|
|
|
|
|
I've created a style that allows me to use a custom image in place of the default up/down arrow in an expander. How can I create this style so that I can set the image in the place where the expander is used, instead of setting it in the style.
Thanks
Sorry, a bit long. The image is after the second comment
<!-- ********** BASE EXPANDER STYLE********** -->
<Style x:Key="BaseLiveViewExpanderStyle"
TargetType="{x:Type Expander}">
<pre>
<Setter Property="Foreground" Value="White"/>
<Setter Property="Background" Value="{StaticResource Gray3}"/>
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
<Setter Property="VerticalContentAlignment" Value="Stretch"/>
<Setter Property="BorderBrush" Value="{StaticResource NormalBrush}"/>
<Setter Property="BorderThickness" Value="2"/>
<Setter Property="FontFamily" Value="{StaticResource AppFontName}"/>
<Setter Property="FontSize" Value="{StaticResource NormalFontSize}"/>
</Style>
<!-- ********** SENSOR LIST EXPANDER HEADER STYLE********** -->
<Style x:Key="SensorListExpanderDownHeaderStyle"
TargetType="{x:Type ToggleButton}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ToggleButton}">
<Border Padding="{TemplateBinding Padding}">
<Grid Background="Transparent" SnapsToDevicePixels="False">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="19"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Image Source="/DFT.Falcon6.Shared;component/Media/Images/sensor_list_normal_16.png"/>
<ContentPresenter Grid.Column="1"
x:Name="cp"
HorizontalAlignment="Left"
Margin="4,0,0,0"
RecognizesAccessKey="True"
SnapsToDevicePixels="True"
VerticalAlignment="Center"/>
</Grid>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsChecked" Value="false">
<Setter Property="Visibility" TargetName="cp" Value="Collapsed"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- ********** SENSOR LIST EXPANDER STYLE********** -->
<Style x:Key="sensorListExpanderStyle"
TargetType="{x:Type Expander}"
BasedOn="{StaticResource BaseLiveViewExpanderStyle}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Expander}">
<Border BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
Background="{TemplateBinding Background}"
CornerRadius="3"
SnapsToDevicePixels="true">
<DockPanel>
<ToggleButton x:Name="HeaderSite"
ContentTemplate="{TemplateBinding HeaderTemplate}"
ContentTemplateSelector="{TemplateBinding HeaderTemplateSelector}"
Content="{TemplateBinding Header}"
DockPanel.Dock="Top"
Foreground="{TemplateBinding Foreground}"
FontWeight="{TemplateBinding FontWeight}"
FontStyle="{TemplateBinding FontStyle}"
FontStretch="{TemplateBinding FontStretch}"
FontSize="{TemplateBinding FontSize}"
FontFamily="{TemplateBinding FontFamily}"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
IsChecked="{Binding IsExpanded, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
Margin="1"
MinWidth="0"
MinHeight="0"
Padding="{TemplateBinding Padding}"
Style="{StaticResource SensorListExpanderDownHeaderStyle}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"/>
<ContentPresenter x:Name="ExpandSite"
DockPanel.Dock="Bottom"
Focusable="false"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
Margin="{TemplateBinding Padding}"
Visibility="Collapsed"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
</DockPanel>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsExpanded" Value="true">
<Setter Property="Visibility" TargetName="ExpandSite" Value="Visible"/>
</Trigger>
<Trigger Property="IsEnabled" Value="false">
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
If it's not broken, fix it until it is
|
|
|
|
|
I'm trying to create a Drop Down Button UC. So far it's all going well except that the Content menu has no SelectedItem. So I tried this:
XAML
<Grid x:Name="layoutRoot">
<pre>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Button Grid.Row="0"
Click="Button_Click">
<StackPanel Orientation="Horizontal">
<Image Source="sort_16.png"
VerticalAlignment="Center"
Height="16"
Width="16"/>
<Image Source="downarrow.png"
VerticalAlignment="Center"
Height="3"
Width="5"/>
</StackPanel>
<Button.ContextMenu>
<ContextMenu/>
</Button.ContextMenu>
<Button.Resources>
<ContextMenu x:Key="menu" ItemsSource="{Binding MenuItems}">
<ContextMenu.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding Text}"/>
<MenuItem Command="{Binding MenuItemSelectedCommand, Mode=TwoWay}"
CommandParameter="{Binding}"/>
</StackPanel>
</DataTemplate>
</ContextMenu.ItemTemplate>
</ContextMenu>
</Button.Resources>
</Button>
Code behind
public partial class DFTDropDownButton : UserControl
{
#region Commands
private ICommand _MenuItemSelectedCommand;
public ICommand MenuItemSelectedCommand
{
get
{
if (_MenuItemSelectedCommand == null)
_MenuItemSelectedCommand = new RelayCommand<DropDownButtonMenuItem>(p => menuItemSelectedExecuted(p), p => menuItemSelectedCanExecute());
return _MenuItemSelectedCommand;
}
}
#endregion
<pre>
#region MenuItems DP
public List<DropDownButtonMenuItem> MenuItems
{
get { return (List<DropDownButtonMenuItem>)GetValue(MenuItemsProperty); }
set { SetValue(MenuItemsProperty, value); }
}
public static readonly DependencyProperty MenuItemsProperty =
DependencyProperty.Register("MenuItems", typeof(List<dropdownbuttonmenuitem>), typeof(DFTDropDownButton), new UIPropertyMetadata(null));
#endregion
#region CTOR
public DFTDropDownButton()
{
InitializeComponent();
this.layoutRoot.DataContext = this;
}
#endregion
#region Private Methods
private bool menuItemSelectedCanExecute()
{
return true;
}
private void menuItemSelectedExecuted(DropDownButtonMenuItem item)
{
}
#endregion
#region Event Handlers
private void Button_Click(object sender, RoutedEventArgs e)
{
Button b = sender as Button;
b.ContextMenu.ItemsSource = MenuItems;
b.ContextMenu.IsOpen = true;
}
#endregion
}
Problem
The Command never fires.
Anyone see what's wrong here?
Thanks
If it's not broken, fix it until it is
|
|
|
|
|
The MenuItemSelectedCommand is defined on your DFTDropDownButton class, but the MenuItem 's DataContext will be an instance of your DropDownButtonMenuItem class.
If you check the output window, you should see lots of data binding errors telling you that the DropDownButtonMenuItem class doesn't contain a property called MenuItemSelectedCommand .
Try pointing to the layoutRoot element in the binding:
<MenuItem
Command="{Binding Path=DataContext.MenuItemSelectedCommand, ElementName=layoutRoot}"
CommandParameter="{Binding}"
/>
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I had already checked the output. No binding errors.
I did try your suggestion... no joy. Also, the Context Menu ItemsSource does not get set
from the bindings. It has to be done in the button's click.
Something strange with the bindings.
This is a sample project[^] if you're interested in taking a look.
If it's not broken, fix it until it is
|
|
|
|