|
I have enabled the IIS request failed tracing I got the following xml file, can you please help me in finding out what I am missing when I try to make request for the .deploy as mentioned in the above message you sent me. I tried to put the message here but the thing is here its not taking the HTML message of that long. But anyways I am not able to understand why is it failing.
Can you please help in that aspect a little bit?
<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type='text/xsl' href='freb.xsl'?>
<!-- saved from url=(0014)about:internet -->
<failedRequest url="http://localhost:80/WpfBrowserApplication12015/WpfBrowserApplication12015.exe.deploy"
siteId="1"
appPoolId="WPF Browser App Pool"
processId="9100"
verb="GET"
remoteUserName=""
userName=""
tokenUserName="NT AUTHORITY\IUSR"
authenticationType="anonymous"
activityId="{00000000-0000-0000-0600-0080020000FF}"
failureReason="STATUS_CODE"
statusCode="404"
triggerStatusCode="404"
timeTaken="62"
xmlns:freb="http://schemas.microsoft.com/win/2006/06/iis/freb"
>
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
<System>
<Provider Name="WWW Server" Guid="{3A2A4E84-4C21-4981-AE10-3FDA0D9B0F83}"/>
<EventID>0</EventID>
<version>1
<level>0
<opcode>1
<keywords>0x0
<TimeCreated SystemTime="2016-09-21T17:55:47.580Z"/>
<Correlation ActivityID="{00000000-0000-0000-0600-0080020000FF}"/>
<Execution ProcessID="9100" ThreadID="15072"/>
<Computer>BSCWL751990</Computer>
</System>
<EventData>
<Data Name="ContextId">{00000000-0000-0000-0600-0080020000FF}</Data>
<Data Name="SiteId">1</Data>
<Data Name="AppPoolId">WPF Browser App Pool</Data>
<Data Name="ConnId">1610612741</Data>
<Data Name="RawConnId">0</Data>
<Data Name="RequestURL">http:
<Data Name="RequestVerb">GET</Data>
</EventData>
<RenderingInfo Culture="en-US">
<Opcode>GENERAL_REQUEST_START</Opcode>
</RenderingInfo>
<ExtendedTracingInfo xmlns="http://schemas.microsoft.com/win/2004/08/events/trace">
<EventGuid>{D42CF7EF-DE92-473E-8B6C-621EA663113A}</EventGuid>
</ExtendedTracingInfo>
</Event>
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
<System>
<Provider Name="WWW Server" Guid="{3A2A4E84-4C21-4981-AE10-3FDA0D9B0F83}"/>
<EventID>0</EventID>
<Version>1</Version>
<Level>5</Level>
<Opcode>4</Opcode>
<Keywords>0x100</Keywords>
<TimeCreated SystemTime="2016-09-21T17:55:47.580Z"/>
<Correlation ActivityID="{00000000-0000-0000-0600-0080020000FF}"/>
<Execution ProcessID="9100" ThreadID="15072"/>
<Computer>BSCWL751990</Computer>
</System>
<EventData>
<Data Name="ContextId">{00000000-0000-0000-0600-0080020000FF}</Data>
<Data Name="ModuleName">FailedRequestsTracingModule</Data>
</EventData>
<RenderingInfo Culture="en-US">
<Opcode>PRE_BEGIN_REQUEST_START</Opcode>
<Keywords>
<Keyword>RequestNotifications</Keyword>
</Keywords>
</RenderingInfo>
<ExtendedTracingInfo xmlns="http://schemas.microsoft.com/win/2004/08/events/trace">
<EventGuid>{002E91E3-E7AE-44AB-8E07-99230FFA6ADE}</EventGuid>
</ExtendedTracingInfo>
</Event>
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
<System>
<Provider Name="WWW Server" Guid="{3A2A4E84-4C21-4981-AE10-3FDA0D9B0F83}"/>
<EventID>0</EventID>
<Version>1</Version>
<Level>5</Level>
<Opcode>5</Opcode>
<Keywords>0x100</Keywords>
<TimeCreated SystemTime="2016-09-21T17:55:47.580Z"/>
<Correlation ActivityID="{00000000-0000-0000-0600-0080020000FF}"/>
<Execution ProcessID="9100" ThreadID="15072"/>
<Computer>BSCWL751990</Computer>
</System>
<EventData>
<Data Name="ContextId">{00000000-0000-0000-0600-0080020000FF}</Data>
<Data Name="ModuleName">FailedRequestsTracingModule</Data>
<Data Name="NotificationStatus">0</Data>
</EventData>
<RenderingInfo Culture="en-US">
<Opcode>PRE_BEGIN_REQUEST_END</Opcode>
<Keywords>
<Keyword>RequestNotifications</Keyword>
</Keywords>
<freb:Description Data="NotificationStatus">NOTIFICATION_CONTINUE</freb:Description>
</RenderingInfo>
<ExtendedTracingInfo xmlns="http://schemas.microsoft.com/win/2004/08/events/trace">
<EventGuid>{002E91E3-E7AE-44AB-8E07-99230FFA6ADE}</EventGuid>
</ExtendedTracingInfo>
</Event>
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
<System>
<Provider Name="WWW Server" Guid="{3A2A4E84-4C21-4981-AE10-3FDA0D9B0F83}"/>
<EventID>0</EventID>
<Version>1</Version>
<Level>5</Level>
<Opcode>4</Opcode>
<Keywords>0x100</Keywords>
<TimeCreated SystemTime="2016-09-21T17:55:47.580Z"/>
<Correlation ActivityID="{00000000-0000-0000-0600-0080020000FF}"/>
<Execution ProcessID="9100" ThreadID="15072"/>
<Computer>BSCWL751990</Computer>
</System>
<EventData>
<Data Name="ContextId">{00000000-0000-0000-0600-0080020000FF}</Data>
<Data Name="ModuleName">RequestMonitorModule</Data>
</EventData>
<RenderingInfo Culture="en-US">
<Opcode>PRE_BEGIN_REQUEST_START</Opcode>
<Keywords>
<Keyword>RequestNotifications</Keyword>
</Keywords>
</RenderingInfo>
<ExtendedTracingInfo xmlns="http://schemas.microsoft.com/win/2004/08/events/trace">
<EventGuid>{002E91E3-E7AE-44AB-8E07-99230FFA6ADE}</EventGuid>
</ExtendedTracingInfo>
</Event>
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
<System>
<Provider Name="WWW Server" Guid="{3A2A4E84-4C21-4981-AE10-3FDA0D9B0F83}"/>
<EventID>0</EventID>
<Version>1</Version>
<Level>5</Level>
<Opcode>5</Opcode>
<Keywords>0x100</Keywords>
<TimeCreated SystemTime="2016-09-21T17:55:47.580Z"/>
<Correlation ActivityID="{00000000-0000-0000-0600-0080020000FF}"/>
<Execution ProcessID="9100" ThreadID="15072"/>
<Computer>BSCWL751990</Computer>
</System>
Thanks,
Abdul Aleem
"There is already enough hatred in the world lets spread love, compassion and affection."
|
|
|
|
|
Not without seeing the full file.
If you open the XML file in Internet Explorer, you should see a detailed log of the failed request, and the breakdown of what caused the error.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Hi,
xml file is too big, can you please give me some hints where to look or some searching criteria mostly its saying 400 error and not saying which file is missing my friend. I know its kind of bugging for you.
If you can help me its really great - thank you.
Thanks,
Abdul Aleem
"There is already enough hatred in the world lets spread love, compassion and affection."
|
|
|
|
|
If you open the XML file in Internet Explorer, you will get a formatted list of errors and warnings.
If you can't work out what they mean, then post the file to a new GitHub Gist[^] and provide the link.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I have a situation where I am trying to change the visibility of StackPanels in a child UserControl from a button in the parent window. I created a custom class below that holds a static reference to the UserControl value and in the UserControl View constructor the user control value is assigned to the static EditWindow class uc static value. Now what I am trying to do is hide and show StackPanels in the child UserControl view the button in the parent window is clicked. When the button is clicked the StackPanels are not changing from Collapsed to Visible. All of the code is below:
EditWindow.cs
public static class EditWindow
{
public static string buttonString;
public static Button button;
public static View.ApplicationInfoView uc;
}
<v:ApplicationInfoView />
ApplicationInfoView StackPanels
<StackPanel Name="Sp1">
<StackPanel Name="Sp2">
<StackPanel Name="Sp2">
EditWindow.uc = this;
private void btnEdit_Click(object sender, RoutedEventArgs)
{
EditWindow.uc.editAppInfo();
}
editAppInfo()
{
EditWindow.uc.sp1.Visibility = Visibility.Collapsed;
EditWindow.uc.sp2.Visibility = Visibility.Visible;
EditWindow.uc.sp3.Visibility = Visibility.Visibile;
}
|
|
|
|
|
If the StackPanels are "empty", toggling visibility will make no difference unless you use an explicit minimum height, width and / or color in order to "see" them.
Also, the layout (right or wrong) impacts what one sees (in-back versus in-front; etc); regardless of what the "code-behind" is doing.
|
|
|
|
|
I have now tried changing the way I am performing my task. Now in my child user control constructor I am loading the UserControl as follows:
// Remember EditWindow is a static class and uc is a static // public value of View.ApplicationInfoView which is the // UserControl that is a View with a base class of // UserControl.
EditWindow.uc = this;
And now calling the method the following on the parent window button click event:
// Remember the StackPanel spGrid is Collapsed onload
private void btn_click(object sender, RoutingEventArgs e)
{
EditWindow.uc.spGrid.Visibility = Visibility.Visible;
}
Now Here is my StackPanel on the child UserControl:
<StackPanel Name="spGrid" Grid.Column="0" Grid.ColumnSpan="4" Grid.Row="2">
<Grid Name="Grid2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="425" />
<ColumnDefinition Width="425" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="25" />
<RowDefinition Height="75" />
<RowDefinition Height="75" />
<RowDefinition Height="75" />
<RowDefinition Height="75" />
<RowDefinition Height="75" />
<RowDefinition Height="75" />
<RowDefinition Height="75" />
</Grid.RowDefinitions>
<Label Height="36" Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" FontSize="16" Background="#FF004A78" Content="Identifying Documents" FontWeight="Bold" Foreground="White" Margin="0,0,0,0"/>
<StackPanel Grid.Row="1" Grid.Column="0" >
<Border BorderBrush="White" BorderThickness="3">
<Border BorderBrush="Gray" BorderThickness="1">
<StackPanel Orientation="Vertical">
<StackPanel Orientation="Horizontal">
<StackPanel Width="420" x:Name="_Passport" Margin="0,0,0,0" Height="65">
<StackPanel Orientation="Horizontal">
<TextBlock Height="45" Width="Auto" FontWeight="Bold" Foreground="#FF004A78" FontSize="18" x:Name="Passport_TextBlock" Text="Passport" TextAlignment="Left"/>
<Image Source="/Images/Attachments_button.jpg" Margin="180, 0, 0 ,0" MouseLeftButtonUp="Click_MouseLeftButtonUp" Name="PPTop" Width="Auto" Height="45" />
<Image Source="/Images/Attachments_button.jpg" Margin="50, 0, 0 ,0" Name="PPBottom" Width="Auto" Height="45" />
</StackPanel>
<TextBlock Height="20" Width="Auto" Foreground="#FF004A78" FontSize="12" TextWrapping="WrapWithOverflow" x:Name="Passport2_TextBlock" Text="(Color copy, top and bottom) Perferred Passport Top Passport Bottom" TextAlignment="Left"/>
</StackPanel>
</StackPanel>
</StackPanel>
</Border>
</Border>
</StackPanel>
</StackPanel>
</Grid>
</StackPanel>
Now, again the StackPanel I am trying to hide/show is Name="spGrid". It houses my Grid "Grid2". Now this StackPanel is housed in it's own Grid. Shown is the nested Grid. Also, I am only showing you only one of the rows in the nested Grid of StackPanel spGrid. The other rows have the same type of controls. Again I don't know why when my EditWindow static class's UserControl uc set's it's StackPanel spGrid to visible it stil stays hidden.
|
|
|
|
|
This is one of those situations where the XAML should be "re-considered". (The "depth" of this simple visual tree is sure ... "deep"...)
Even your top "stack panel" is imbedded in a Grid; so you've still not got the whole picture.
State what you're trying to do from a "user" / functional point-of-view, and you'll probably get some good design answers to get you off with a less "complicated" (XAML) design / approach.
|
|
|
|
|
The appropriate way to do this is to create a Tunnelling Routed Event that the Child User control listens to. And make that event fire when you click the button on the parent control. This article on MSDN explains how to declare a Routed Event
|
|
|
|
|
Hi All,
I am using a Silverlight listbox on which I display some integers, when I select a particular item of listbox (ie integer), it has to show me the value of that integer. Showing part is working perfect but the problem is when I select one item and then go to another item, silverligh is not clearing the selection of the first one instead keeping the selection on both, which looks weird to customer, any help is appreciated.
Here is my xaml
<UserControl x:Class="RollDiceApp.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300"
xmlns:local="clr-namespace:RollDiceApp"
xmlns:viewmodel="clr-namespace:RollDiceApp.ViewModel"
Height="650" Width="700"
Name="diceGamePage"
>
<UserControl.DataContext>
<viewmodel:DiceGameViewModel x:Name="_diceGameViewModel"
/>
</UserControl.DataContext>
<pre>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition>
</ColumnDefinition>
<ColumnDefinition Width="76.988"></ColumnDefinition>
</Grid.ColumnDefinitions>
<ListBox x:Name="lblHistory" Margin="1.988,40.96,10,10" Grid.Column="1" FontSize="21.333"
FontWeight="Bold" FontStyle="Italic"
ItemsSource="{Binding Items}"
SelectedItem="{Binding Path=SelectedItem, Mode=TwoWay}" SelectionMode="Single" >
</ListBox>
<Button x:Name="cmdRollDice" Content="Roll Dice" VerticalAlignment="Top" Margin="12,13,0,0" HorizontalAlignment="Left" Width="65"
Command="{Binding Path=ClickSaveCommand}" >
</Button>
<Button x:Name="cmdClearAllDice" Content="Clear All Dice" VerticalAlignment="Top" Margin="610,13,-2,0" HorizontalAlignment="Left" Width="92"
Command="{Binding Path=ClearHistoryCommand}" Grid.ColumnSpan="2" >
</Button>
<Image x:Name="imgDice" Margin="10, 42.97,10,10" Source="{Binding ImageSourcePath}" />
</Grid>
Here is my ViewModel
namespace RollDiceApp.ViewModel
{
public class DiceGameViewModel : INotifyPropertyChanged, IDataErrorInfo
{
public DiceGameViewModel()
{
_items = new ObservableCollection<int>();
_imageSourcePath = string.Empty;
}
private string GetNewImagePath(int v)
{
if ((v == null) || (v <= 0))
v = 1;
return HelperMethods.GetRootDirectory() + @"/Images/" + v.ToString() + ".jpg";
}
private int GetRandom(int min, int max)
{
Random generator = new Random();
return generator.Next(min, max);
}
private string _imageSourcePath;
public string ImageSourcePath {
get { return _imageSourcePath; }
set
{
_imageSourcePath = value;
NotifyPropertyChanged("ImageSourcePath");
}
}
private ObservableCollection<int> _items;
public ObservableCollection <int> Items
{
get { return _items; }
set
{
_items = value;
NotifyPropertyChanged("Items");
}
}
private int _selecteditem;
public int SelectedItem {
get { return _selecteditem; }
set
{<br />
_selecteditem = value;
NotifyPropertyChanged("SelectedItem");
DisplayNewDiceValue(value);
}
}
public event PropertyChangedEventHandler PropertyChanged;
private void NotifyPropertyChanged(string propertyName)
{
PropertyChangedEventHandler handler = PropertyChanged;
if(null!=handler)
{
handler(this, new PropertyChangedEventArgs(propertyName));
}
}
private void DisplayNewDiceValue(int val)
{
ImageSourcePath = GetNewImagePath(val);
NotifyPropertyChanged("ImageSourcePath");
}
private void DisplayHistory(int val)
{
_items.Add(val);
NotifyPropertyChanged("ImageSourcePath");
}
private void ClickRollDice()
{
int i = GetRandom(1, 6);
DisplayNewDiceValue(i);
DisplayHistory(i);
}
private void CmdClearHistory()
{
_items.Clear();
ImageSourcePath = "";
NotifyPropertyChanged("ImageSourcePath");
}
private ICommand _clickSaveCommand;
public ICommand ClickSaveCommand {
get { return _clickSaveCommand ??
(_clickSaveCommand = new RollDiceApp.ViewModel.Command.RollDiceCommand(() => ClickRollDice(), true));
} }
private ICommand _clearHistoryCommand;
public ICommand ClearHistoryCommand
{
get
{
return _clickSaveCommand ??
(_clickSaveCommand = new RollDiceApp.ViewModel.Command.RollDiceCommand(() => CmdClearHistory(), true));
}
}
string IDataErrorInfo.this[string columnName]
{
get
{
throw new NotImplementedException();
}
}
string IDataErrorInfo.Error
{
get
{
throw new NotImplementedException();
}
}
}
}
Here is my Command
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Input;
namespace RollDiceApp.ViewModel.Command
{
public class RollDiceCommand : ICommand
{
private Action _action;
private Boolean _canExecute;
public RollDiceCommand(Action _action, Boolean _canExecute)
{
this._action = _action;
this._canExecute = _canExecute;
}
bool ICommand.CanExecute(object parameter)
{
return _canExecute;
}
public event EventHandler CanExecuteChanged;
void ICommand.Execute(object parameter)
{
_action();
}
}
}
Here is my other class
namespace RollDiceApp
{
public class HelperMethods
{
public static string GetRootDirectory()
{
string uriPath = Application.Current.Host.Source.ToString();
Uri uri = new Uri(uriPath);
Uri parent = new Uri(uri, "..");
return parent.ToString();
}
}
}
Here is my App.xaml
<Application xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="RollDiceApp.App"
<pre>
>
<Application.Resources>
</Application.Resources>
There are 6 images in images folder with names 1.jpg to 6.jpg, you can create any Images for that.
Thanks,
Abdul Aleem
"There is already enough hatred in the world lets spread love, compassion and affection."
|
|
|
|
|
Hi All,
I have created xbap application and moved the xbap, exe and manifest files into wwroot folder.
Now to be able to use/call this xbap file from clients browser, I have few questions
- do I need to create a html file to call this xbap from browser? If I need to, can you please give me the sample tags how to call?
- I tried to call xbap it looked like it was executing but did not, it seems like certificates or permissions are the issue, if I want to give certificate or permissions, how can I do it on the Virtual directory? I am using IIS 7
- Do I need to install MIME types on IIS to exec my xbap file? Reason is I got a script from msdn which installs it but it was giving me error, if I need to have them installed, is there any better and guaranteed approach to do the same on IIS 7.
I am searching and inquiring with friends and colleagues but anything helps a small code snippet, a link or even a suggestion helps.
Thanks in advance my friends.
Thanks,
Abdul Aleem
"There is already enough hatred in the world lets spread love, compassion and affection."
|
|
|
|
|
Hello,
i'm working with expanders in MVVM and i trying to get notification in the viewmodel when the expander is already opened and when it's opened i want to make print screen to the expander content.
and the scenario is like this:
1)i open the expander that binded to IsExpanderOpen property in the VM and fill the details i want
2)i close the expander (don't ask why it's only example)
3)press OK to save the details of expander controls in DB
4)the OK i pressed call to realycommand 'OpenExpander()' that execute the line IsExpanderOpen=true
5)then i make print screen to the content of opened expander(but it captures closed expander)
this scenario doesn't work because the viewmodel doesn't know to wait the xaml to be rendered when the expander is opended.
i don't want code behind so is there any way to know when the ui is already render the operation
and only then to trigger the viewmodel?
|
|
|
|
|
I haven't tested this but I would imagine it would be as simple as binding an to the Expanded event (can be done with an EventToCommand). However, if it takes the inner content a while to load up; e.g. because you are lazy loading, then you need to transfer the print logic to wait for that instead.
This space for rent
|
|
|
|
|
Ok look this is the code of xaml i use event with command and also send the expander as parameter
<expander x:name="AExpander" margin="0,0,0,5" isexpanded="{Binding SectionAExpander}"
="" isenabled="{Binding WasAppNumEntered}" style="{StaticResource LsExpander}">
<behaviors:commandbehaviorcollection.behaviors>
<behaviors:behaviorbinding event="Expanded" command="{Binding OnExpandedCommand}" commandparameter="{Binding ElementName=AExpander}">
<expander.header>
and this is the viewmodel code:
1) this is the command that binded to xaml
public ICommand OnExpandedCommand
{
get
{
if (_onExpandedCommand == null)
{
_onExpandedCommand = new RelayCommand(OnExpanderOpened);
}
return _onExpandedCommand;
}
}
2)this is the function OnExpanderOpened:
private Expander expanderA;
private void OnExpanderOpened(object obj)
{
expanderA = (Expander)obj;
if (expanderA.IsExpanded)//show true
{
CanPrintDataEntry = true;//attached property that call to the print screen function
}
}
so you see expanderA show that it's opened but the render happens after it is true in the VM
and i get print screen with closed expander so is there any way to notify
the viewmodel AFTER xaml is rendered
thank you
|
|
|
|
|
Okay, then you are going to have to get to the ContentRendered event (not easily done I'm afraid). To do this, if I were you, I would create a behavior that behaved something like this internally:
AssociatedObject.Loaded += LoadedEvent;
private void LoadedEvent(object sender, RoutedEventArgs e)
{
PresentationSource presentationSource = PresentationSource.FromVisual((Visual)sender);
presentationSource.ContentRendered += ContentRenderedHandler;
}
private void ContentRenderedHandler(object sender, EventArgs e)
{
((PresentationSource)sender).ContentRendered -= ContentRenderedHandler;
}
This space for rent
|
|
|
|
|
OK i will try your solution
thank you.
|
|
|
|
|
correction: This is the xaml code
<Expander x:Name="AExpander" Margin="0,0,0,5" IsExpanded="{Binding SectionAExpander}"
IsEnabled="{Binding WasAppNumEntered}" Style="{StaticResource LsExpander}">
<behaviors:CommandBehaviorCollection.Behaviors>
<behaviors:BehaviorBinding Event="Expanded" Command="{Binding OnExpandedCommand}" CommandParameter="{Binding ElementName=AExpander}"/>
</behaviors:CommandBehaviorCollection.Behaviors>
<Expander.Header>
|
|
|
|
|
and by the way you said to transfer the logic to wait
do you suggest to use another thread except the ui thread?
|
|
|
|
|
Hi,
I have to create some ContentControl code behind and be able to change their content and their DataTemplate according to their data type (image or text)
(So, I've created a ContentControl code behind, given it (code-behind too) a style from the XAML. In this style I've set DataTemplates)
I'm blocked with a binding problem! The 'person' object is displaying but I can't get to its 'display_text' property!
Could you please help? Thanks!!
PS: By the way, my goal is to create containers dynamically, then send them a 'person' object and have a picture displayed if available or a text displayed (if image not available)...so, if you have other suggestions on how to achieve this they all are welcome!!
<Window x:Class="MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2...l/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:WpfApplication1"
Title="MainWindow" Height="350" Width="525" Background="#FF3A3A48">
<Window.Resources>
<local:RelativeToAbsolutePathConverter x:Key="relToAbsPathConverter" />
<DataTemplate x:Key="ccTexte">
<TextBlock Text="{Binding display_text}" HorizontalAlignment="Center" Foreground="Beige"/>
</DataTemplate>
<DataTemplate x:Key="ccImage">
<Image x:Name="img" Source="{Binding display_image, Converter={StaticResource relToAbsPathConverter}}"/>
</DataTemplate>
<Style x:Name="ccStyle" TargetType="ContentControl">
<Setter Property="ContentTemplate" Value="{StaticResource ccTexte}"/>
</Style>
</Window.Resources>
<Grid Name="mainGrid">
<Button Content="Button" Height="23" HorizontalAlignment="Left" Margin="416,12,0,0" Name="Button1" VerticalAlignment="Top" Width="75" />
</Grid>
</Window>
Imports System.IO
Class MainWindow
Private Sub MainWindow_Loaded(sender As Object, e As System.Windows.RoutedEventArgs) Handles Me.Loaded
mainGrid.Children.Add(designCC(300, 200, "01"))
Dim cc As ContentControl = LogicalTreeHelper.FindLogicalNode(mainGrid, "CC_01")
cc.Content = New person With {.display_image = "01.png", .display_text = "Text 01"}
End Sub
Private Sub Button1_Click(sender As System.Object, e As System.Windows.RoutedEventArgs) Handles Button1.Click
Dim cc As ContentControl = LogicalTreeHelper.FindLogicalNode(mainGrid, "CC_01")
cc.Content = New person With {.display_image = "02.png", .display_text = "Text 02"}
End Sub
Private Function designCC(width As Integer, height As Integer, id As String) As ContentControl
Dim cc As New ContentControl
cc.Width = width
cc.Height = height
cc.Name = "CC_" & id
cc.Style = DirectCast(Me.Resources("ccStyle"), Style)
Return cc
End Function
End Class
Public Class person
Private _display_image As String
Public Property display_image() As String
Get
Return _display_image
End Get
Set(value As String)
_display_image = value
End Set
End Property
Private _display_text As String
Public Property display_text() As String
Get
Return _display_text
End Get
Set(value As String)
_display_text = value
End Set
End Property
End Class
Public Class RelativeToAbsolutePathConverter
Implements IValueConverter
Public Function Convert(ByVal value As Object, ByVal targetType As Type, ByVal parameter As Object, ByVal culture As System.Globalization.CultureInfo) As Object Implements IValueConverter.Convert
Dim relative As [String] = TryCast(value, String)
If relative Is Nothing Or relative = "" Then
Return Nothing
End If
Return System.AppDomain.CurrentDomain.BaseDirectory & "Images\" & relative
End Function
Public Function ConvertBack(ByVal value As Object, ByVal targetType As Type, ByVal parameter As Object, ByVal culture As System.Globalization.CultureInfo) As Object Implements IValueConverter.ConvertBack
Throw New NotImplementedException()
End Function
End Class
|
|
|
|
|
I am currently using the SelectionChanged event in my ListView to fire when a row in the GridView is selected. Now I have ran into a problem that if the first row in the gridview is selected the SelectionChange will not fire. Can someone please help me determine how I detect if the first row is the row is selected?
modified 7-Sep-16 14:57pm.
|
|
|
|
|
I did find the ListView UnselectAll() function but even that did not work.
|
|
|
|
|
Has anyone ever seen this? I have a Listbox control:
<ListBox Grid.Row="3" Grid.ColumnSpan="3" Margin="3" SelectionMode="Multiple"
ItemsSource="{Binding Children}" SelectedItem="{Binding SelectedChild}" SelectionChanged="Children_SelectionChanged">
And there is a property IsSelected in the class that selecting an item changes correctly.
I also have a "Select All" button and an "Unselect All" button which seem to work. After pressing the button and counting the selected objects I get the expected counts.
Now my listbox has more items than fit in the view area, so the scroll bars appear.
The problem comes when I press the select all button and then scroll the list box. Even though my count said they were all selected, after I scroll, the items that were not in the window at the time the button was pressed revert to their prior state. The IsSelected property is re-called by the scrolling.
I don't know if I can make it any clearer. How do I keep the scroll bar from resetting the IsSelected property? Or How can I get the listbox to keep the items outside the visual area selected or unselected?
Thanks for any help.
Brent
|
|
|
|
|
This has always confused me and I would love to set the record straight.
Say you have this style:
<Style TargetType="{x:Type local:ControlBasedOnUserControl}">
<Setter Property="Width" Value="50" />
<Setter Property="Height" Value="50" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type local:ControlBasedOnUserControl}">
<Border>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
Does WPF automatically apply the width and height of the control to the template's parent element or should the width and height be bound explicitly in the template?
<Style TargetType="{x:Type local:ControlBasedOnUserControl}">
<Setter Property="Width" Value="50" />
<Setter Property="Height" Value="50" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type local:ControlBasedOnUserControl}">
<Border Width="{TemplateBinding Width}" Height="{TemplateBinding Height}">
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
I've found that I can set a width and height regardless if it is explicitly defined in template, but that doesn't seem right. Thoughts?
|
|
|
|
|
I have a Telerik RadCombobox where I need to react to the change of selected item and store the selected value.
<telerik:RadComboBox ItemsSource="{Binding CurrencyList}"
DisplayMemberPath="Currency"
SelectedValuePath="CurrencyID"
SelectedValue="{Binding SelectedIssuance.IssuanceCurrencyID, Mode=TwoWay}"
IsSynchronizedWithCurrentItem="True"
SelectedItem="{Binding SelectedCurrency,Mode=OneWayToSource}" />
This works the first time I access the view, however subsequent accesses on the same or another record the displayed value is always the first record in the CurrencyList
Any suggestions on how to fix this issue?
One idea is to get the changed value in the VM from the Model by subscribing to the OPC event and remove the SelectedItem binding.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I have been fighting with the OpenFileDialog to try to read the bytes of any type of file into a stream or byte[] to store in a database table but can't seem to get it right. Is using the OpenFileDialog class the correct way to go?
|
|
|
|
|