|
Ok, I think I understand, although I don't know where the Path goes
Everything makes sense in someone's mind
|
|
|
|
|
In your command binding:
Command="{Binding Path=DataContext.SelectedLinkCommand, RelativeSource={RelativeSource FindAncestor, AncestorType={ x:Type local:YourViewType }}}">
|
|
|
|
|
That did it . Thank you!
Everything makes sense in someone's mind
|
|
|
|
|
hi everybody
can anyone help me to know how can I rotate a usercontrol horizontally while loading??
Thanks,
|
|
|
|
|
Use a transition.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
|
Hi,
I have few simple controls defined in xaml in wpf.
In the code behind when I try to access this control they are coming up and also coming in VS intellisence. But during run time these controls are always null. as a result UI doesn't show.
Any reasons?
Thanks
|
|
|
|
|
are you calling InitializeComponent()?
|
|
|
|
|
yes..that is being called
|
|
|
|
|
Then run with first chance exceptions turned on. Should tell you what the problem is.
|
|
|
|
|
thanks...I have fixed...Somehow InitinitializeComponent() was not being called..
|
|
|
|
|
Hi,
Is the runat="server" attribute attached to the control?
can you post code of atleast one control?
-Manognya
__________________________________________________
$ God gives what is best.Not what all you wish
|
|
|
|
|
manognya kota wrote: Is the runat="server" attribute attached to the control?
Why would it be? He's using WPF, which doesn't have this attribute.
|
|
|
|
|
Oops!! My mistake...Thanks for the correction.dint notice its WPF
-Manognya
__________________________________________________
$ God gives what is best.Not what all you wish
|
|
|
|
|
byte[] bytBuffer = new byte[4096];
long lngBytesProcessed = 0;
long lngFileLength = fsInput.Length;
int intBytesIncurrentBlock;
CryptoStream csCryptoStream;
System.Security.Cryptography.RijndaelManaged cspRijndael = new System.Security.Cryptography.RijndaelManaged();
pbStatus.Value = 0;
pbStatus.Maximum = 100;
switch (Direction)
{
case CryptoAction.ActionEncrypt:
csCryptoStream = new CryptoStream(fsOutput, cspRijndael.CreateEncryptor(bytKey, bytIV), CryptoStreamMode.Write);
break;
case CryptoAction.ActionDecrypt:
csCryptoStream=new CryptoStream(fsOutput, cspRijndael.CreateDecryptor(bytKey, bytIV), CryptoStreamMode.Write);
break;
}
while (lngBytesProcessed<lngFileLength){
intBytesIncurrentBlock = fsInput.Read(bytBuffer, 0, 4096);
csCryptoStream.Write(bytBuffer, 0, intBytesIncurrentBlock);
lngBytesProcessed = lngBytesProcessed + long.Parse(intBytesIncurrentBlock);
pbStatus.Value = int.Parse((lngBytesProcessed/lngFileLength)*100);
}
Am getting this error with the long.Parse and int.Parse,
The best overloaded method match for 'int.Parse(string)' has some invalid arguments
The best overloaded method match for 'long.Parse(string)' has some invalid arguments
Can't convert long or int to string
plss help
|
|
|
|
|
Well, there are a few things you need to understand.
1. This forum is for WPF/Silverlight. What you posted should be dealt with in the C# forum.
2. You haven't supplied any strings to parse. The values in the Parse methods are numeric already, and Parse expects a string.
3. When parsing a string to a number, you are better off using TryParse instead - just in case the string contains crap.
4. Your post seems to indicate that you are trying to convert a long/int to a string. This can be done simply by calling ToString() on the value, or convert it with the (string) converter. Here's an example:
private string GetValue(int value)
{
return (string)value;
}
|
|
|
|
|
I am working on this dialog[^]
The part data in the center is a ListBox. I want to add radio buttons to each list row so that it will then look like this[^](I mocked this up). Each row can be always expanded an non-collapsable.
So, I have this xaml:
<Window.Resources>
<HierarchicalDataTemplate DataType="{x:Type model:PartDescriptionUpdateModel}"
ItemsSource="{Binding Path=Descriptions}">
<StackPanel Orientation="Horizontal">
<Image Source="/Abtech.Spares.UI;component/Media/Graphics/lancard_enabled_128x128.png"
Height="16"
Width="16"
Margin="0,0,3,0"/>
<TextBlock Text="{Binding Path=PartNo}"/>
<Label Content=" - "/>
<TextBlock Text="{Binding Path=Description}"/>
</StackPanel>
</HierarchicalDataTemplate>
</Window.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<!--List of part info-->
<ListBox x:Name="lstParts"
Grid.Row="2"
Margin="5"
ItemsSource="{Binding PartsData}"/>
</Grid>
I am not sure how to add to the data template to get the radio buttons in there. Anyone know how to do this?
Mank thanks
Everything makes sense in someone's mind
|
|
|
|
|
In your StackPanel, you would add an ItemsControl ItemsSource={Binding SubItems} or whatever and set the item template of the ItemsControl up to be a RadioButton + Text. The tricky part here is going to be setting up the RadioButton GroupName (so the radio buttons actually behave like a group). If you have 3 radio buttons in an item, they've all got to have the same group name, but that group name has to be different for each listbox item. I'm gonna assume PartNo is unique for each part, so I'd set the group name in your ItemsControl template radio button to be PartNo.
|
|
|
|
|
Now that I think about it - there's no gaurentee that the part # will be unique in the list.
I'm wondering if I can do this more simply with a treeview.
Everything makes sense in someone's mind
|
|
|
|
|
Doesn't have to be the PartNo. That was just a suggestion that looked the simplest. You can use a GUID, or the index of the item in the ItemsSource. Anything that is unique at the ListBoxItem level. You'd run into the same issue using radio buttons in a tree. If you don't set the group name, they act like checkboxes. ItemsControl is very simple to use.
|
|
|
|
|
Ok, I understand your solution.
My data models are very simple:
public class PartDescriptionUpdateModel
{
public string PartNo { get; set; }
public string Description { get; set; }
public List<PartDescriptionModel> Descriptions { get; set; }
}
and
public class PartDescriptionModel
{
public Inventory InventoryLocation { get; set; }
public string PartDescription { get; set; }
public string ImageName { get; set; }
}
I now have this:
<Window.Resources>
<HierarchicalDataTemplate DataType="{x:Type model:PartDescriptionUpdateModel}"
ItemsSource="{Binding Path=Descriptions}">
<StackPanel Orientation="Vertical">
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding Path=PartNo}"/>
<Label Content=" - "/>
<TextBlock Text="{Binding Path=Description}"/>
</StackPanel>
<ItemsControl ItemsSource="{Binding Descriptions}"
Margin="10, 0, 0, 20">
<ItemsControl.ItemTemplate>
<DataTemplate>
<RadioButton Content="{Binding PartDescription}"/>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</StackPanel>
</HierarchicalDataTemplate>
</Window.Resources>
It produces this[^].
There are 2 problems:
1) There's only 1 radio button being displayed. There are 3 per part.
2) The same value is being displayed for all.
I'm sort of new to templating, but I'm guessing there's a binding problem? Anything look abvious to you?
Everything makes sense in someone's mind
|
|
|
|
|
Not sure why you are using a HierarchicalDataTemplate for the ListBox vs. a DataTemplate, but I don't think thats causing your issue. Or did you switch over to a tree?
One "nice-ety" in WPF is that it allows string formatting, so instead of doing the string - string part in a StackPanel, you can just have a single TextBlock and use the StringFormat property to format the string (using a MultiBinding for the PartNo and Description), but thats just clean up, not really your issue.
Ok, so if I'm to understand, your ItemsSource on the ListBox is pointing to PartDescriptionUpdateModel? PartDescriptionUpdateModel.Descriptions is a List of PartDescriptionModels. However, it seems like you are binding to properties of PartDescriptionUpdateModel and not the individual PartDescriptionModels?
Where is that LevelingPad stuff stored?
|
|
|
|
|
No, I'm still using the listbox.
Yes, the listbox is bound to PartDescriptionUpdateModel and its ItemsSource is Descriptions
which is a list of PartDescriptionModels
The ItemsControl is defined like this:
<ItemsControl ItemsSource="{Binding Descriptions}"
Margin="10, 0, 0, 20">
<ItemsControl.ItemTemplate>
<DataTemplate>
<RadioButton Content="{Binding PartDescription}"/>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
You can see the ItemsSource="{Binding Descriptions}". I'm not sure if this is the problem. I now have both the listbox and ItemsControl.ItemsSource bound to the same source.
t you mean by "LevelingPad stuff". Can you elaborate please?
Everything makes sense in someone's mind
|
|
|
|
|
Yeah, thats what I was getting at... according to your screen shot, the ListBox ItemsSource should be binding to the list of items that looks something like:
[0] A7136-67001 _ System BRX...
[1] AB587-60005 _ ...
.
.
.
The ItemsSource for the ItemsControl should be binding to a collection that looks something like:
[0] Leveling pad - screws into bottom of cabinet
[1] Backplane
.
.
Are the radio buttons choices going to be the same for each ListBoxItem? If so, you can just use a single ItemsSource for all the radio buttons and have that List on your VM. Otherwise, each item would need to have its own list of RadioButton choices.
|
|
|
|
|
There will always be 3 radio buttons. Their content is coming from data.
Everything makes sense in someone's mind
|
|
|
|